Mesa (7.9): svga: Integer constant register file has a separate namespace.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Sep 20 08:31:33 UTC 2010


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

Author: Michal Krol <michal at vmware.com>
Date:   Thu Sep 16 16:51:03 2010 +0000

svga: Integer constant register file has a separate namespace.

Count int and float constants independently. Since there are only
few i# constants available and hundreds of c# constants, it would
be too easy to end up with an i# declaration out of its range.

---

 src/gallium/drivers/svga/svga_tgsi.c      |    2 +-
 src/gallium/drivers/svga/svga_tgsi_emit.h |    3 ++-
 src/gallium/drivers/svga/svga_tgsi_insn.c |   12 ++++++------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c
index 0cd6201..781fe63 100644
--- a/src/gallium/drivers/svga/svga_tgsi.c
+++ b/src/gallium/drivers/svga/svga_tgsi.c
@@ -203,7 +203,7 @@ svga_tgsi_translate( const struct svga_shader *shader,
       emit.imm_start += key.vkey.num_zero_stride_vertex_elements;
    }
 
-   emit.nr_hw_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1);
+   emit.nr_hw_float_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1);
 
    emit.nr_hw_temp = emit.info.file_max[TGSI_FILE_TEMPORARY] + 1;
    emit.in_main_func = TRUE;
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h
index b4e90a9..63ef7f8 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -62,7 +62,8 @@ struct svga_shader_emitter
 
    int imm_start;
 
-   int nr_hw_const;
+   int nr_hw_float_const;
+   int nr_hw_int_const;
    int nr_hw_temp;
    
    int insn_offset;
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index ad7d27a..f2591c5 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -553,7 +553,7 @@ static boolean emit_def_const( struct svga_shader_emitter *emit,
 static INLINE boolean
 create_zero_immediate( struct svga_shader_emitter *emit )
 {
-   unsigned idx = emit->nr_hw_const++;
+   unsigned idx = emit->nr_hw_float_const++;
 
    if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
                         idx, 0, 0, 0, 1 ))
@@ -568,7 +568,7 @@ create_zero_immediate( struct svga_shader_emitter *emit )
 static INLINE boolean
 create_loop_const( struct svga_shader_emitter *emit )
 {
-   unsigned idx = emit->nr_hw_const++;
+   unsigned idx = emit->nr_hw_int_const++;
 
    if (!emit_def_const( emit, SVGA3D_CONST_TYPE_INT, idx,
                         255, /* iteration count */
@@ -586,7 +586,7 @@ create_loop_const( struct svga_shader_emitter *emit )
 static INLINE boolean
 create_sincos_consts( struct svga_shader_emitter *emit )
 {
-   unsigned idx = emit->nr_hw_const++;
+   unsigned idx = emit->nr_hw_float_const++;
 
    if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
                         -1.5500992e-006f,
@@ -596,7 +596,7 @@ create_sincos_consts( struct svga_shader_emitter *emit )
       return FALSE;
 
    emit->sincos_consts_idx = idx;
-   idx = emit->nr_hw_const++;
+   idx = emit->nr_hw_float_const++;
 
    if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
                         -0.020833334f,
@@ -617,7 +617,7 @@ create_arl_consts( struct svga_shader_emitter *emit )
 
    for (i = 0; i < emit->num_arl_consts; i += 4) {
       int j;
-      unsigned idx = emit->nr_hw_const++;
+      unsigned idx = emit->nr_hw_float_const++;
       float vals[4];
       for (j = 0; j < 4 && (j + i) < emit->num_arl_consts; ++j) {
          vals[j] = emit->arl_consts[i + j].number;
@@ -2407,7 +2407,7 @@ static boolean make_immediate( struct svga_shader_emitter *emit,
                                float d,
                                struct src_register *out )
 {
-   unsigned idx = emit->nr_hw_const++;
+   unsigned idx = emit->nr_hw_float_const++;
 
    if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
                         idx, a, b, c, d ))




More information about the mesa-commit mailing list