]> git.cworth.org Git - apitrace/blobdiff - wrappers/d3d9trace.py
d3dretrace: Dump textures of all shader stages.
[apitrace] / wrappers / d3d9trace.py
index c1cadb67e49b10d39d6619992d6fb6acceb73977..df401da5d090e7cd67b75018d8ba13f35cf20335 100644 (file)
@@ -25,7 +25,8 @@
 
 
 from dlltrace import DllTracer
-from specs.d3d9 import d3d9, D3DSHADER9
+from specs.stdapi import API, Pointer, ObjPointer
+from specs.d3d9 import d3d9, D3DSHADER9, IDirect3DSwapChain9Ex
 
 import specs.d3d9dxva2
 
@@ -40,6 +41,16 @@ class D3D9Tracer(DllTracer):
 
         DllTracer.serializeArgValue(self, function, arg)
 
+    def wrapArg(self, function, arg):
+        # Correctly handle the wrapping of IDirect3DSwapChain9Ex objects
+        if function.name in ('GetSwapChain', 'CreateAdditionalSwapChain') \
+           and self.interface.name == 'IDirect3DDevice9Ex' \
+           and arg.name == 'pSwapChain':
+            self.wrapValue(Pointer(ObjPointer(IDirect3DSwapChain9Ex)), '((IDirect3DSwapChain9Ex**)pSwapChain)')
+            return
+
+        DllTracer.wrapArg(self, function, arg)
+
     def enumWrapperInterfaceVariables(self, interface):
         variables = DllTracer.enumWrapperInterfaceVariables(self, interface)
         
@@ -83,17 +94,8 @@ if __name__ == '__main__':
     print '#include "d3d9shader.hpp"'
     print '#include "dxvaint.h"'
     print
-    print '''
-static inline size_t
-_declCount(const D3DVERTEXELEMENT9 *pVertexElements) {
-    size_t count = 0;
-    if (pVertexElements) {
-        while (pVertexElements[count++].Stream != 0xff)
-            ;
-    }
-    return count;
-}
-'''
-    tracer = D3D9Tracer('d3d9.dll')
-    tracer.traceModule(d3d9)
 
+    api = API()
+    api.addModule(d3d9)
+    tracer = D3D9Tracer()
+    tracer.traceApi(api)