diff options
-rw-r--r-- | retrace/d3d10state.cpp | 40 | ||||
-rw-r--r-- | retrace/d3d11state.cpp | 40 |
2 files changed, 80 insertions, 0 deletions
diff --git a/retrace/d3d10state.cpp b/retrace/d3d10state.cpp index 5d6bef21..d17fbf1f 100644 --- a/retrace/d3d10state.cpp +++ b/retrace/d3d10state.cpp @@ -94,6 +94,44 @@ dumpDepthStencilState(StateWriter &writer, ID3D10Device *pDevice) static void +dumpViewports(StateWriter &writer, ID3D10Device *pDevice) +{ + D3D10_VIEWPORT vps[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + UINT numViewports = 0, i; + + pDevice->RSGetViewports(&numViewports, NULL); + pDevice->RSGetViewports(&numViewports, vps); + + writer.beginMember("Viewports"); + writer.beginArray(); + for (i = 0; i < numViewports; ++i) { + dumpStateObject(writer, vps[i]); + } + writer.endArray(); + writer.endMember(); +} + + +static void +dumpScissors(StateWriter &writer, ID3D10Device *pDevice) +{ + D3D10_RECT rects[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + UINT numRects = 0, i; + + pDevice->RSGetScissorRects(&numRects, NULL); + pDevice->RSGetScissorRects(&numRects, rects); + + writer.beginMember("Scissors"); + writer.beginArray(); + for (i = 0; i < numRects; ++i) { + dumpStateObject(writer, rects[i]); + } + writer.endArray(); + writer.endMember(); +} + + +static void dumpParameters(StateWriter &writer, ID3D10Device *pDevice) { // TODO: dump description of current bound state @@ -103,6 +141,8 @@ dumpParameters(StateWriter &writer, ID3D10Device *pDevice) dumpRasterizerState(writer, pDevice); dumpBlendState(writer, pDevice); dumpDepthStencilState(writer, pDevice); + dumpViewports(writer, pDevice); + dumpScissors(writer, pDevice); writer.endObject(); writer.endMember(); // parameters diff --git a/retrace/d3d11state.cpp b/retrace/d3d11state.cpp index 85f771cc..737e306f 100644 --- a/retrace/d3d11state.cpp +++ b/retrace/d3d11state.cpp @@ -95,6 +95,44 @@ dumpDepthStencilState(StateWriter &writer, ID3D11DeviceContext *pDeviceContext) static void +dumpViewports(StateWriter &writer, ID3D11DeviceContext *pDeviceContext) +{ + D3D11_VIEWPORT vps[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + UINT numViewports = 0, i; + + pDeviceContext->RSGetViewports(&numViewports, NULL); + pDeviceContext->RSGetViewports(&numViewports, vps); + + writer.beginMember("Viewports"); + writer.beginArray(); + for (i = 0; i < numViewports; ++i) { + dumpStateObject(writer, vps[i]); + } + writer.endArray(); + writer.endMember(); +} + + +static void +dumpScissors(StateWriter &writer, ID3D11DeviceContext *pDeviceContext) +{ + D3D11_RECT rects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + UINT numRects = 0, i; + + pDeviceContext->RSGetScissorRects(&numRects, NULL); + pDeviceContext->RSGetScissorRects(&numRects, rects); + + writer.beginMember("Scissors"); + writer.beginArray(); + for (i = 0; i < numRects; ++i) { + dumpStateObject(writer, rects[i]); + } + writer.endArray(); + writer.endMember(); +} + + +static void dumpParameters(StateWriter &writer, ID3D11DeviceContext *pDeviceContext) { // TODO: dump description of current bound state @@ -104,6 +142,8 @@ dumpParameters(StateWriter &writer, ID3D11DeviceContext *pDeviceContext) dumpRasterizerState(writer, pDeviceContext); dumpBlendState(writer, pDeviceContext); dumpDepthStencilState(writer, pDeviceContext); + dumpViewports(writer, pDeviceContext); + dumpScissors(writer, pDeviceContext); writer.endObject(); writer.endMember(); // parameters |