diff options
-rw-r--r-- | docs/USAGE.markdown | 14 | ||||
-rwxr-xr-x | retrace/dxgiretrace.py | 16 | ||||
-rw-r--r-- | specs/d3d11.py | 4 | ||||
-rw-r--r-- | wrappers/dxgitrace.py | 1 |
4 files changed, 32 insertions, 3 deletions
diff --git a/docs/USAGE.markdown b/docs/USAGE.markdown index 2c56271d..d90dbe8c 100644 --- a/docs/USAGE.markdown +++ b/docs/USAGE.markdown @@ -274,6 +274,20 @@ For Direct3D applications you can follow the standard procedure for `ID3DUserDefinedAnnotation::EndEvent`, and `ID3DUserDefinedAnnotation::SetMarker` for D3D11.1 applications. +And for [naming objects](http://blogs.msdn.com/b/chuckw/archive/2010/04/15/object-naming.aspx) +which support `SetPrivateData` method: + + pObject->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(szName), szName); + +Note that [programmatic capture interfaces](https://msdn.microsoft.com/en-us/library/hh780905.aspx) +are currently _not_ supported. + +See also: + +* <http://seanmiddleditch.com/direct3d-11-debug-api-tricks/> + +* <http://blogs.msdn.com/b/chuckw/archive/2012/11/30/direct3d-sdk-debug-layer-tricks.aspx> + ## Mask OpenGL features ## diff --git a/retrace/dxgiretrace.py b/retrace/dxgiretrace.py index c7267ab7..a345293a 100755 --- a/retrace/dxgiretrace.py +++ b/retrace/dxgiretrace.py @@ -31,6 +31,7 @@ import sys from dllretrace import DllRetracer as Retracer import specs.dxgi from specs.stdapi import API +from specs.winapi import LPCSTR from specs.dxgi import dxgi from specs.d3d10 import d3d10 from specs.d3d10_1 import d3d10_1 @@ -382,6 +383,21 @@ class D3DRetracer(Retracer): print r' (*%s)->SetPrivateData(d3dstate::GUID_D3DSTATE, BytecodeLength, pShaderBytecode);' % ppShader.name print r' }' + def extractArg(self, function, arg, arg_type, lvalue, rvalue): + # Set object names + if function.name == 'SetPrivateData' and arg.name == 'pData': + iid = function.args[0].name + print r' if (%s != WKPDID_D3DDebugObjectName) {' % iid + print r' return;' + print r' }' + # Interpret argument as string + Retracer.extractArg(self, function, arg, LPCSTR, lvalue, rvalue) + print r' assert(pData);' + print r' assert(DataSize == strlen((const char *)pData));' + return + + Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue) + def main(): print r'#define INITGUID' diff --git a/specs/d3d11.py b/specs/d3d11.py index f9658ace..09109576 100644 --- a/specs/d3d11.py +++ b/specs/d3d11.py @@ -335,7 +335,7 @@ D3D11_BOX = Struct("D3D11_BOX", [ ID3D11DeviceChild.methods += [ StdMethod(Void, "GetDevice", [Out(Pointer(ObjPointer(ID3D11Device)), "ppDevice")]), StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), InOut(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False), - StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False), + StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")]), StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")], sideeffects=False), ] @@ -1305,7 +1305,7 @@ ID3D11Device.methods += [ StdMethod(HRESULT, "CheckCounter", [(Pointer(Const(D3D11_COUNTER_DESC)), "pDesc"), Out(Pointer(D3D11_COUNTER_TYPE), "pType"), Out(Pointer(UINT), "pActiveCounters"), Out(LPSTR, "szName"), Out(Pointer(UINT), "pNameLength"), Out(LPSTR, "szUnits"), Out(Pointer(UINT), "pUnitsLength"), Out(LPSTR, "szDescription"), Out(Pointer(UINT), "pDescriptionLength")], sideeffects=False), StdMethod(HRESULT, "CheckFeatureSupport", [(D3D11_FEATURE, "Feature"), Out(D3D11_FEATURE_DATA, "pFeatureSupportData"), (UINT, "FeatureSupportDataSize")], sideeffects=False), StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), InOut(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False), - StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False), + StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")]), StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")], sideeffects=False), StdMethod(D3D_FEATURE_LEVEL, "GetFeatureLevel", [], sideeffects=False), StdMethod(D3D11_CREATE_DEVICE_FLAG, "GetCreationFlags", [], sideeffects=False), diff --git a/wrappers/dxgitrace.py b/wrappers/dxgitrace.py index fe7a4715..67811e35 100644 --- a/wrappers/dxgitrace.py +++ b/wrappers/dxgitrace.py @@ -75,7 +75,6 @@ class D3DCommonTracer(DllTracer): return # Serialize object names - # http://blogs.msdn.com/b/chuckw/archive/2010/04/15/object-naming.aspx if function.name == 'SetPrivateData' and arg.name == 'pData': iid = function.args[0].name print r' if (%s == WKPDID_D3DDebugObjectName) {' % iid |