summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-07-27 15:20:43 +1000
committerTimothy Arceri <timothy.arceri@collabora.com>2016-08-11 08:33:21 +1000
commit82e153daff954a9bf09c8fb7e1adfeedb17a1fc3 (patch)
tree8db5a66679c3da869badc13c7bf0a0793f89c738 /src/compiler/glsl/linker.cpp
parent588702cc41122607c8bf8a589b0714546bac190c (diff)
downloadexternal_mesa3d-82e153daff954a9bf09c8fb7e1adfeedb17a1fc3.zip
external_mesa3d-82e153daff954a9bf09c8fb7e1adfeedb17a1fc3.tar.gz
external_mesa3d-82e153daff954a9bf09c8fb7e1adfeedb17a1fc3.tar.bz2
glsl: remove dead builtins before assigning varying locations
Builtins already have locations assigned so this shouldn't change anything. We want to call it earlier so we can tranform GLSL IR to NIR earlier. Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 569a8b9..7a3d35f 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4589,8 +4589,12 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
/* If the program is made up of only a single stage */
if (first == last) {
-
gl_linked_shader *const sh = prog->_LinkedShaders[last];
+
+ do_dead_builtin_varyings(ctx, NULL, sh, 0, NULL);
+ do_dead_builtin_varyings(ctx, sh, NULL, num_tfeedback_decls,
+ tfeedback_decls);
+
if (prog->SeparateShader) {
const uint64_t reserved_slots =
reserved_varying_slot(sh, ir_var_shader_in);
@@ -4606,10 +4610,6 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
reserved_slots))
return false;
}
-
- do_dead_builtin_varyings(ctx, NULL, sh, 0, NULL);
- do_dead_builtin_varyings(ctx, sh, NULL, num_tfeedback_decls,
- tfeedback_decls);
} else {
/* Linking the stages in the opposite order (from fragment to vertex)
* ensures that inter-shader outputs written to in an earlier stage
@@ -4629,16 +4629,16 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
const uint64_t reserved_in_slots =
reserved_varying_slot(sh_next, ir_var_shader_in);
+ do_dead_builtin_varyings(ctx, sh_i, sh_next,
+ next == MESA_SHADER_FRAGMENT ? num_tfeedback_decls : 0,
+ tfeedback_decls);
+
if (!assign_varying_locations(ctx, mem_ctx, prog, sh_i, sh_next,
next == MESA_SHADER_FRAGMENT ? num_tfeedback_decls : 0,
tfeedback_decls,
reserved_out_slots | reserved_in_slots))
return false;
- do_dead_builtin_varyings(ctx, sh_i, sh_next,
- next == MESA_SHADER_FRAGMENT ? num_tfeedback_decls : 0,
- tfeedback_decls);
-
/* This must be done after all dead varyings are eliminated. */
if (sh_i != NULL) {
unsigned slots_used = _mesa_bitcount_64(reserved_out_slots);