r300-gallium: vs: Dupe tokens, better debug, count spurious insts.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 17 May 2009 16:39:06 +0000 (09:39 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 17 May 2009 16:39:06 +0000 (09:39 -0700)
src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_tcl.c

index 1ff72172ebd31eb5bd48b478df78d62849c010bd..ffc93eb591591a830d2c611cea8ccd93a7dd2996 100644 (file)
@@ -152,10 +152,12 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
 
 static void r300_vs_op_dump(uint32_t op)
 {
-    if (op & 0x81) {
-        debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n");
-    } else if (op & 0x80) {
-        debug_printf("   PVS_MACRO_OP_2CLK_MADD\n");
+    if (op & 0x80) {
+        if (op & 0x1) {
+            debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n");
+        } else {
+            debug_printf("   PVS_MACRO_OP_2CLK_MADD\n");
+        }
     } else if (op & 0x40) {
         debug_printf("%s\n", r300_vs_me_ops[op & 0x1f]);
     } else {
index 49b93a420b14ccd7f7c277030f64d466bbca49e5..0ae118dbb9d1b12dc5c21d40f86fe385e8e04971 100644 (file)
@@ -634,6 +634,7 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
         struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
         /* Copy state directly into shader. */
         vs->state = *shader;
+        vs->state.tokens = tgsi_dup_tokens(shader->tokens);
 
         tgsi_scan_shader(shader->tokens, &vs->info);
 
@@ -679,6 +680,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
         struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
 
         draw_delete_vertex_shader(r300->draw, vs->draw);
+        FREE(vs->state.tokens);
         FREE(shader);
     } else {
         draw_delete_vertex_shader(r300->draw,
index ed9164db496db4a6758bd77540b267dd45ea67db..8b7a2ec5e9c4fc1be2bc37a2d842eaf4b31c3b91 100644 (file)
@@ -334,6 +334,8 @@ void r300_translate_vertex_shader(struct r300_context* r300,
     int i;
     struct r300_constant_buffer* consts =
         &r300->shader_constants[PIPE_SHADER_VERTEX];
+    boolean end = FALSE;
+    int spurious = 0;
 
     struct r300_vs_asm* assembler = CALLOC_STRUCT(r300_vs_asm);
     if (assembler == NULL) {
@@ -373,8 +375,16 @@ void r300_translate_vertex_shader(struct r300_context* r300,
                 assembler->imm_count++;
                 break;
             case TGSI_TOKEN_TYPE_INSTRUCTION:
-                r300_vs_instruction(vs, assembler,
-                        &parser.FullToken.FullInstruction);
+                if (parser.FullToken.FullInstruction.Instruction.Opcode ==
+                        TGSI_OPCODE_END) {
+                    end = TRUE;
+                }
+                if (end) {
+                    spurious++;
+                } else {
+                    r300_vs_instruction(vs, assembler,
+                            &parser.FullToken.FullInstruction);
+                }
                 break;
         }
     }
@@ -391,6 +401,9 @@ void r300_translate_vertex_shader(struct r300_context* r300,
     debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0],
             assembler->tab[1], assembler->tab[2], assembler->tab[3]);
 
+    debug_printf("r300: vs: %d spurious instructions following END\n",
+            spurious - 1);
+
     tgsi_dump(vs->state.tokens);
     /* XXX finish r300 vertex shader dumper */
     r300_vs_dump(vs);