]> git.cworth.org Git - apitrace/blobdiff - retrace/dxgiretrace.py
d3dretrace: Use debugging when available.
[apitrace] / retrace / dxgiretrace.py
index 95face8b9e2d3be2216c439b8872f08de645ed7b..060171b67315dc6bee02d97356ed7e7c8dd7b85e 100644 (file)
@@ -74,14 +74,6 @@ createWindow(DXGI_SWAP_CHAIN_DESC *pSwapChainDesc) {
             if 'pSwapChainDesc' in function.argNames():
                 print r'    createWindow(pSwapChainDesc);'
 
-            # Compensate for the fact we don't trace the software renderer
-            # module LoadLibrary call
-            if 'Software' in function.argNames():
-                print r'    if (Software) {'
-                print r'        retrace::warning(call) << "using WARP for software device\n";'
-                print r'        Software = LoadLibraryA("d3d10warp");'
-                print r'    }'
-
             # Compensate for the fact we don't trace DXGI object creation
             if function.name.startswith('D3D11CreateDevice'):
                 print r'    if (DriverType == D3D_DRIVER_TYPE_UNKNOWN && !pAdapter) {'
@@ -89,8 +81,27 @@ createWindow(DXGI_SWAP_CHAIN_DESC *pSwapChainDesc) {
                 print r'    }'
 
             if function.name.startswith('D3D10CreateDevice'):
+                # Toggle debugging
+                print r'    Flags &= ~D3D10_CREATE_DEVICE_DEBUG;'
+                print r'    if (retrace::debug) {'
+                print r'        if (LoadLibraryA("d3d10sdklayers")) {'
+                print r'            Flags |= D3D10_CREATE_DEVICE_DEBUG;'
+                print r'        }'
+                print r'    }'
+
+                # Force driver
                 self.forceDriver('D3D10_DRIVER_TYPE')
+
             if function.name.startswith('D3D11CreateDevice'):
+                # Toggle debugging
+                print r'    Flags &= ~D3D11_CREATE_DEVICE_DEBUG;'
+                print r'    if (retrace::debug) {'
+                print r'        if (LoadLibraryA("d3d11sdklayers")) {'
+                print r'            Flags |= D3D11_CREATE_DEVICE_DEBUG;'
+                print r'        }'
+                print r'    }'
+
+                # Force driver
                 self.forceDriver('D3D_DRIVER_TYPE')
 
         Retracer.invokeFunction(self, function)
@@ -188,6 +199,14 @@ createWindow(DXGI_SWAP_CHAIN_DESC *pSwapChainDesc) {
             print '        _maps[_this] = 0;'
             print '    }'
 
+        # Attach shader byte code for lookup
+        if 'pShaderBytecode' in method.argNames():
+            ppShader = method.args[-1]
+            assert ppShader.output
+            print r'    if (retrace::dumpingState && SUCCEEDED(_result)) {'
+            print r'        (*%s)->SetPrivateData(d3dstate::GUID_D3DSTATE, BytecodeLength, pShaderBytecode);' % ppShader.name
+            print r'    }'
+
 
 def main():
     print r'#include <string.h>'
@@ -207,8 +226,6 @@ def main():
     if 'd3d10' in moduleNames:
         if 'd3d10_1' in moduleNames:
             print r'#include "d3d10_1imports.hpp"'
-            # D3D10CreateBlob is duplicated in d3d10 and d3d10_1
-            d3d10_1.functions = [function for function in d3d10_1.functions if function.name != 'D3D10CreateBlob']
             api.addModule(d3d10_1)
         else:
             print r'#include "d3d10imports.hpp"'