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.
This commit is contained in:
Michal Krol 2010-09-16 16:51:03 +00:00 committed by José Fonseca
parent 202c1279c6
commit d36344f900
3 changed files with 9 additions and 8 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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 ))