summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/lower_subroutine.cpp
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-05-17 14:44:47 +1000
committerDave Airlie <[email protected]>2016-05-23 16:19:57 +1000
commit6f2dc0d04498a1d03f02a4b72480e8b409981432 (patch)
tree339b4212c25e8e523318fecb423af168056b38ff /src/compiler/glsl/lower_subroutine.cpp
parent5fe912831cac6722f2cf8add010c553a43e178b4 (diff)
subroutines: handle explicit indexes properly
The code didn't deal with explicit function indexes properly. It also handed out the indexes at link time, when we really need them in the lowering pass to create the correct if ladder. So this patch moves assigning the non-explicit indexes earlier, fixes the lowering pass and the lookups to get the correct values. This fixes a few of: GL45-CTS.explicit_uniform_location.subroutine-index-* Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl/lower_subroutine.cpp')
-rw-r--r--src/compiler/glsl/lower_subroutine.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/glsl/lower_subroutine.cpp b/src/compiler/glsl/lower_subroutine.cpp
index e80c1be768a..de178a59b07 100644
--- a/src/compiler/glsl/lower_subroutine.cpp
+++ b/src/compiler/glsl/lower_subroutine.cpp
@@ -87,8 +87,9 @@ lower_subroutine_visitor::visit_leave(ir_call *ir)
for (int s = this->state->num_subroutines - 1; s >= 0; s--) {
ir_rvalue *var;
- ir_constant *lc = new(mem_ctx)ir_constant(s);
ir_function *fn = this->state->subroutines[s];
+ ir_constant *lc = new(mem_ctx)ir_constant(fn->subroutine_index);
+
bool is_compat = false;
for (int i = 0; i < fn->num_subroutine_types; i++) {