From: José Fonseca <jose.r.fonseca@gmail.com>
Date: Tue, 8 May 2012 22:41:35 +0000 (+0100)
Subject: Stub d3d state dumping.
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=d63a361f67ab8db48fe71c3b3de737f48257c4f8;p=apitrace

Stub d3d state dumping.
---

diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt
index dcf9da4..8d638d0 100644
--- a/retrace/CMakeLists.txt
+++ b/retrace/CMakeLists.txt
@@ -149,6 +149,7 @@ if (WIN32 AND DirectX_D3DX9_INCLUDE_DIR)
         retrace_stdc.cpp
         d3dretrace_main.cpp
         d3dretrace_d3d9.cpp
+        d3dstate.cpp
         d3dstate_images.cpp
     )
     target_link_libraries (d3dretrace
diff --git a/retrace/d3dretrace_main.cpp b/retrace/d3dretrace_main.cpp
index 4dba299..40d53ea 100644
--- a/retrace/d3dretrace_main.cpp
+++ b/retrace/d3dretrace_main.cpp
@@ -71,7 +71,13 @@ retrace::getSnapshot(void) {
 bool
 retrace::dumpState(std::ostream &os)
 {
-    return false;
+    if (!d3dretrace::pLastDirect3DDevice9) {
+        return false;
+    }
+
+    d3dstate::dumpDevice(os, d3dretrace::pLastDirect3DDevice9);
+
+    return true;
 }
 
 
diff --git a/retrace/d3dstate.cpp b/retrace/d3dstate.cpp
new file mode 100644
index 0000000..4fa89c2
--- /dev/null
+++ b/retrace/d3dstate.cpp
@@ -0,0 +1,45 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <iostream>
+
+#include "d3d9imports.hpp"
+#include "json.hpp"
+
+
+namespace d3dstate {
+
+
+void
+dumpDevice(std::ostream &os, IDirect3DDevice9 *pDevice)
+{
+    JSONWriter json(os);
+
+    /* TODO */
+}
+
+
+} /* namespace d3dstate */
diff --git a/retrace/d3dstate.hpp b/retrace/d3dstate.hpp
index c607ed2..33322a1 100644
--- a/retrace/d3dstate.hpp
+++ b/retrace/d3dstate.hpp
@@ -27,6 +27,9 @@
 #define _D3DSTATE_HPP_
 
 
+#include <iostream>
+
+
 struct IDirect3DDevice9;
 
 
@@ -42,6 +45,10 @@ image::Image *
 getRenderTargetImage(IDirect3DDevice9 *pDevice);
 
 
+void
+dumpDevice(std::ostream &os, IDirect3DDevice9 *pDevice);
+
+
 } /* namespace d3dstate */