]> git.cworth.org Git - apitrace/blobdiff - retrace/d3d10retrace.py
d3d10,d3d11: Rudimentary retrace support.
[apitrace] / retrace / d3d10retrace.py
index ee8736b133b451e481eba7adf795be8f866034aa..877b1e4ecfaa117fde5bac638f1300c38f2e1a48 100644 (file)
 ##########################################################################/
 
 
-"""D3D retracer generator."""
+"""D3D10 retracer generator."""
 
 
-from dllretrace import DllRetracer as Retracer
+from d3dcommonretrace import D3DRetracer
 import specs.stdapi as stdapi
-from specs.d3d10 import *
-
-
-class D3DRetracer(Retracer):
-
-    def retraceApi(self, api):
-        print '// Swizzling mapping for lock addresses'
-        print 'static std::map<void *, void *> _maps;'
-        print
-
-        self.table_name = 'd3dretrace::%s_callbacks' % api.name.lower()
-
-        Retracer.retraceApi(self, api)
-
-    def invokeFunction(self, function):
-        # create windows as neccessary
-        if function.name == 'D3D10CreateDeviceAndSwapChain':
-            print r'    pSwapChainDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
-
-        Retracer.invokeFunction(self, function)
-
-    def invokeInterfaceMethod(self, interface, method):
-        # keep track of the last used device for state dumping
-        #if interface.name in ('IDirect3DDevice9', 'IDirect3DDevice9Ex'):
-        #    print r'    d3dretrace::pLastDirect3DDevice9 = _this;'
-
-        # create windows as neccessary
-        if method.name == 'CreateSwapChain':
-            print r'    pDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
-
-        # notify frame has been completed
-        if method.name == 'Present':
-            print r'    retrace::frameComplete(call);'
-
-        if 'pSharedResource' in method.argNames():
-            print r'    if (pSharedResource) {'
-            print r'        retrace::warning(call) << "shared surfaces unsupported\n";'
-            print r'        pSharedResource = NULL;'
-            print r'    }'
-
-        Retracer.invokeInterfaceMethod(self, interface, method)
-
-        # process events after presents
-        if method.name == 'Present':
-            print r'    d3dretrace::processEvents();'
-
-        # check errors
-        if str(method.type) == 'HRESULT':
-            print r'    if (FAILED(_result)) {'
-            print r'        retrace::warning(call) << "failed\n";'
-            print r'    }'
-
-        if method.name == 'Map':
-            print '    VOID *_pbData = NULL;'
-            print '    size_t _MappedSize = 0;'
-            print '    _getMapInfo(_this, %s, _pbData, _MappedSize);' % ', '.join(method.argNames())
-            print '    _maps[_this] = _pbData;'
-        
-        if method.name == 'Unmap':
-            print '    VOID *_pbData = 0;'
-            print '    _pbData = _maps[_this];'
-            print '    if (_pbData) {'
-            print '        retrace::delRegionByPointer(_pbData);'
-            print '    }'
+from specs.d3d10 import d3d10
 
 
 if __name__ == '__main__':