gecko-dev/gfx/angle/angle-default-clamp-strat.patch

53 lines
2.0 KiB
Diff

From: Jeff Gilbert <jgilbert@mozilla.com>
diff --git a/gfx/angle/src/compiler/Compiler.cpp b/gfx/angle/src/compiler/Compiler.cpp
--- a/gfx/angle/src/compiler/Compiler.cpp
+++ b/gfx/angle/src/compiler/Compiler.cpp
@@ -130,18 +130,21 @@ bool TCompiler::Init(const ShBuiltInReso
TScopedPoolAllocator scopedAlloc(&allocator, false);
// Generate built-in symbol table.
if (!InitBuiltInSymbolTable(resources))
return false;
InitExtensionBehavior(resources, extensionBehavior);
fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1;
- arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
- clampingStrategy = resources.ArrayIndexClampingStrategy;
+ // ArrayIndexClampingStrategy's enum starts at 1, so 0 is 'default'.
+ if (resources.ArrayIndexClampingStrategy) {
+ clampingStrategy = resources.ArrayIndexClampingStrategy;
+ }
+ arrayBoundsClamper.SetClampingStrategy(clampingStrategy);
hashFunction = resources.HashFunction;
return true;
}
bool TCompiler::compile(const char* const shaderStrings[],
size_t numStrings,
diff --git a/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp b/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
--- a/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
+++ b/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp
@@ -72,16 +72,19 @@ private:
ArrayBoundsClamper::ArrayBoundsClamper()
: mClampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC)
, mArrayBoundsClampDefinitionNeeded(false)
{
}
void ArrayBoundsClamper::SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy)
{
+ ASSERT(clampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC ||
+ clampingStrategy == SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION);
+
mClampingStrategy = clampingStrategy;
}
void ArrayBoundsClamper::MarkIndirectArrayBoundsForClamping(TIntermNode* root)
{
ASSERT(root);
ArrayBoundsClamperMarker clamper;