summaryrefslogtreecommitdiff
path: root/retrace
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2015-06-29 15:40:42 -0400
committerJose Fonseca <jfonseca@vmware.com>2015-07-06 19:02:20 +0100
commit4398f8bf07d7ed930417a9b012872b70e9a67892 (patch)
treef9684594b78a0b6b939c969ab1a42cbe0b285fa5 /retrace
parent5c9ad1197bdf517ccd2e2f0aa3fdb1abb6453a0d (diff)
d3d11state: Add dumping of viewport and scissor states.
Lets also dump the viewports and scissor rects when dumping the state.
Diffstat (limited to 'retrace')
-rw-r--r--retrace/d3d10state.cpp40
-rw-r--r--retrace/d3d11state.cpp40
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