wined3d: Modify shader_dump_param() to take into account address token.

Currently we hardcode a0.x, which I think is correct for shaders 1.0.
However, for shaders 2.0, we must look into the address token, and
print the register there. Handle both cases to correct the trace.
This commit is contained in:
Ivan Gyurdiev 2006-05-17 02:05:49 -04:00 committed by Alexandre Julliard
parent 03b67e3030
commit 746d1b1cd3
4 changed files with 38 additions and 11 deletions

View File

@ -146,7 +146,7 @@ int shader_skip_unrecognized(
FIXME("Unrecognized opcode param: token=%08lX "
"addr_token=%08lX name=", param, addr_token);
shader_dump_param(iface, param, i);
shader_dump_param(iface, param, addr_token, i);
FIXME("\n");
++i;
}
@ -306,9 +306,31 @@ void shader_program_dump_decl_usage(
}
}
static void shader_dump_arr_entry(
IWineD3DBaseShader *iface,
const DWORD param,
const DWORD addr_token,
int input) {
DWORD reg = param & D3DSP_REGNUM_MASK;
char relative =
((param & D3DSHADER_ADDRESSMODE_MASK) == D3DSHADER_ADDRMODE_RELATIVE);
TRACE("[");
if (relative) {
if (addr_token)
shader_dump_param(iface, addr_token, 0, input);
else
TRACE("a0.x");
TRACE(" + ");
}
TRACE("%lu]", reg);
}
void shader_dump_param(
IWineD3DBaseShader *iface,
const DWORD param,
const DWORD addr_token,
int input) {
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
@ -347,7 +369,8 @@ void shader_dump_param(
TRACE("v%lu", reg);
break;
case D3DSPR_CONST:
TRACE("c%s%lu", (param & D3DVS_ADDRMODE_RELATIVE) ? "a0.x + " : "", reg);
TRACE("c");
shader_dump_arr_entry(iface, param, addr_token, input);
break;
case D3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
TRACE("%c%lu", (pshader? 't':'a'), reg);
@ -368,16 +391,19 @@ void shader_dump_param(
TRACE("oT%lu", reg);
break;
case D3DSPR_CONSTINT:
TRACE("i%s%lu", (param & D3DVS_ADDRMODE_RELATIVE) ? "a0.x + " : "", reg);
TRACE("i");
shader_dump_arr_entry(iface, param, addr_token, input);
break;
case D3DSPR_CONSTBOOL:
TRACE("b%s%lu", (param & D3DVS_ADDRMODE_RELATIVE) ? "a0.x + " : "", reg);
TRACE("b");
shader_dump_arr_entry(iface, param, addr_token, input);
break;
case D3DSPR_LABEL:
TRACE("l%lu", reg);
break;
case D3DSPR_LOOP:
TRACE("aL%s%lu", (param & D3DVS_ADDRMODE_RELATIVE) ? "a0.x + " : "", reg);
TRACE("aL");
shader_dump_arr_entry(iface, param, addr_token, input);
break;
case D3DSPR_SAMPLER:
TRACE("s%lu", reg);

View File

@ -1427,7 +1427,7 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
shader_dump_ins_modifiers(param);
TRACE(" ");
shader_dump_param((IWineD3DBaseShader*) This, param, 0);
shader_dump_param((IWineD3DBaseShader*) This, param, 0, 0);
pToken += 2;
len += 2;
@ -1463,7 +1463,7 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
shader_dump_ins_modifiers(param);
TRACE(" ");
shader_dump_param((IWineD3DBaseShader*) This, param, 0);
shader_dump_param((IWineD3DBaseShader*) This, param, addr_token, 0);
for (i = 1; i < curOpcode->num_params; ++i) {
@ -1473,7 +1473,7 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
len += tokens_read;
TRACE(", ");
shader_dump_param((IWineD3DBaseShader*) This, param, 1);
shader_dump_param((IWineD3DBaseShader*) This, param, addr_token, 1);
}
}
}

View File

@ -1549,7 +1549,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
shader_program_dump_decl_usage(usage, param);
shader_dump_ins_modifiers(param);
TRACE(" ");
shader_dump_param((IWineD3DBaseShader*) This, param, 0);
shader_dump_param((IWineD3DBaseShader*) This, param, 0, 0);
pToken += 2;
len += 2;
@ -1585,7 +1585,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
shader_dump_ins_modifiers(param);
TRACE(" ");
shader_dump_param((IWineD3DBaseShader*) This, param, 0);
shader_dump_param((IWineD3DBaseShader*) This, param, addr_token, 0);
for (i = 1; i < curOpcode->num_params; ++i) {
@ -1595,7 +1595,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
len += tokens_read;
TRACE(", ");
shader_dump_param((IWineD3DBaseShader*) This, param, 1);
shader_dump_param((IWineD3DBaseShader*) This, param, addr_token, 1);
}
}
}

View File

@ -1372,6 +1372,7 @@ extern void shader_dump_ins_modifiers(
extern void shader_dump_param(
IWineD3DBaseShader *iface,
const DWORD param,
const DWORD addr_token,
int input);
extern int shader_get_param(