wined3d: Explicitly pass the register type and index to shader_get_float_offset().

This commit is contained in:
Henri Verbeet 2009-04-30 11:02:19 +02:00 committed by Alexandre Julliard
parent 3fc27f67f3
commit 18df05eb34
1 changed files with 14 additions and 14 deletions

View File

@ -453,19 +453,17 @@ static inline BOOL shader_is_comment(DWORD token)
/* Convert floating point offset relative /* Convert floating point offset relative
* to a register file to an absolute offset for float constants */ * to a register file to an absolute offset for float constants */
static unsigned int shader_get_float_offset(const DWORD reg) static unsigned int shader_get_float_offset(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx)
{ {
unsigned int regnum = reg & WINED3DSP_REGNUM_MASK; switch (register_type)
int regtype = shader_get_regtype(reg); {
case WINED3DSPR_CONST: return register_idx;
switch (regtype) { case WINED3DSPR_CONST2: return 2048 + register_idx;
case WINED3DSPR_CONST: return regnum; case WINED3DSPR_CONST3: return 4096 + register_idx;
case WINED3DSPR_CONST2: return 2048 + regnum; case WINED3DSPR_CONST4: return 6144 + register_idx;
case WINED3DSPR_CONST3: return 4096 + regnum;
case WINED3DSPR_CONST4: return 6144 + regnum;
default: default:
FIXME("Unsupported register type: %d\n", regtype); FIXME("Unsupported register type: %d\n", register_type);
return regnum; return register_idx;
} }
} }
@ -962,7 +960,8 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, BOOL is
case WINED3DSPR_CONST3: case WINED3DSPR_CONST3:
case WINED3DSPR_CONST4: case WINED3DSPR_CONST4:
TRACE("c"); TRACE("c");
shader_dump_arr_entry(param, addr_token, shader_get_float_offset(param), shader_version); shader_dump_arr_entry(param, addr_token, shader_get_float_offset(shader_get_regtype(param),
param & WINED3DSP_REGNUM_MASK), shader_version);
break; break;
case WINED3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */ case WINED3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
TRACE("%c%u", (pshader? 't':'a'), reg); TRACE("%c%u", (pshader? 't':'a'), reg);
@ -1268,7 +1267,8 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table
} }
else if (ins.handler_idx == WINED3DSIH_DEF) else if (ins.handler_idx == WINED3DSIH_DEF)
{ {
unsigned int offset = shader_get_float_offset(*pToken); unsigned int offset = shader_get_float_offset(shader_get_regtype(*pToken),
*pToken & WINED3DSP_REGNUM_MASK);
TRACE("def c%u = %f, %f, %f, %f", offset, TRACE("def c%u = %f, %f, %f, %f", offset,
*(const float *)(pToken + 1), *(const float *)(pToken + 1),