diff options
author | Patrick Rudolph <siro@das-labor.org> | 2016-08-03 17:44:26 +0200 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-09-21 11:48:49 +0100 |
commit | 5d999b460ab8b383512d6f7620de82232369b302 (patch) | |
tree | 7c6534905c8cd7525a4b2907daf1bb17e5c2e6ac /retrace/d3d9state.cpp | |
parent | 3e6c417b8d4e64b78003fba4599f1de336b60133 (diff) |
d3dretrace: Dump d3d9 renderstates
Use a marco to dump all D3D9 renderstates.
Tested on D3D9 trace.
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'retrace/d3d9state.cpp')
-rw-r--r-- | retrace/d3d9state.cpp | 133 |
1 files changed, 129 insertions, 4 deletions
diff --git a/retrace/d3d9state.cpp b/retrace/d3d9state.cpp index 0717c102..a3aed468 100644 --- a/retrace/d3d9state.cpp +++ b/retrace/d3d9state.cpp @@ -94,14 +94,139 @@ dumpShaders(StateWriter &writer, IDirect3DDevice9 *pDevice) writer.endMember(); // shaders } -void -dumpDevice(StateWriter &writer, IDirect3DDevice9 *pDevice) +static void +dumpRenderstate(StateWriter &writer, IDirect3DDevice9 *pDevice) { - /* TODO */ +#define _DUMP_RS_INT(x) { \ + DWORD rsDword = 0; \ + pDevice->GetRenderState(x, &rsDword); \ + writer.writeIntMember(#x, rsDword); \ +} + +#define _DUMP_RS_FLOAT(x) { \ + float rsFloat = 0.0f; \ + pDevice->GetRenderState(x, (DWORD *)&rsFloat); \ + writer.writeFloatMember(#x, rsFloat); \ +} + writer.beginMember("parameters"); writer.beginObject(); + + _DUMP_RS_INT(D3DRS_ZENABLE); + _DUMP_RS_INT(D3DRS_FILLMODE); + _DUMP_RS_INT(D3DRS_SHADEMODE); + _DUMP_RS_INT(D3DRS_ZWRITEENABLE); + _DUMP_RS_INT(D3DRS_ALPHATESTENABLE); + _DUMP_RS_INT(D3DRS_LASTPIXEL); + _DUMP_RS_INT(D3DRS_SRCBLEND); + _DUMP_RS_INT(D3DRS_DESTBLEND); + _DUMP_RS_INT(D3DRS_CULLMODE); + _DUMP_RS_INT(D3DRS_ZFUNC); + _DUMP_RS_INT(D3DRS_ALPHAREF); + _DUMP_RS_INT(D3DRS_ALPHAFUNC); + _DUMP_RS_INT(D3DRS_DITHERENABLE); + _DUMP_RS_INT(D3DRS_ALPHABLENDENABLE); + _DUMP_RS_INT(D3DRS_FOGENABLE); + _DUMP_RS_INT(D3DRS_SPECULARENABLE); + _DUMP_RS_INT(D3DRS_FOGCOLOR); + _DUMP_RS_INT(D3DRS_FOGTABLEMODE); + _DUMP_RS_FLOAT(D3DRS_FOGSTART); + _DUMP_RS_FLOAT(D3DRS_FOGEND); + _DUMP_RS_FLOAT(D3DRS_FOGDENSITY); + _DUMP_RS_INT(D3DRS_RANGEFOGENABLE); + _DUMP_RS_INT(D3DRS_STENCILENABLE); + _DUMP_RS_INT(D3DRS_STENCILFAIL); + _DUMP_RS_INT(D3DRS_STENCILZFAIL); + _DUMP_RS_INT(D3DRS_STENCILPASS); + _DUMP_RS_INT(D3DRS_STENCILFUNC); + _DUMP_RS_INT(D3DRS_STENCILREF); + _DUMP_RS_INT(D3DRS_STENCILMASK); + _DUMP_RS_INT(D3DRS_STENCILWRITEMASK); + _DUMP_RS_INT(D3DRS_TEXTUREFACTOR); + _DUMP_RS_INT(D3DRS_WRAP0); + _DUMP_RS_INT(D3DRS_WRAP1); + _DUMP_RS_INT(D3DRS_WRAP2); + _DUMP_RS_INT(D3DRS_WRAP3); + _DUMP_RS_INT(D3DRS_WRAP4); + _DUMP_RS_INT(D3DRS_WRAP5); + _DUMP_RS_INT(D3DRS_WRAP6); + _DUMP_RS_INT(D3DRS_WRAP7); + _DUMP_RS_INT(D3DRS_CLIPPING); + _DUMP_RS_INT(D3DRS_LIGHTING); + _DUMP_RS_FLOAT(D3DRS_AMBIENT); + _DUMP_RS_INT(D3DRS_FOGVERTEXMODE); + _DUMP_RS_INT(D3DRS_COLORVERTEX); + _DUMP_RS_INT(D3DRS_LOCALVIEWER); + _DUMP_RS_INT(D3DRS_NORMALIZENORMALS); + _DUMP_RS_INT(D3DRS_DIFFUSEMATERIALSOURCE); + _DUMP_RS_INT(D3DRS_SPECULARMATERIALSOURCE); + _DUMP_RS_INT(D3DRS_AMBIENTMATERIALSOURCE); + _DUMP_RS_INT(D3DRS_EMISSIVEMATERIALSOURCE); + _DUMP_RS_INT(D3DRS_VERTEXBLEND); + _DUMP_RS_INT(D3DRS_CLIPPLANEENABLE); + _DUMP_RS_FLOAT(D3DRS_POINTSIZE); + _DUMP_RS_FLOAT(D3DRS_POINTSIZE_MIN); + _DUMP_RS_INT(D3DRS_POINTSPRITEENABLE); + _DUMP_RS_INT(D3DRS_POINTSCALEENABLE); + _DUMP_RS_FLOAT(D3DRS_POINTSCALE_A); + _DUMP_RS_FLOAT(D3DRS_POINTSCALE_B); + _DUMP_RS_FLOAT(D3DRS_POINTSCALE_C); + _DUMP_RS_INT(D3DRS_MULTISAMPLEANTIALIAS); + _DUMP_RS_INT(D3DRS_MULTISAMPLEMASK); + _DUMP_RS_INT(D3DRS_PATCHEDGESTYLE); + _DUMP_RS_INT(D3DRS_DEBUGMONITORTOKEN); + _DUMP_RS_FLOAT(D3DRS_POINTSIZE_MAX); + _DUMP_RS_INT(D3DRS_INDEXEDVERTEXBLENDENABLE); + _DUMP_RS_INT(D3DRS_COLORWRITEENABLE); + _DUMP_RS_INT(D3DRS_TWEENFACTOR); + _DUMP_RS_INT(D3DRS_BLENDOP); + _DUMP_RS_INT(D3DRS_POSITIONDEGREE); + _DUMP_RS_INT(D3DRS_NORMALDEGREE); + _DUMP_RS_INT(D3DRS_SCISSORTESTENABLE); + _DUMP_RS_INT(D3DRS_SLOPESCALEDEPTHBIAS); + _DUMP_RS_INT(D3DRS_ANTIALIASEDLINEENABLE); + _DUMP_RS_INT(D3DRS_MINTESSELLATIONLEVEL); + _DUMP_RS_INT(D3DRS_MAXTESSELLATIONLEVEL); + _DUMP_RS_FLOAT(D3DRS_ADAPTIVETESS_X); + _DUMP_RS_FLOAT(D3DRS_ADAPTIVETESS_Y); + _DUMP_RS_FLOAT(D3DRS_ADAPTIVETESS_Z); + _DUMP_RS_FLOAT(D3DRS_ADAPTIVETESS_W); + _DUMP_RS_INT(D3DRS_ENABLEADAPTIVETESSELLATION); + _DUMP_RS_INT(D3DRS_TWOSIDEDSTENCILMODE); + _DUMP_RS_INT(D3DRS_CCW_STENCILFAIL); + _DUMP_RS_INT(D3DRS_CCW_STENCILZFAIL); + _DUMP_RS_INT(D3DRS_CCW_STENCILPASS); + _DUMP_RS_INT(D3DRS_CCW_STENCILFUNC); + _DUMP_RS_INT(D3DRS_COLORWRITEENABLE1); + _DUMP_RS_INT(D3DRS_COLORWRITEENABLE2); + _DUMP_RS_INT(D3DRS_COLORWRITEENABLE3); + _DUMP_RS_INT(D3DRS_BLENDFACTOR); + _DUMP_RS_INT(D3DRS_SRGBWRITEENABLE); + _DUMP_RS_FLOAT(D3DRS_DEPTHBIAS); + _DUMP_RS_INT(D3DRS_WRAP8); + _DUMP_RS_INT(D3DRS_WRAP9); + _DUMP_RS_INT(D3DRS_WRAP10); + _DUMP_RS_INT(D3DRS_WRAP11); + _DUMP_RS_INT(D3DRS_WRAP12); + _DUMP_RS_INT(D3DRS_WRAP13); + _DUMP_RS_INT(D3DRS_WRAP14); + _DUMP_RS_INT(D3DRS_WRAP15); + _DUMP_RS_INT(D3DRS_SEPARATEALPHABLENDENABLE); + _DUMP_RS_INT(D3DRS_SRCBLENDALPHA); + _DUMP_RS_INT(D3DRS_DESTBLENDALPHA); + _DUMP_RS_INT(D3DRS_BLENDOPALPHA); + +#undef _DUMP_RS_INT +#undef _DUMP_RS_FLOAT + writer.endObject(); - writer.endMember(); // parameters + writer.endMember(); +} + +void +dumpDevice(StateWriter &writer, IDirect3DDevice9 *pDevice) +{ + dumpRenderstate(writer, pDevice); dumpShaders(writer, pDevice); |