|
1 From: Jeff Gilbert <jgilbert@mozilla.com> |
|
2 |
|
3 diff --git a/gfx/angle/src/compiler/Compiler.cpp b/gfx/angle/src/compiler/Compiler.cpp |
|
4 --- a/gfx/angle/src/compiler/Compiler.cpp |
|
5 +++ b/gfx/angle/src/compiler/Compiler.cpp |
|
6 @@ -130,18 +130,21 @@ bool TCompiler::Init(const ShBuiltInReso |
|
7 TScopedPoolAllocator scopedAlloc(&allocator, false); |
|
8 |
|
9 // Generate built-in symbol table. |
|
10 if (!InitBuiltInSymbolTable(resources)) |
|
11 return false; |
|
12 InitExtensionBehavior(resources, extensionBehavior); |
|
13 fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1; |
|
14 |
|
15 - arrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy); |
|
16 - clampingStrategy = resources.ArrayIndexClampingStrategy; |
|
17 + // ArrayIndexClampingStrategy's enum starts at 1, so 0 is 'default'. |
|
18 + if (resources.ArrayIndexClampingStrategy) { |
|
19 + clampingStrategy = resources.ArrayIndexClampingStrategy; |
|
20 + } |
|
21 + arrayBoundsClamper.SetClampingStrategy(clampingStrategy); |
|
22 |
|
23 hashFunction = resources.HashFunction; |
|
24 |
|
25 return true; |
|
26 } |
|
27 |
|
28 bool TCompiler::compile(const char* const shaderStrings[], |
|
29 size_t numStrings, |
|
30 diff --git a/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp b/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp |
|
31 --- a/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp |
|
32 +++ b/gfx/angle/src/third_party/compiler/ArrayBoundsClamper.cpp |
|
33 @@ -72,16 +72,19 @@ private: |
|
34 ArrayBoundsClamper::ArrayBoundsClamper() |
|
35 : mClampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC) |
|
36 , mArrayBoundsClampDefinitionNeeded(false) |
|
37 { |
|
38 } |
|
39 |
|
40 void ArrayBoundsClamper::SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy) |
|
41 { |
|
42 + ASSERT(clampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC || |
|
43 + clampingStrategy == SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION); |
|
44 + |
|
45 mClampingStrategy = clampingStrategy; |
|
46 } |
|
47 |
|
48 void ArrayBoundsClamper::MarkIndirectArrayBoundsForClamping(TIntermNode* root) |
|
49 { |
|
50 ASSERT(root); |
|
51 |
|
52 ArrayBoundsClamperMarker clamper; |