wined3d: Add a debug function for state names.

This commit is contained in:
Henri Verbeet 2010-01-28 23:40:23 +01:00 committed by Alexandre Julliard
parent 3df59ccf69
commit 9bbccb7f80
2 changed files with 48 additions and 0 deletions

View File

@ -1786,6 +1786,51 @@ const char* debug_d3dtstype(WINED3DTRANSFORMSTATETYPE tstype) {
}
}
const char *debug_d3dstate(DWORD state)
{
if (STATE_IS_RENDER(state))
return wine_dbg_sprintf("STATE_RENDER(%s)", debug_d3drenderstate(state - STATE_RENDER(0)));
if (STATE_IS_TEXTURESTAGE(state))
{
DWORD texture_stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD texture_state = state - STATE_TEXTURESTAGE(texture_stage, 0);
return wine_dbg_sprintf("STATE_TEXTURESTAGE(%#x, %s)",
texture_stage, debug_d3dtexturestate(texture_state));
}
if (STATE_IS_SAMPLER(state))
return wine_dbg_sprintf("STATE_SAMPLER(%#x)", state - STATE_SAMPLER(0));
if (STATE_IS_PIXELSHADER(state))
return "STATE_PIXELSHADER";
if (STATE_IS_TRANSFORM(state))
return wine_dbg_sprintf("STATE_TRANSFORM(%s)", debug_d3dtstype(state - STATE_TRANSFORM(0)));
if (STATE_IS_STREAMSRC(state))
return "STATE_STREAMSRC";
if (STATE_IS_INDEXBUFFER(state))
return "STATE_INDEXBUFFER";
if (STATE_IS_VDECL(state))
return "STATE_VDECL";
if (STATE_IS_VSHADER(state))
return "STATE_VSHADER";
if (STATE_IS_VIEWPORT(state))
return "STATE_VIEWPORT";
if (STATE_IS_VERTEXSHADERCONSTANT(state))
return "STATE_VERTEXSHADERCONSTANT";
if (STATE_IS_PIXELSHADERCONSTANT(state))
return "STATE_PIXELSHADERCONSTANT";
if (STATE_IS_ACTIVELIGHT(state))
return wine_dbg_sprintf("STATE_ACTIVELIGHT(%#x)", state - STATE_ACTIVELIGHT(0));
if (STATE_IS_SCISSORRECT(state))
return "STATE_SCISSORRECT";
if (STATE_IS_CLIPPLANE(state))
return wine_dbg_sprintf("STATE_CLIPPLANE(%#x)", state - STATE_CLIPPLANE(0));
if (STATE_IS_MATERIAL(state))
return "STATE_MATERIAL";
if (STATE_IS_FRONTFACE(state))
return "STATE_FRONTFACE";
return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state);
}
const char* debug_d3dpool(WINED3DPOOL Pool) {
switch (Pool) {
#define POOL_TO_STR(p) case p: return #p

View File

@ -994,8 +994,10 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC
#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(MAX_CLIPPLANES - 1))
#define STATE_MATERIAL (STATE_CLIPPLANE(MAX_CLIPPLANES))
#define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL)
#define STATE_FRONTFACE (STATE_MATERIAL + 1)
#define STATE_IS_FRONTFACE(a) ((a) == STATE_FRONTFACE)
#define STATE_HIGHEST (STATE_FRONTFACE)
@ -2506,6 +2508,7 @@ const char *debug_d3ddeclusage(BYTE usage) DECLSPEC_HIDDEN;
const char *debug_d3dprimitivetype(WINED3DPRIMITIVETYPE PrimitiveType) DECLSPEC_HIDDEN;
const char *debug_d3drenderstate(DWORD state) DECLSPEC_HIDDEN;
const char *debug_d3dsamplerstate(DWORD state) DECLSPEC_HIDDEN;
const char *debug_d3dstate(DWORD state) DECLSPEC_HIDDEN;
const char *debug_d3dtexturefiltertype(WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN;
const char *debug_d3dtexturestate(DWORD state) DECLSPEC_HIDDEN;
const char *debug_d3dtstype(WINED3DTRANSFORMSTATETYPE tstype) DECLSPEC_HIDDEN;