]> git.cworth.org Git - apitrace/blobdiff - retrace/d3dretrace.py
Don't retrace calls that failed when tracing.
[apitrace] / retrace / d3dretrace.py
index 4a78e96a7206b4c7def25ca13e3ba848802b48f7..a04e01def391870b815a68ff54884f3685561f0d 100644 (file)
@@ -53,6 +53,11 @@ class D3DRetracer(Retracer):
         Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)
 
     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 in ('CreateDevice', 'CreateDeviceEx'):
             print r'    HWND hWnd = createWindow(pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);'
             print r'    hFocusWindow = hWnd;'
@@ -60,8 +65,9 @@ class D3DRetracer(Retracer):
 
         Retracer.invokeInterfaceMethod(self, interface, method)
 
+        # check errors
         if str(method.type) == 'HRESULT':
-            print r'    if (_result != S_OK) {'
+            print r'    if (FAILED(_result)) {'
             print r'        retrace::warning(call) << "failed\n";'
             print r'    }'
 
@@ -225,6 +231,5 @@ found:
 }
 '''
 
-    d3d9.name = 'd3d9d'
     retracer = D3DRetracer()
     retracer.retraceApi(d3d9)