OSDN Git Service

r300-gallium: Properly interface with Draw for vert shaders.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 5 Apr 2009 08:00:25 +0000 (01:00 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 5 Apr 2009 08:00:25 +0000 (01:00 -0700)
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_debug.h
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_tcl.c

index 9d2a07a..fec2bad 100644 (file)
@@ -236,6 +236,9 @@ struct r300_vertex_shader {
     struct pipe_shader_state state;
     struct tgsi_shader_info info;
 
+    /* Fallback shader, because Draw has issues */
+    struct draw_vertex_shader* draw;
+
     /* Has this shader been translated yet? */
     boolean translated;
 
index 8d44756..dd63136 100644 (file)
@@ -224,3 +224,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
         }
     }
 }
+
+void r300_vs_dump(struct r300_vertex_shader* vs)
+{
+    int i;
+
+    for (i = 0; i < vs->instruction_count; i++) {
+        debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0);
+        debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1);
+        debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2);
+        debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3);
+    }
+}
index de5d701..a1f8736 100644 (file)
 
 #include "r300_reg.h"
 #include "r300_state_shader.h"
+#include "r300_state_tcl.h"
 
 void r500_fs_dump(struct r500_fragment_shader* fs);
 
+void r300_vs_dump(struct r300_vertex_shader* vs);
+
 #endif /* R300_DEBUG_H */
index 4dee4ab..5b3bb32 100644 (file)
@@ -403,6 +403,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 
     rs->rs = *state;
 
+    /* If using HW TCL, tell Draw to not do its magic. */
+    if (r300_screen(pipe->screen)->caps->has_tcl) {
+        rs->rs.bypass_vs_clip_and_viewport = TRUE;
+    }
+
     return (void*)rs;
 }
 
@@ -604,6 +609,9 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
 
         tgsi_scan_shader(shader->tokens, &vs->info);
 
+        /* Appease Draw. */
+        vs->draw = draw_create_vertex_shader(r300->draw, shader);
+
         return (void*)vs;
     } else {
         return draw_create_vertex_shader(r300->draw, shader);
@@ -624,6 +632,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
             r300_translate_vertex_shader(r300, vs);
         }
 
+        draw_bind_vertex_shader(r300->draw, vs->draw);
         r300->vs = vs;
         r300->dirty_state |= R300_NEW_VERTEX_SHADER;
     } else {
@@ -637,6 +646,9 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
     struct r300_context* r300 = r300_context(pipe);
 
     if (r300_screen(pipe->screen)->caps->has_tcl) {
+        struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
+
+        draw_delete_vertex_shader(r300->draw, vs->draw);
         FREE(shader);
     } else {
         draw_delete_vertex_shader(r300->draw,
index f01db2d..d0dc4ef 100644 (file)
@@ -267,6 +267,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
 
     tgsi_dump(vs->state.tokens);
     /* XXX finish r300 vertex shader dumper */
+    r300_vs_dump(vs);
 
     tgsi_parse_free(&parser);
     FREE(assembler);