X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fd3dretrace.hpp;h=41cc1c51d4ac5c892a3b3403d3f6f3afd12adc79;hb=7a9fb5103e052150232b64cb5d99374cda3f1234;hp=ebfa10a3c8d70e2b71e0581f7fffb307585fd939;hpb=a8a501ab34dfa5e5448ea7ff6582df7a404197c0;p=apitrace diff --git a/retrace/d3dretrace.hpp b/retrace/d3dretrace.hpp index ebfa10a..41cc1c5 100644 --- a/retrace/d3dretrace.hpp +++ b/retrace/d3dretrace.hpp @@ -26,22 +26,70 @@ #ifndef _D3DRETRACE_HPP_ #define _D3DRETRACE_HPP_ -#include "retrace.hpp" - - -struct IDirect3DDevice9; +#include -extern const char *g_szD3D9DllName; +#include "retrace.hpp" +#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 +createWindow(int width, int height); + +void +resizeWindow(HWND hWnd, int width, int height); + +bool +processEvents(void); } /* namespace d3dretrace */