wined3d: Trace improvements.
This commit is contained in:
parent
2c232990ee
commit
aec2e3e46d
|
@ -160,6 +160,25 @@ int shader_skip_unrecognized(
|
||||||
return tokens_read;
|
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
|
/* Note that this does not count the loop register
|
||||||
* as an address register. */
|
* as an address register. */
|
||||||
|
|
||||||
|
@ -330,21 +349,23 @@ static void shader_dump_arr_entry(
|
||||||
IWineD3DBaseShader *iface,
|
IWineD3DBaseShader *iface,
|
||||||
const DWORD param,
|
const DWORD param,
|
||||||
const DWORD addr_token,
|
const DWORD addr_token,
|
||||||
|
unsigned int reg,
|
||||||
int input) {
|
int input) {
|
||||||
|
|
||||||
DWORD reg = param & D3DSP_REGNUM_MASK;
|
|
||||||
char relative =
|
char relative =
|
||||||
((param & D3DSHADER_ADDRESSMODE_MASK) == D3DSHADER_ADDRMODE_RELATIVE);
|
((param & D3DSHADER_ADDRESSMODE_MASK) == D3DSHADER_ADDRMODE_RELATIVE);
|
||||||
|
|
||||||
TRACE("[");
|
|
||||||
if (relative) {
|
if (relative) {
|
||||||
|
TRACE("[");
|
||||||
if (addr_token)
|
if (addr_token)
|
||||||
shader_dump_param(iface, addr_token, 0, input);
|
shader_dump_param(iface, addr_token, 0, input);
|
||||||
else
|
else
|
||||||
TRACE("a0.x");
|
TRACE("a0.x");
|
||||||
TRACE(" + ");
|
TRACE(" + ");
|
||||||
}
|
}
|
||||||
TRACE("%lu]", reg);
|
TRACE("%u", reg);
|
||||||
|
if (relative)
|
||||||
|
TRACE("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void shader_dump_param(
|
void shader_dump_param(
|
||||||
|
@ -388,11 +409,15 @@ void shader_dump_param(
|
||||||
TRACE("r%lu", reg);
|
TRACE("r%lu", reg);
|
||||||
break;
|
break;
|
||||||
case D3DSPR_INPUT:
|
case D3DSPR_INPUT:
|
||||||
TRACE("v%lu", reg);
|
TRACE("v");
|
||||||
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
||||||
break;
|
break;
|
||||||
case D3DSPR_CONST:
|
case D3DSPR_CONST:
|
||||||
|
case D3DSPR_CONST2:
|
||||||
|
case D3DSPR_CONST3:
|
||||||
|
case D3DSPR_CONST4:
|
||||||
TRACE("c");
|
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;
|
break;
|
||||||
case D3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
|
case D3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
|
||||||
TRACE("%c%lu", (pshader? 't':'a'), reg);
|
TRACE("%c%lu", (pshader? 't':'a'), reg);
|
||||||
|
@ -416,18 +441,18 @@ void shader_dump_param(
|
||||||
|
|
||||||
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
|
if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
|
||||||
TRACE("o");
|
TRACE("o");
|
||||||
shader_dump_arr_entry(iface, param, addr_token, input);
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TRACE("oT%lu", reg);
|
TRACE("oT%lu", reg);
|
||||||
break;
|
break;
|
||||||
case D3DSPR_CONSTINT:
|
case D3DSPR_CONSTINT:
|
||||||
TRACE("i");
|
TRACE("i");
|
||||||
shader_dump_arr_entry(iface, param, addr_token, input);
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
||||||
break;
|
break;
|
||||||
case D3DSPR_CONSTBOOL:
|
case D3DSPR_CONSTBOOL:
|
||||||
TRACE("b");
|
TRACE("b");
|
||||||
shader_dump_arr_entry(iface, param, addr_token, input);
|
shader_dump_arr_entry(iface, param, addr_token, reg, input);
|
||||||
break;
|
break;
|
||||||
case D3DSPR_LABEL:
|
case D3DSPR_LABEL:
|
||||||
TRACE("l%lu", reg);
|
TRACE("l%lu", reg);
|
||||||
|
|
|
@ -1424,23 +1424,38 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
|
||||||
pToken += 2;
|
pToken += 2;
|
||||||
len += 2;
|
len += 2;
|
||||||
|
|
||||||
} else
|
} else if (curOpcode->opcode == D3DSIO_DEF) {
|
||||||
if (curOpcode->opcode == D3DSIO_DEF) {
|
|
||||||
TRACE("def c%lu = ", *pToken & 0xFF);
|
unsigned int offset = shader_get_float_offset(*pToken);
|
||||||
++pToken;
|
|
||||||
++len;
|
TRACE("def c%u = %f, %f, %f, %f", offset,
|
||||||
TRACE("%f ,", *(float *)pToken);
|
*(float *)(pToken + 1),
|
||||||
++pToken;
|
*(float *)(pToken + 2),
|
||||||
++len;
|
*(float *)(pToken + 3),
|
||||||
TRACE("%f ,", *(float *)pToken);
|
*(float *)(pToken + 4));
|
||||||
++pToken;
|
|
||||||
++len;
|
pToken += 5;
|
||||||
TRACE("%f ,", *(float *)pToken);
|
len += 5;
|
||||||
++pToken;
|
|
||||||
++len;
|
} else if (curOpcode->opcode == D3DSIO_DEFI) {
|
||||||
TRACE("%f", *(float *)pToken);
|
|
||||||
++pToken;
|
TRACE("defi i%lu = %ld, %ld, %ld, %ld", *pToken & D3DSP_REGNUM_MASK,
|
||||||
++len;
|
(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 {
|
} else {
|
||||||
|
|
||||||
DWORD param, addr_token;
|
DWORD param, addr_token;
|
||||||
|
|
|
@ -1571,23 +1571,38 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
|
||||||
pToken += 2;
|
pToken += 2;
|
||||||
len += 2;
|
len += 2;
|
||||||
|
|
||||||
} else
|
} else if (curOpcode->opcode == D3DSIO_DEF) {
|
||||||
if (curOpcode->opcode == D3DSIO_DEF) {
|
|
||||||
TRACE("def c%lu = ", *pToken & 0xFF);
|
unsigned int offset = shader_get_float_offset(*pToken);
|
||||||
++pToken;
|
|
||||||
++len;
|
TRACE("def c%u = %f, %f, %f, %f", offset,
|
||||||
TRACE("%f ,", *(float *)pToken);
|
*(float *)(pToken + 1),
|
||||||
++pToken;
|
*(float *)(pToken + 2),
|
||||||
++len;
|
*(float *)(pToken + 3),
|
||||||
TRACE("%f ,", *(float *)pToken);
|
*(float *)(pToken + 4));
|
||||||
++pToken;
|
|
||||||
++len;
|
pToken += 5;
|
||||||
TRACE("%f ,", *(float *)pToken);
|
len += 5;
|
||||||
++pToken;
|
|
||||||
++len;
|
} else if (curOpcode->opcode == D3DSIO_DEFI) {
|
||||||
TRACE("%f", *(float *)pToken);
|
|
||||||
++pToken;
|
TRACE("defi i%lu = %ld, %ld, %ld, %ld", *pToken & D3DSP_REGNUM_MASK,
|
||||||
++len;
|
(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 {
|
} else {
|
||||||
|
|
||||||
DWORD param, addr_token;
|
DWORD param, addr_token;
|
||||||
|
|
|
@ -1363,6 +1363,8 @@ inline static int shader_get_regtype(const DWORD param) {
|
||||||
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2));
|
((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) {
|
inline static BOOL shader_is_pshader_version(DWORD token) {
|
||||||
return 0xFFFF0000 == (token & 0xFFFF0000);
|
return 0xFFFF0000 == (token & 0xFFFF0000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue