r600g: fix routing btw vertex & pixel shader
authorJerome Glisse <jglisse@redhat.com>
Mon, 27 Sep 2010 19:13:14 +0000 (15:13 -0400)
committerJerome Glisse <jglisse@redhat.com>
Mon, 27 Sep 2010 19:13:14 +0000 (15:13 -0400)
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state2.c

index 1553088aa2130035bd8e47a7d5effc2519f44de5..71c4a4b9d85a03b7102cf044ff572c8574eb42d2 100644 (file)
@@ -1513,7 +1513,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
        rstate->nregs = 0;
 
        for (i = 0; i < rshader->ninput; i++) {
-               tmp = S_028644_SEMANTIC(i);
+               tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i));
                tmp |= S_028644_SEL_CENTROID(1);
                if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
                        have_pos = TRUE;
index 4ca83a42d77f2ac7b55a29dc108d2b596668218a..5abf910c81c754792d232906471e41a40761caa8 100644 (file)
@@ -149,6 +149,8 @@ void r600_translate_index_buffer2(struct r600_pipe_context *r600,
                                        struct pipe_resource **index_buffer,
                                        unsigned *index_size,
                                        unsigned *start, unsigned count);
+int r600_find_vs_semantic_index2(struct r600_shader *vs,
+                               struct r600_shader *ps, int id);
 
 /* evergreen_state.c */
 void evergreen_init_state_functions2(struct r600_pipe_context *rctx);
index 06a6f0d80cc950ee133c00115be58cee1282738f..a88426fc9a47df8e386c50134048eff363fa2132 100644 (file)
@@ -104,6 +104,20 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade
                        0x00000000, 0xFFFFFFFF, shader->bo);
 }
 
+int r600_find_vs_semantic_index2(struct r600_shader *vs,
+                               struct r600_shader *ps, int id)
+{
+       struct r600_shader_io *input = &ps->input[id];
+
+       for (int i = 0; i < vs->noutput; i++) {
+               if (input->name == vs->output[i].name &&
+                       input->sid == vs->output[i].sid) {
+                       return i - 1;
+               }
+       }
+       return 0;
+}
+
 static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
@@ -116,7 +130,7 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade
        rstate->nregs = 0;
 
        for (i = 0; i < rshader->ninput; i++) {
-               tmp = S_028644_SEMANTIC(i);
+               tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i));
                tmp |= S_028644_SEL_CENTROID(1);
                if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
                        have_pos = TRUE;