[Mesa-dev] [PATCH] svga: fix PS output register setup regression

Brian Paul brianp at vmware.com
Thu Jan 23 09:59:29 PST 2014


Fixes glean fragProg1 regression caused by commit b9f68d927ea
(implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS).  This bug
only appears when the fragment shader emits fragment.Z before
color outputs.  The bug was caused by confusion between register
indexes and semantic indexes.

Also added some comments to better explain register indexing.
---
 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c |    5 +++--
 src/gallium/drivers/svga/svga_tgsi_emit.h      |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 137afd6..42d6f48 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -319,6 +319,7 @@ ps30_input(struct svga_shader_emitter *emit,
 /**
  * Process a PS output declaration.
  * Note that we don't actually emit a SVGA3DOpDcl for PS outputs.
+ * \idx  register index, such as OUT[2] (not semantic index)
  */
 static boolean
 ps30_output(struct svga_shader_emitter *emit,
@@ -344,9 +345,9 @@ ps30_output(struct svga_shader_emitter *emit,
             if (semantic.Index == 0) {
                unsigned i;
                for (i = 0; i < emit->key.fkey.write_color0_to_n_cbufs; i++) {
-                  emit->output_map[i] = dst_register(SVGA3DREG_TEMP,
+                  emit->output_map[idx+i] = dst_register(SVGA3DREG_TEMP,
                                                      emit->nr_hw_temp++);
-                  emit->temp_color_output[i] = emit->output_map[i];
+                  emit->temp_color_output[i] = emit->output_map[idx+i];
                   emit->true_color_output[i] = dst_register(SVGA3DREG_COLOROUT,
                                                             i);
                }
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h
index d31b866..53f93de 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -99,6 +99,7 @@ struct svga_shader_emitter
    unsigned label[32];
    unsigned nr_labels;
 
+   /** input/output register mappings, indexed by register number */
    struct src_register input_map[PIPE_MAX_ATTRIBS];
    SVGA3dShaderDestToken output_map[PIPE_MAX_ATTRIBS];
 
@@ -119,7 +120,7 @@ struct svga_shader_emitter
    /* shared output for depth and fog */
    SVGA3dShaderDestToken vs_depth_fog;
 
-   /* PS output colors */
+   /* PS output colors (indexed by color semantic index) */
    SVGA3dShaderDestToken temp_color_output[PIPE_MAX_COLOR_BUFS];
    SVGA3dShaderDestToken true_color_output[PIPE_MAX_COLOR_BUFS];
 
-- 
1.7.10.4



More information about the mesa-dev mailing list