summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-11 23:02:26 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-11 23:02:26 +0200
commit31166cc4a9a8f3d16ecb4e96e02adec3a5a01595 (patch)
treed29968c637fd62e2d00bf4205611071d20ef971c
parentfb0b7cdb5097fb91fc0041a7d7b44ecb637a847a (diff)
downloadUXP-31166cc4a9a8f3d16ecb4e96e02adec3a5a01595.tar
UXP-31166cc4a9a8f3d16ecb4e96e02adec3a5a01595.tar.gz
UXP-31166cc4a9a8f3d16ecb4e96e02adec3a5a01595.tar.lz
UXP-31166cc4a9a8f3d16ecb4e96e02adec3a5a01595.tar.xz
UXP-31166cc4a9a8f3d16ecb4e96e02adec3a5a01595.zip
Switch from ShCompileOptions to int.
-rw-r--r--dom/canvas/WebGLShaderValidator.cpp53
-rw-r--r--dom/canvas/WebGLShaderValidator.h6
2 files changed, 30 insertions, 29 deletions
diff --git a/dom/canvas/WebGLShaderValidator.cpp b/dom/canvas/WebGLShaderValidator.cpp
index 57abb68dc..64021fce5 100644
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -28,20 +28,39 @@ IdentifierHashFunc(const char* name, size_t len)
return hash[0];
}
-static ShCompileOptions
+static int
ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
const mozilla::gl::GLContext* gl)
{
- ShCompileOptions options = SH_VARIABLES |
- SH_ENFORCE_PACKING_RESTRICTIONS |
- SH_OBJECT_CODE |
- SH_INIT_GL_POSITION;
-
+ int options = SH_VARIABLES |
+ SH_ENFORCE_PACKING_RESTRICTIONS |
+ SH_INIT_VARYINGS_WITHOUT_STATIC_USE |
+ SH_OBJECT_CODE |
+ 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;
+
+ // Needed for driver bug detection
+ options |= SH_EMULATE_BUILT_IN_FUNCTIONS;
+
+ 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_CLAMP_INDIRECT_ARRAY_BOUNDS |
+ SH_UNFOLD_SHORT_CIRCUIT |
+ SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS |
+ SH_INIT_OUTPUT_VARIABLES |
+ SH_REGENERATE_STRUCT_NAMES;
+ }
#ifndef XP_MACOSX
// We want to do this everywhere, but to do this on Mac, we need
@@ -69,27 +88,9 @@ ChooseValidatorCompileOptions(const ShBuiltInResources& resources,
// Work around that Mac drivers handle struct scopes incorrectly.
options |= SH_REGENERATE_STRUCT_NAMES;
- options |= SH_INIT_OUTPUT_VARIABLES;
}
#endif
- if (gfxPrefs::WebGLAllANGLEOptions()) {
- options = -1;
-
- options ^= SH_INTERMEDIATE_TREE;
- options ^= SH_LINE_DIRECTIVES;
- options ^= SH_SOURCE_PATH;
-
- options ^= SH_LIMIT_EXPRESSION_COMPLEXITY;
- options ^= SH_LIMIT_CALL_STACK_DEPTH;
-
- options ^= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS;
- options ^= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL;
-
- options ^= SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT;
- options ^= SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3;
- }
-
if (resources.MaxExpressionComplexity > 0) {
options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
}
@@ -184,7 +185,7 @@ WebGLContext::CreateShaderValidator(GLenum shaderType) const
#endif
}
- const auto compileOptions = webgl::ChooseValidatorCompileOptions(resources, gl);
+ int compileOptions = webgl::ChooseValidatorCompileOptions(resources, gl);
return webgl::ShaderValidator::Create(shaderType, spec, outputLanguage, resources,
compileOptions);
}
@@ -197,7 +198,7 @@ namespace webgl {
ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec,
ShShaderOutput outputLanguage,
const ShBuiltInResources& resources,
- ShCompileOptions compileOptions)
+ int compileOptions)
{
ShHandle handle = ShConstructCompiler(shaderType, spec, outputLanguage, &resources);
if (!handle)
diff --git a/dom/canvas/WebGLShaderValidator.h b/dom/canvas/WebGLShaderValidator.h
index deb1c7c7f..ba50def28 100644
--- a/dom/canvas/WebGLShaderValidator.h
+++ b/dom/canvas/WebGLShaderValidator.h
@@ -17,7 +17,7 @@ namespace webgl {
class ShaderValidator final
{
const ShHandle mHandle;
- const ShCompileOptions mCompileOptions;
+ const int mCompileOptions;
const int mMaxVaryingVectors;
bool mHasRun;
@@ -25,10 +25,10 @@ public:
static ShaderValidator* Create(GLenum shaderType, ShShaderSpec spec,
ShShaderOutput outputLanguage,
const ShBuiltInResources& resources,
- ShCompileOptions compileOptions);
+ int compileOptions);
private:
- ShaderValidator(ShHandle handle, ShCompileOptions compileOptions,
+ ShaderValidator(ShHandle handle, int compileOptions,
int maxVaryingVectors)
: mHandle(handle)
, mCompileOptions(compileOptions)