Commit aec2e3e4 authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Trace improvements.

parent 2c232990
......@@ -160,6 +160,25 @@ int shader_skip_unrecognized(
return tokens_read;
}
/* Convert floating point offset relative
* to a register file to an absolute offset for float constants */
unsigned int shader_get_float_offset(const DWORD reg) {
unsigned int regnum = reg & D3DSP_REGNUM_MASK;
int regtype = shader_get_regtype(reg);
switch (regtype) {
case D3DSPR_CONST: return regnum;
case D3DSPR_CONST2: return 2048 + regnum;
case D3DSPR_CONST3: return 4096 + regnum;
case D3DSPR_CONST4: return 6144 + regnum;
default:
FIXME("Unsupported register type: %d\n", regtype);
return regnum;
}
}
/* Note that this does not count the loop register
* as an address register. */
......@@ -330,21 +349,23 @@ static void shader_dump_arr_entry(
IWineD3DBaseShader *iface,
const DWORD param,
const DWORD addr_token,
unsigned int reg,
int input) {
DWORD reg = param & D3DSP_REGNUM_MASK;
char relative =
((param & D3DSHADER_ADDRESSMODE_MASK) == D3DSHADER_ADDRMODE_RELATIVE);
TRACE("[");
if (relative) {
TRACE("[");
if (addr_token)
shader_dump_param(iface, addr_token, 0, input);
else
TRACE("a0.x");
TRACE(" + ");
}
TRACE("%lu]", reg);
TRACE("%u", reg);
if (relative)
TRACE("]");
}
void shader_dump_param(
......@@ -388,11 +409,15 @@ void shader_dump_param(
TRACE("r%lu", reg);
break;
case D3DSPR_INPUT:
TRACE("v%lu", reg);
TRACE("v");
shader_dump_arr_entry(iface, param, addr_token, reg, input);
break;
case D3DSPR_CONST:
case D3DSPR_CONST2:
case D3DSPR_CONST3:
case D3DSPR_CONST4:
TRACE("c");
shader_dump_arr_entry(iface, param, addr_token, input);
shader_dump_arr_entry(iface, param, addr_token, shader_get_float_offset(param), input);
break;
case D3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
TRACE("%c%lu", (pshader? 't':'a'), reg);
......@@ -416,18 +441,18 @@ void shader_dump_param(
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
TRACE("o");
shader_dump_arr_entry(iface, param, addr_token, input);
shader_dump_arr_entry(iface, param, addr_token, reg, input);
}
else
TRACE("oT%lu", reg);
break;
case D3DSPR_CONSTINT:
TRACE("i");
shader_dump_arr_entry(iface, param, addr_token, input);
shader_dump_arr_entry(iface, param, addr_token, reg, input);
break;
case D3DSPR_CONSTBOOL:
TRACE("b");
shader_dump_arr_entry(iface, param, addr_token, input);
shader_dump_arr_entry(iface, param, addr_token, reg, input);
break;
case D3DSPR_LABEL:
TRACE("l%lu", reg);
......
......@@ -1424,23 +1424,38 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
pToken += 2;
len += 2;
} else
if (curOpcode->opcode == D3DSIO_DEF) {
TRACE("def c%lu = ", *pToken & 0xFF);
++pToken;
++len;
TRACE("%f ,", *(float *)pToken);
++pToken;
++len;
TRACE("%f ,", *(float *)pToken);
++pToken;
++len;
TRACE("%f ,", *(float *)pToken);
++pToken;
++len;
TRACE("%f", *(float *)pToken);
++pToken;
++len;
} else if (curOpcode->opcode == D3DSIO_DEF) {
unsigned int offset = shader_get_float_offset(*pToken);
TRACE("def c%u = %f, %f, %f, %f", offset,
*(float *)(pToken + 1),
*(float *)(pToken + 2),
*(float *)(pToken + 3),
*(float *)(pToken + 4));
pToken += 5;
len += 5;
} else if (curOpcode->opcode == D3DSIO_DEFI) {
TRACE("defi i%lu = %ld, %ld, %ld, %ld", *pToken & D3DSP_REGNUM_MASK,
(long) *(pToken + 1),
(long) *(pToken + 2),
(long) *(pToken + 3),
(long) *(pToken + 4));
pToken += 5;
len += 5;
} else if (curOpcode->opcode == D3DSIO_DEFB) {
TRACE("defb b%lu = %s", *pToken & D3DSP_REGNUM_MASK,
*(pToken + 1)? "true": "false");
pToken += 2;
len += 2;
} else {
DWORD param, addr_token;
......
......@@ -1571,23 +1571,38 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
pToken += 2;
len += 2;
} else
if (curOpcode->opcode == D3DSIO_DEF) {
TRACE("def c%lu = ", *pToken & 0xFF);
++pToken;
++len;
TRACE("%f ,", *(float *)pToken);
++pToken;
++len;
TRACE("%f ,", *(float *)pToken);
++pToken;
++len;
TRACE("%f ,", *(float *)pToken);
++pToken;
++len;
TRACE("%f", *(float *)pToken);
++pToken;
++len;
} else if (curOpcode->opcode == D3DSIO_DEF) {
unsigned int offset = shader_get_float_offset(*pToken);
TRACE("def c%u = %f, %f, %f, %f", offset,
*(float *)(pToken + 1),
*(float *)(pToken + 2),
*(float *)(pToken + 3),
*(float *)(pToken + 4));
pToken += 5;
len += 5;
} else if (curOpcode->opcode == D3DSIO_DEFI) {
TRACE("defi i%lu = %ld, %ld, %ld, %ld", *pToken & D3DSP_REGNUM_MASK,
(long) *(pToken + 1),
(long) *(pToken + 2),
(long) *(pToken + 3),
(long) *(pToken + 4));
pToken += 5;
len += 5;
} else if (curOpcode->opcode == D3DSIO_DEFB) {
TRACE("defb b%lu = %s", *pToken & D3DSP_REGNUM_MASK,
*(pToken + 1)? "true": "false");
pToken += 2;
len += 2;
} else {
DWORD param, addr_token;
......
......@@ -1363,6 +1363,8 @@ inline static int shader_get_regtype(const DWORD param) {
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2));
}
extern unsigned int shader_get_float_offset(const DWORD reg);
inline static BOOL shader_is_pshader_version(DWORD token) {
return 0xFFFF0000 == (token & 0xFFFF0000);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment