summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/USAGE.markdown7
-rw-r--r--inject/injectee.cpp1
-rw-r--r--retrace/d3d9retrace.py3
-rw-r--r--specs/d3d9.py12
-rw-r--r--wrappers/CMakeLists.txt1
-rw-r--r--wrappers/d3d9trace.py4
-rw-r--r--wrappers/dxgitrace.def7
-rw-r--r--wrappers/dxgitrace.py3
8 files changed, 32 insertions, 6 deletions
diff --git a/docs/USAGE.markdown b/docs/USAGE.markdown
index 6df7ba0f..2c56271d 100644
--- a/docs/USAGE.markdown
+++ b/docs/USAGE.markdown
@@ -200,6 +200,8 @@ to hook only the APIs of interest.
## Emitting annotations to the trace ##
+### OpenGL annotations ###
+
From within OpenGL applications you can embed annotations in the trace file
through the following extensions:
@@ -260,10 +262,13 @@ For OpenGL ES applications you can embed annotations in the trace file through t
extensions.
+### Direct3D annotations ###
+
For Direct3D applications you can follow the standard procedure for
[adding user defined events to Visual Studio Graphics Debugger / PIX](http://msdn.microsoft.com/en-us/library/vstudio/hh873200.aspx):
-- `D3DPERF_BeginEvent`, `D3DPERF_EndEvent`, and `D3DPERF_SetMarker` for D3D9 applications.
+- `D3DPERF_BeginEvent`, `D3DPERF_EndEvent`, and `D3DPERF_SetMarker` for D3D9,
+ D3D10, and D3D11.0 applications.
- `ID3DUserDefinedAnnotation::BeginEvent`,
`ID3DUserDefinedAnnotation::EndEvent`, and
diff --git a/inject/injectee.cpp b/inject/injectee.cpp
index 9b44cc6c..7809c6d4 100644
--- a/inject/injectee.cpp
+++ b/inject/injectee.cpp
@@ -947,6 +947,7 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
registerModuleHooks("d3d10.dll", g_hHookModule);
registerModuleHooks("d3d10_1.dll", g_hHookModule);
registerModuleHooks("d3d11.dll", g_hHookModule);
+ registerModuleHooks("d3d9.dll", g_hHookModule); // for D3DPERF_*
} else if (stricmp(szNewDllBaseName, "d2d1trace.dll") == 0) {
registerModuleHooks("d2d1.dll", g_hHookModule);
registerModuleHooks("dwrite.dll", g_hHookModule);
diff --git a/retrace/d3d9retrace.py b/retrace/d3d9retrace.py
index 0891dbef..3c625a63 100644
--- a/retrace/d3d9retrace.py
+++ b/retrace/d3d9retrace.py
@@ -210,9 +210,10 @@ def main():
if support:
if moduleName == 'd3d9':
- from specs.d3d9 import d3d9
+ from specs.d3d9 import d3d9, d3dperf
print r'#include "d3d9imports.hpp"'
print r'#include "d3d9size.hpp"'
+ d3d9.mergeModule(d3dperf)
api.addModule(d3d9)
print
print '''static d3dretrace::D3DDumper<IDirect3DDevice9> d3d9Dumper;'''
diff --git a/specs/d3d9.py b/specs/d3d9.py
index 8cd8ccad..949b3486 100644
--- a/specs/d3d9.py
+++ b/specs/d3d9.py
@@ -422,6 +422,15 @@ d3d9 = Module("d3d9")
d3d9.addFunctions([
StdFunction(PDIRECT3D9, "Direct3DCreate9", [(UINT, "SDKVersion")], fail='NULL'),
StdFunction(HRESULT, "Direct3DCreate9Ex", [(UINT, "SDKVersion"), Out(Pointer(PDIRECT3D9EX), "ppD3D")], fail='D3DERR_NOTAVAILABLE'),
+])
+d3d9.addInterfaces([
+ IDirect3DSwapChain9Ex,
+])
+
+# D3DPERF_* functions can also be used by D3D10 applications, so keep them in a
+# separate module to be merged as necessary
+d3dperf = Module("d3d9")
+d3dperf.addFunctions([
StdFunction(Int, "D3DPERF_BeginEvent", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail='-1', sideeffects=False),
StdFunction(Int, "D3DPERF_EndEvent", [], fail='-1', sideeffects=False),
StdFunction(Void, "D3DPERF_SetMarker", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], sideeffects=False),
@@ -430,6 +439,3 @@ d3d9.addFunctions([
StdFunction(Void, "D3DPERF_SetOptions", [(DWORD, "dwOptions")], sideeffects=False),
StdFunction(DWORD, "D3DPERF_GetStatus", [], fail='0', sideeffects=False),
])
-d3d9.addInterfaces([
- IDirect3DSwapChain9Ex,
-])
diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt
index 87b32ae6..610f99b3 100644
--- a/wrappers/CMakeLists.txt
+++ b/wrappers/CMakeLists.txt
@@ -146,6 +146,7 @@ if (WIN32)
${CMAKE_SOURCE_DIR}/specs/dxgi.py
${CMAKE_SOURCE_DIR}/specs/dxgitype.py
${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d9.py
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
diff --git a/wrappers/d3d9trace.py b/wrappers/d3d9trace.py
index bfcd65d4..45c950d6 100644
--- a/wrappers/d3d9trace.py
+++ b/wrappers/d3d9trace.py
@@ -26,7 +26,7 @@
from dlltrace import DllTracer
from specs.stdapi import API, Pointer, ObjPointer
-from specs.d3d9 import d3d9, D3DSHADER9, IDirect3DSwapChain9Ex
+from specs.d3d9 import d3d9, D3DSHADER9, IDirect3DSwapChain9Ex, d3dperf
import specs.d3d9dxva2
@@ -117,6 +117,8 @@ if __name__ == '__main__':
print '#include "dxvaint.h"'
print
+ d3d9.mergeModule(d3dperf)
+
api = API()
api.addModule(d3d9)
tracer = D3D9Tracer()
diff --git a/wrappers/dxgitrace.def b/wrappers/dxgitrace.def
index 7502bb9f..02880c48 100644
--- a/wrappers/dxgitrace.def
+++ b/wrappers/dxgitrace.def
@@ -7,3 +7,10 @@ EXPORTS
D3D10CreateDeviceAndSwapChain1
D3D11CreateDevice
D3D11CreateDeviceAndSwapChain
+ D3DPERF_BeginEvent
+ D3DPERF_EndEvent
+ D3DPERF_SetMarker
+ D3DPERF_SetRegion
+ D3DPERF_QueryRepeatFrame
+ D3DPERF_SetOptions
+ D3DPERF_GetStatus
diff --git a/wrappers/dxgitrace.py b/wrappers/dxgitrace.py
index 9d1dce45..fe7a4715 100644
--- a/wrappers/dxgitrace.py
+++ b/wrappers/dxgitrace.py
@@ -33,6 +33,7 @@ from specs import dxgi
from specs import d3d10
from specs import d3d10_1
from specs import d3d11
+from specs import d3d9
class D3DCommonTracer(DllTracer):
@@ -145,6 +146,7 @@ if __name__ == '__main__':
print r'#include "d3d10size.hpp"'
print r'#include "d3d11imports.hpp"'
print r'#include "d3d11size.hpp"'
+ print r'#include "d3d9imports.hpp" // D3DPERF_*'
print
api = API()
@@ -152,6 +154,7 @@ if __name__ == '__main__':
api.addModule(d3d10.d3d10)
api.addModule(d3d10_1.d3d10_1)
api.addModule(d3d11.d3d11)
+ api.addModule(d3d9.d3dperf)
tracer = D3DCommonTracer()
tracer.traceApi(api)