]> git.cworth.org Git - apitrace/blobdiff - retrace/d3dretrace.hpp
Use skiplist-based FastCallSet within trace::CallSet
[apitrace] / retrace / d3dretrace.hpp
index b552c0bf3935a609d06fe9be07f34bf4095897ec..41cc1c51d4ac5c892a3b3403d3f6f3afd12adc79 100644 (file)
 #include <windows.h>
 
 #include "retrace.hpp"
-
-
-struct IDirect3DDevice9;
-
-
-extern const char *g_szD3D9DllName;
+#include "d3dstate.hpp"
 
 
 namespace d3dretrace {
 
 
-extern IDirect3DDevice9 *pLastDirect3DDevice9;
-
-
+extern const retrace::Entry d3d8_callbacks[];
 extern const retrace::Entry d3d9_callbacks[];
+extern const retrace::Entry dxgi_callbacks[];
+
+
+template< class Device >
+class D3DDumper : public retrace::Dumper {
+public:
+    Device *pLastDevice;
+
+    D3DDumper() :
+        pLastDevice(NULL)
+    {}
+
+    image::Image *
+    getSnapshot(void) {
+        if (!pLastDevice) {
+            return NULL;
+        }
+        return d3dstate::getRenderTargetImage(pLastDevice);
+    }
+
+    bool
+    dumpState(std::ostream &os) {
+        if (!pLastDevice) {
+            return false;
+        }
+        d3dstate::dumpDevice(os, pLastDevice);
+        return true;
+    }
+
+    inline void
+    bindDevice(Device *pDevice) {
+        pLastDevice = pDevice;
+        retrace::dumper = this;
+    }
+    
+    inline void
+    unbindDevice(Device *pDevice) {
+        if (pLastDevice == pDevice) {
+            pLastDevice = NULL;
+        }
+    }
+};
 
 
 HWND