summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-05-04 13:08:46 -0700
committerEric Anholt <[email protected]>2012-05-14 17:03:51 -0700
commit3de1395fa5a563c13774ac1c38722c16cecc521d (patch)
treeb501f3cc408f359d9681ca349f0f06f9bfcd3620 /src/glsl/linker.cpp
parente21b9f1f19d2345026a7fbe095a776d0b64557ec (diff)
glsl: Implement the GLSL 1.30+ discard control flow rule in GLSL IR.
Previously, I tried implementing this in the i965 driver, but did so in a way that violated the intent of the spec, and broke Tropics. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 6ba297237c7..bdab499f046 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2296,6 +2296,17 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
prog->LinkStatus = true;
}
+ /* Implement the GLSL 1.30+ rule for discard vs infinite loops Do
+ * it before optimization because we want most of the checks to get
+ * dropped thanks to constant propagation.
+ */
+ if (max_version >= 130) {
+ struct gl_shader *sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
+ if (sh) {
+ lower_discard_flow(sh->ir);
+ }
+ }
+
/* Do common optimization before assigning storage for attributes,
* uniforms, and varyings. Later optimization could possibly make
* some of that unused.