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

wined3d: Share shader_dump_ins_modifiers().

Share shader_dump_ins_modifiers(), and make vertex shaders use it. The saturate modifer (_sat) is valid on vs_3_0+, and it isn't being shown in the trace.
parent d1b838e9
......@@ -395,4 +395,29 @@ void generate_base_shader(
}
void shader_dump_ins_modifiers(const DWORD output) {
DWORD shift = (output & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
DWORD mmask = output & D3DSP_DSTMOD_MASK;
switch (shift) {
case 0: break;
case 13: TRACE("_d8"); break;
case 14: TRACE("_d4"); break;
case 15: TRACE("_d2"); break;
case 1: TRACE("_x2"); break;
case 2: TRACE("_x4"); break;
case 3: TRACE("_x8"); break;
default: TRACE("_unhandled_shift(%ld)", shift); break;
}
switch(mmask) {
case D3DSPDM_NONE: break;
case D3DSPDM_SATURATE: TRACE("_sat"); break;
case D3DSPDM_PARTIALPRECISION: TRACE("_pp"); break;
case D3DSPDM_MSAMPCENTROID: TRACE("_centroid"); break;
default: TRACE("_unhandled_modifier(%#lx)", mmask); break;
}
}
/* TODO: Move other shared code here */
......@@ -1370,31 +1370,6 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader(
#endif
}
inline static void pshader_program_dump_ins_modifiers(const DWORD output) {
DWORD shift = (output & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
DWORD mmask = output & D3DSP_DSTMOD_MASK;
switch (shift) {
case 0: break;
case 13: TRACE("_d8"); break;
case 14: TRACE("_d4"); break;
case 15: TRACE("_d2"); break;
case 1: TRACE("_x2"); break;
case 2: TRACE("_x4"); break;
case 3: TRACE("_x8"); break;
default: TRACE("_unhandled_shift(%ld)", shift); break;
}
switch(mmask) {
case D3DSPDM_NONE: break;
case D3DSPDM_SATURATE: TRACE("_sat"); break;
case D3DSPDM_PARTIALPRECISION: TRACE("_pp"); break;
case D3DSPDM_MSAMPCENTROID: TRACE("_centroid"); break;
default: TRACE("_unhandled_modifier(%#lx)", mmask); break;
}
}
inline static void pshader_program_dump_ps_param(const DWORD param, int input) {
static const char* rastout_reg_names[] = { "oC0", "oC1", "oC2", "oC3", "oDepth" };
static const char swizzle_reg_chars[] = "rgba";
......@@ -1568,7 +1543,7 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
else
TRACE("dcl");
pshader_program_dump_ins_modifiers(param);
shader_dump_ins_modifiers(param);
TRACE(" ");
pshader_program_dump_ps_param(param, 0);
pToken += 2;
......@@ -1594,7 +1569,7 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, C
} else {
TRACE("%s", curOpcode->name);
if (curOpcode->num_params > 0) {
pshader_program_dump_ins_modifiers(*pToken);
shader_dump_ins_modifiers(*pToken);
TRACE(" ");
pshader_program_dump_ps_param(*pToken, 0);
++pToken;
......
......@@ -1641,6 +1641,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
parse_decl_usage(This, usage, param & D3DSP_REGNUM_MASK);
shader_program_dump_decl_usage(usage, param);
shader_dump_ins_modifiers(param);
TRACE(" ");
vshader_program_dump_vs_param(param, 0);
pToken += 2;
......@@ -1664,8 +1665,10 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader *iface,
++pToken;
++len;
} else {
TRACE("%s ", curOpcode->name);
TRACE("%s", curOpcode->name);
if (curOpcode->num_params > 0) {
shader_dump_ins_modifiers(*pToken);
TRACE(" ");
vshader_program_dump_vs_param(*pToken, 0);
++pToken;
++len;
......
......@@ -1300,6 +1300,9 @@ extern void generate_base_shader(
SHADER_BUFFER* buffer,
CONST DWORD* pFunction);
extern void shader_dump_ins_modifiers(
const DWORD output);
inline static int shader_get_regtype(const DWORD param) {
return (((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) |
((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2));
......
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