DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (27a812186ff4)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
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;