aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZhenyao Mo <zmo@chromium.org>2014-02-26 15:40:48 -0800
committerZhenyao Mo <zmo@chromium.org>2014-03-07 18:59:18 +0000
commit550c600b99d7ee2463e5878d0a9f66ea24c1414a (patch)
tree797b816d4e50f9acf894793efe93eff2e8f02d73 /include
parent2515c5201ba79f803d6f813de006840728922476 (diff)
downloadangle-550c600b99d7ee2463e5878d0a9f66ea24c1414a.tar.gz
Improvement on loop unrolling with loops indexing sampler arrays
1) Before this workaround is hardwired on mac, now we move it behind a compil 2) Fix the issue where "break" inside the loop isn't handled while unrolled. BUG=338474 TEST=webgl conformance test sampler-array-using-loop-index.html Change-Id: I4996a42c2dea39a8a5af772c256f8e3cb383f59a Reviewed-on: https://chromium-review.googlesource.com/188079 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org> Conflicts: include/GLSLANG/ShaderLang.h src/compiler/translator/ValidateLimitations.cpp Change-Id: I546197bd7df1634ebccdd380be14c3250cd56151 Reviewed-on: https://chromium-review.googlesource.com/189061 Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/GLSLANG/ShaderLang.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
index 50a3c45d..255a52a1 100644
--- a/include/GLSLANG/ShaderLang.h
+++ b/include/GLSLANG/ShaderLang.h
@@ -170,9 +170,14 @@ typedef enum {
SH_SOURCE_PATH = 0x0020,
SH_MAP_LONG_VARIABLE_NAMES = 0x0040,
SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080,
+ // If a sampler array index happens to be a loop index,
+ // 1) if its type is integer, unroll the loop.
+ // 2) if its type is float, fail the shader compile.
+ // This is to work around a mac driver bug.
+ SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0100,
// This is needed only as a workaround for certain OpenGL driver bugs.
- SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
+ SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0200,
// This is an experimental flag to enforce restrictions that aim to prevent
// timing attacks.
@@ -180,15 +185,15 @@ typedef enum {
// texture information via the timing channel.
// To use this flag, you must compile the shader under the WebGL spec
// (using the SH_WEBGL_SPEC flag).
- SH_TIMING_RESTRICTIONS = 0x0200,
-
+ SH_TIMING_RESTRICTIONS = 0x0400,
+
// This flag prints the dependency graph that is used to enforce timing
// restrictions on fragment shaders.
// This flag only has an effect if all of the following are true:
// - The shader spec is SH_WEBGL_SPEC.
// - The compile options contain the SH_TIMING_RESTRICTIONS flag.
// - The shader type is SH_FRAGMENT_SHADER.
- SH_DEPENDENCY_GRAPH = 0x0400,
+ SH_DEPENDENCY_GRAPH = 0x0800,
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
// This flag only enforces (and can only enforce) the packing
@@ -196,7 +201,7 @@ typedef enum {
// shaders. ShCheckVariablesWithinPackingLimits() lets embedders
// enforce the packing restrictions for varying variables during
// program link time.
- SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
+ SH_ENFORCE_PACKING_RESTRICTIONS = 0x1000,
// This flag ensures all indirect (expression-based) array indexing
// is clamped to the bounds of the array. This ensures, for example,
@@ -204,32 +209,32 @@ typedef enum {
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
// specified in the ShBuiltInResources when constructing the
// compiler, selects the strategy for the clamping implementation.
- SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000,
+ SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x2000,
// This flag limits the complexity of an expression.
- SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000,
+ SH_LIMIT_EXPRESSION_COMPLEXITY = 0x4000,
// This flag limits the depth of the call stack.
- SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
+ SH_LIMIT_CALL_STACK_DEPTH = 0x8000,
// This flag initializes gl_Position to vec4(0,0,0,0) at the
// beginning of the vertex shader's main(), and has no effect in the
// fragment shader. It is intended as a workaround for drivers which
// incorrectly fail to link programs if gl_Position is not written.
- SH_INIT_GL_POSITION = 0x8000,
+ SH_INIT_GL_POSITION = 0x10000,
// This flag replaces
// "a && b" with "a ? b : false",
// "a || b" with "a ? true : b".
// This is to work around a MacOSX driver bug that |b| is executed
// independent of |a|'s value.
- SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
+ SH_UNFOLD_SHORT_CIRCUIT = 0x20000,
// This flag initializes varyings without static use in vertex shader
// at the beginning of main(), and has no effects in the fragment shader.
// It is intended as a workaround for drivers which incorrectly optimize
// out such varyings and cause a link failure.
- SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
+ SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x40000,
} ShCompileOptions;
// Defines alternate strategies for implementing array index clamping.