diff options
Diffstat (limited to 'dom/canvas/WebGLShaderValidator.cpp')
-rw-r--r-- | dom/canvas/WebGLShaderValidator.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dom/canvas/WebGLShaderValidator.cpp b/dom/canvas/WebGLShaderValidator.cpp index fda31e212..d574d9a65 100644 --- a/dom/canvas/WebGLShaderValidator.cpp +++ b/dom/canvas/WebGLShaderValidator.cpp @@ -5,6 +5,7 @@ #include "WebGLShaderValidator.h" +#include <algorithm> #include "angle/ShaderLang.h" #include "gfxPrefs.h" #include "GLContext.h" @@ -112,6 +113,16 @@ ShaderOutput(gl::GLContext* gl) return SH_ESSL_OUTPUT; } else { uint32_t version = gl->ShadingLanguageVersion(); + + // Version 130 starts to require integral constant expressions for loop indices, + // instead of "constant-index-expression". + // Both version 400 and gpu_shader5 remove this restrictions. + // gpu_shader5 went core in 400, so we can just check for the GLFeature. + // If we're compiling for webglsl1, even for webgl2, we need gpu_shader5, or GLSL_COMPAT. + if (!gl->IsSupported(gl::GLFeature::gpu_shader5)) { + version = std::min<uint32_t>(version, 120); + } + switch (version) { case 100: return SH_GLSL_COMPATIBILITY_OUTPUT; case 120: return SH_GLSL_COMPATIBILITY_OUTPUT; |