Bug 1399501 - Part2: Add back SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX to gecko r?jgilbert
This reverts commit a31225ffcc0ab8cfbb7faf552bf64a84634bd23d.
MozReview-Commit-ID: IDCaEqKJHnj
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -32,16 +32,22 @@ static ShCompileOptions
ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
const mozilla::gl::GLContext* gl)
{
ShCompileOptions options = SH_VARIABLES |
SH_ENFORCE_PACKING_RESTRICTIONS |
SH_OBJECT_CODE |
SH_INIT_GL_POSITION;
+ // 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;
+
#ifndef XP_MACOSX
// We want to do this everywhere, but to do this on Mac, we need
// to do it only on Mac OSX > 10.6 as this causes the shader
// compiler in 10.6 to crash
options |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
#endif
if (gl->WorkAroundDriverBugs()) {