Commit 9bbccb7f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add a debug function for state names.

parent 3df59ccf
......@@ -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
......
......@@ -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;
......
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