Mesa (master): r300-gallium: Add vertex shader for surface_copy.

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Apr 1 23:06:19 UTC 2009


Module: Mesa
Branch: master
Commit: c4fb791909e687d5af5b95d88ebd6332c82c3095
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4fb791909e687d5af5b95d88ebd6332c82c3095

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Wed Apr  1 15:14:19 2009 -0700

r300-gallium: Add vertex shader for surface_copy.

---

 src/gallium/drivers/r300/r300_state_tcl.h |   13 ++++++++++
 src/gallium/drivers/r300/r300_surface.c   |   35 +++++++++++++++++++---------
 2 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h
index bc22cd9..06767c9 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.h
+++ b/src/gallium/drivers/r300/r300_state_tcl.h
@@ -79,6 +79,19 @@ static struct r300_vertex_shader r300_passthrough_vertex_shader = {
     .instructions[1].inst3 = 0x0,
 };
 
+static struct r300_vertex_shader r300_texture_vertex_shader = {
+        /* XXX translate these back into normal instructions */
+    .instruction_count = 2,
+    .instructions[0].inst0 = 0xF00203,
+    .instructions[0].inst1 = 0xD10001,
+    .instructions[0].inst2 = 0x1248001,
+    .instructions[0].inst3 = 0x0,
+    .instructions[1].inst0 = 0xF00203,
+    .instructions[1].inst1 = 0xD10061,
+    .instructions[1].inst2 = 0x1248061,
+    .instructions[1].inst3 = 0x0,
+};
+
 void r300_translate_vertex_shader(struct r300_context* r300,
                                   struct r300_vertex_shader* vs);
 
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index 8cafe7d..ab0ecac 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -39,17 +39,6 @@ static void r300_surface_setup(struct pipe_context* pipe,
     r300_emit_dsa_state(r300, &dsa_clear_state);
     r300_emit_rs_state(r300, &rs_clear_state);
 
-    /* XXX these magic numbers should be explained when
-     * this becomes a cached state object */
-    if (caps->has_tcl) {
-        r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader);
-    } else {
-        OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
-                R300_PVS_NUM_CNTLRS(5) |
-                R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
-                R300_PVS_VF_MAX_VTX_NUM(12));
-    }
-
     BEGIN_CS(15);
 
     /* Pixel scissors. */
@@ -116,6 +105,18 @@ static void r300_surface_fill(struct pipe_context* pipe,
 
     r300_surface_setup(r300, dest, x, y, w, h);
 
+    /* Vertex shader setup */
+    if (caps->has_tcl) {
+        r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader);
+    } else {
+        BEGIN_CS(2);
+        OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
+                R300_PVS_NUM_CNTLRS(5) |
+                R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
+                R300_PVS_VF_MAX_VTX_NUM(12));
+        END_CS;
+    }
+
     /* Fragment shader setup */
     if (caps->is_r500) {
         r500_emit_fragment_shader(r300, &r500_passthrough_fragment_shader);
@@ -222,6 +223,18 @@ static void r300_surface_copy(struct pipe_context* pipe,
     r300_emit_texture(r300, srctex, 0);
     r300_flush_textures(r300);
 
+    /* Vertex shader setup */
+    if (caps->has_tcl) {
+        r300_emit_vertex_shader(r300, &r300_texture_vertex_shader);
+    } else {
+        BEGIN_CS(2);
+        OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
+                R300_PVS_NUM_CNTLRS(5) |
+                R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
+                R300_PVS_VF_MAX_VTX_NUM(12));
+        END_CS;
+    }
+
     /* Fragment shader setup */
     if (caps->is_r500) {
         r500_emit_fragment_shader(r300, &r500_texture_fragment_shader);




More information about the mesa-commit mailing list