gfx/angle/angle-default-clamp-strat.patch
author Christian Holler <choller@mozilla.com>
Tue, 10 Sep 2013 17:00:07 +0200
changeset 146424 0f7c370491bf44c2434049972ac28010d5c0a4ed
parent 146042 356866ae2f6885933451a92aae838af00d659679
permissions -rw-r--r--
Bug 914174 - Ensure JS standalone builds have the right ASan options. r=luke

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;