[Mesa-dev] [PATCH 1/5] st/mesa: also emit labels for TGSI_OPCODE_BGNSUB

Brian Paul brianp at vmware.com
Tue Apr 14 09:56:24 PDT 2015


Subroutines need labels so they can be identied by CAL instructions.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 67a4da7..eb0ce07 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4771,18 +4771,25 @@ compile_tgsi_instruction(struct st_translate *t,
    }
 
    switch(inst->op) {
+   case TGSI_OPCODE_BGNSUB:
    case TGSI_OPCODE_BGNLOOP:
    case TGSI_OPCODE_CAL:
    case TGSI_OPCODE_ELSE:
    case TGSI_OPCODE_ENDLOOP:
    case TGSI_OPCODE_IF:
    case TGSI_OPCODE_UIF:
-      assert(num_dst == 0);
-      ureg_label_insn(ureg,
-                      inst->op,
-                      src, num_src,
-                      get_label(t,
-                                inst->op == TGSI_OPCODE_CAL ? inst->function->sig_id : 0));
+      {
+         int sig_id = 0;
+         if (inst->op == TGSI_OPCODE_CAL ||
+             inst->op == TGSI_OPCODE_BGNSUB) {
+            sig_id = inst->function->sig_id;
+         }
+         assert(num_dst == 0);
+         ureg_label_insn(ureg,
+                         inst->op,
+                         src, num_src,
+                         get_label(t, sig_id));
+      }
       return;
 
    case TGSI_OPCODE_TEX:
-- 
1.9.1



More information about the mesa-dev mailing list