Bug 1288638 - Unconditionally SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX. - r=mtseng
MozReview-Commit-ID: CPgJTTV8vAA
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -38,16 +38,22 @@ ChooseValidatorCompileOptions(const ShBu
SH_OBJECT_CODE |
SH_LIMIT_CALL_STACK_DEPTH |
SH_INIT_GL_POSITION;
if (resources.MaxExpressionComplexity > 0) {
options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
}
+ // Sampler arrays indexed with non-constant expressions are forbidden in
+ // GLSL 1.30 and later.
+ // ESSL 3 requires constant-integral-expressions for this as well.
+ // Just do it universally.
+ options |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
+
if (gfxPrefs::WebGLAllANGLEOptions()) {
return options |
SH_VALIDATE_LOOP_INDEXING |
SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX |
SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX |
SH_EMULATE_BUILT_IN_FUNCTIONS |
SH_CLAMP_INDIRECT_ARRAY_BOUNDS |
SH_UNFOLD_SHORT_CIRCUIT |
@@ -73,21 +79,16 @@ ChooseValidatorCompileOptions(const ShBu
options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
}
// Work around bug 735560
if (gl->Vendor() == gl::GLVendor::Intel) {
options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
}
- // Work around bug 636926
- if (gl->Vendor() == gl::GLVendor::NVIDIA) {
- options |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
- }
-
// Work around that Mac drivers handle struct scopes incorrectly.
options |= SH_REGENERATE_STRUCT_NAMES;
}
#endif
return options;
}