Skip to content

Commit

Permalink
d3dretrace: Avoid crashes with D3D10_DRIVER_TYPE_(SOFTWARE|REFERENCE).
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfonseca committed Feb 22, 2021
1 parent 0db6d7f commit 83691e9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion retrace/dxgiretrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ def invokeFunction(self, function):
print(r' Flags &= ~D3D10_CREATE_DEVICE_DEBUG;')
print(r' }')

# D3D10CreateDevice(D3D10_DRIVER_TYPE_REFERENCE) fails with
# DXGI_ERROR_UNSUPPORTED on 64bits.
print(r'#ifdef _WIN64')
print(r' if (DriverType == D3D10_DRIVER_TYPE_REFERENCE) {')
print(r' DriverType = D3D10_DRIVER_TYPE_WARP;')
print(r' }')
print(r'#endif')

# Force driver
self.forceDriver('D3D10_DRIVER_TYPE_HARDWARE')

Expand Down Expand Up @@ -138,7 +146,11 @@ def forceDriver(self, driverType):
print(r' _result = d3dretrace::createAdapter(_pFactory, IID_IDXGIAdapter1, (void **)&_pAdapter);')
print(r' pAdapter = _pAdapter;')
print(r' DriverType = %s;' % driverType)
print(r' Software = NULL;')
print(r' Software = nullptr;')
print(r' }')
print(r' if (Software) {')
print(r' Software = LoadLibraryA("d3d10warp.dll");')
print(r' assert(Software != nullptr);')
print(r' }')

def doInvokeInterfaceMethod(self, interface, method):
Expand Down

0 comments on commit 83691e9

Please sign in to comment.