Doesn't work often, in practice because dxgi calls are missing from traces.
install (TARGETS eglretrace RUNTIME DESTINATION bin)
endif ()
-if (WIN32 AND DirectX_D3DX9_INCLUDE_DIR AND DirectX_D3D10_INCLUDE_DIR)
+if (WIN32 AND DirectX_D3DX9_INCLUDE_DIR)
add_custom_command (
OUTPUT d3dretrace_d3d9.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d9retrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d9.cpp
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
+ include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR})
+ add_executable (d3dretrace
+ d3dretrace_main.cpp
+ d3dretrace_d3d9.cpp
+ d3dretrace_ws.cpp
+ d3d9state.cpp
+ d3d9state_images.cpp
+ )
+ target_link_libraries (d3dretrace
+ retrace_common
+ )
+
+ install (TARGETS d3dretrace RUNTIME DESTINATION bin)
+endif ()
+
+if (WIN32 AND DirectX_D3D10_INCLUDE_DIR)
add_custom_command (
OUTPUT d3dretrace_d3d10.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10retrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d10.cpp
DEPENDS
d3d10retrace.py
+ d3dcommonretrace.py
dllretrace.py
retrace.py
${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
- include_directories (SYSTEM ${DirectX_D3DX9_INCLUDE_DIR})
- add_executable (d3dretrace
+ include_directories (SYSTEM ${DirectX_D3D10_INCLUDE_DIR})
+ add_executable (d3d10retrace
d3dretrace_main.cpp
- d3dretrace_d3d9.cpp
d3dretrace_d3d10.cpp
d3dretrace_ws.cpp
d3d9state.cpp
d3d9state_images.cpp
)
- target_link_libraries (d3dretrace
+ target_link_libraries (d3d10retrace
retrace_common
)
-
- install (TARGETS d3dretrace RUNTIME DESTINATION bin)
+
+ install (TARGETS d3d10retrace RUNTIME DESTINATION bin)
endif ()
+if (WIN32 AND DirectX_D3D10_1_INCLUDE_DIR)
+ add_custom_command (
+ OUTPUT d3dretrace_d3d10_1.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10_1retrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d10_1.cpp
+ DEPENDS
+ d3d10retrace.py
+ d3dcommonretrace.py
+ dllretrace.py
+ retrace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10_1.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dcommon.py
+ ${CMAKE_SOURCE_DIR}/specs/dxgi.py
+ ${CMAKE_SOURCE_DIR}/specs/dxgitype.py
+ ${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
+ ${CMAKE_SOURCE_DIR}/specs/winapi.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+
+ include_directories (SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR})
+ add_executable (d3d10_1retrace
+ d3dretrace_main.cpp
+ d3dretrace_d3d10_1.cpp
+ d3dretrace_ws.cpp
+ d3d9state.cpp
+ d3d9state_images.cpp
+ )
+ target_link_libraries (d3d10_1retrace
+ retrace_common
+ )
+
+ install (TARGETS d3d10_1retrace RUNTIME DESTINATION bin)
+endif ()
+
+if (WIN32 AND DirectX_D3D11_INCLUDE_DIR)
+ add_custom_command (
+ OUTPUT d3dretrace_d3d11.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d11retrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d11.cpp
+ DEPENDS
+ d3d11retrace.py
+ d3dcommonretrace.py
+ dllretrace.py
+ retrace.py
+ ${CMAKE_SOURCE_DIR}/dispatch/dispatch.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d11_1.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d11.py
+ ${CMAKE_SOURCE_DIR}/specs/d3d11sdklayers.py
+ ${CMAKE_SOURCE_DIR}/specs/d3dcommon.py
+ ${CMAKE_SOURCE_DIR}/specs/dxgi.py
+ ${CMAKE_SOURCE_DIR}/specs/dxgitype.py
+ ${CMAKE_SOURCE_DIR}/specs/dxgiformat.py
+ ${CMAKE_SOURCE_DIR}/specs/winapi.py
+ ${CMAKE_SOURCE_DIR}/specs/stdapi.py
+ )
+
+ include_directories (SYSTEM ${DirectX_D3D11_INCLUDE_DIR})
+ add_executable (d3d11retrace
+ d3dretrace_main.cpp
+ d3dretrace_d3d11.cpp
+ d3dretrace_ws.cpp
+ d3d9state.cpp
+ d3d9state_images.cpp
+ )
+ target_link_libraries (d3d11retrace
+ retrace_common
+ )
+
+ install (TARGETS d3d11retrace RUNTIME DESTINATION bin)
+endif ()
--- /dev/null
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+"""D3D10 retracer generator."""
+
+
+from d3dcommonretrace import D3DRetracer
+import specs.stdapi as stdapi
+from specs.d3d10_1 import d3d10_1
+
+
+if __name__ == '__main__':
+ print r'''
+#include <string.h>
+
+#include <iostream>
+
+#include "d3d10_1imports.hpp"
+#include "d3d10size.hpp"
+#include "d3dretrace.hpp"
+
+'''
+
+ retracer = D3DRetracer()
+ retracer.retraceApi(d3d10_1)
##########################################################################/
-"""D3D retracer generator."""
+"""D3D10 retracer generator."""
-from dllretrace import DllRetracer as Retracer
+from d3dcommonretrace import D3DRetracer
import specs.stdapi as stdapi
-from specs.d3d10 import *
-
-
-class D3DRetracer(Retracer):
-
- def retraceApi(self, api):
- print '// Swizzling mapping for lock addresses'
- print 'static std::map<void *, void *> _maps;'
- print
-
- self.table_name = 'd3dretrace::%s_callbacks' % api.name.lower()
-
- Retracer.retraceApi(self, api)
-
- def invokeFunction(self, function):
- # create windows as neccessary
- if function.name == 'D3D10CreateDeviceAndSwapChain':
- print r' pSwapChainDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
-
- Retracer.invokeFunction(self, function)
-
- 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 == 'CreateSwapChain':
- print r' pDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
-
- # notify frame has been completed
- if method.name == 'Present':
- print r' retrace::frameComplete(call);'
-
- if 'pSharedResource' in method.argNames():
- print r' if (pSharedResource) {'
- print r' retrace::warning(call) << "shared surfaces unsupported\n";'
- print r' pSharedResource = NULL;'
- print r' }'
-
- Retracer.invokeInterfaceMethod(self, interface, method)
-
- # process events after presents
- if method.name == 'Present':
- print r' d3dretrace::processEvents();'
-
- # check errors
- if str(method.type) == 'HRESULT':
- print r' if (FAILED(_result)) {'
- print r' retrace::warning(call) << "failed\n";'
- print r' }'
-
- if method.name == 'Map':
- print ' VOID *_pbData = NULL;'
- print ' size_t _MappedSize = 0;'
- print ' _getMapInfo(_this, %s, _pbData, _MappedSize);' % ', '.join(method.argNames())
- print ' _maps[_this] = _pbData;'
-
- if method.name == 'Unmap':
- print ' VOID *_pbData = 0;'
- print ' _pbData = _maps[_this];'
- print ' if (_pbData) {'
- print ' retrace::delRegionByPointer(_pbData);'
- print ' }'
+from specs.d3d10 import d3d10
if __name__ == '__main__':
--- /dev/null
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+"""D3D10 retracer generator."""
+
+
+from d3dcommonretrace import D3DRetracer
+import specs.stdapi as stdapi
+from specs.d3d11 import d3d11
+
+
+if __name__ == '__main__':
+ print r'''
+#include <string.h>
+
+#include <iostream>
+
+#include "d3d11imports.hpp"
+#include "d3d11size.hpp"
+#include "d3dretrace.hpp"
+
+'''
+
+ retracer = D3DRetracer()
+ retracer.retraceApi(d3d11)
print 'static std::map<void *, void *> _locks;'
print
- self.table_name = 'd3dretrace::%s_callbacks' % api.name.lower()
+ self.table_name = 'd3dretrace::d3d_callbacks'
Retracer.retraceApi(self, api)
--- /dev/null
+##########################################################################
+#
+# Copyright 2011 Jose Fonseca
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+"""D3D retracer generator."""
+
+
+from dllretrace import DllRetracer as Retracer
+import specs.stdapi as stdapi
+
+
+class D3DRetracer(Retracer):
+
+ def retraceApi(self, api):
+ print '// Swizzling mapping for lock addresses'
+ print 'static std::map<void *, void *> _maps;'
+ print
+
+ self.table_name = 'd3dretrace::d3d_callbacks'
+
+ Retracer.retraceApi(self, api)
+
+ def invokeFunction(self, function):
+ # create windows as neccessary
+ if function.name in ('D3D10CreateDeviceAndSwapChain', 'D3D10CreateDeviceAndSwapChain1', 'D3D11CreateDeviceAndSwapChain'):
+ print r' pSwapChainDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
+
+ Retracer.invokeFunction(self, function)
+
+ 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 == 'CreateSwapChain':
+ print r' pDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
+
+ # notify frame has been completed
+ if method.name == 'Present':
+ print r' retrace::frameComplete(call);'
+
+ if 'pSharedResource' in method.argNames():
+ print r' if (pSharedResource) {'
+ print r' retrace::warning(call) << "shared surfaces unsupported\n";'
+ print r' pSharedResource = NULL;'
+ print r' }'
+
+ Retracer.invokeInterfaceMethod(self, interface, method)
+
+ # process events after presents
+ if method.name == 'Present':
+ print r' d3dretrace::processEvents();'
+
+ # check errors
+ if str(method.type) == 'HRESULT':
+ print r' if (FAILED(_result)) {'
+ print r' retrace::warning(call) << "failed\n";'
+ print r' }'
+
+ if method.name == 'Map':
+ print ' VOID *_pbData = NULL;'
+ print ' size_t _MappedSize = 0;'
+ print ' _getMapInfo(_this, %s, _pbData, _MappedSize);' % ', '.join(method.argNames())
+ print ' _maps[_this] = _pbData;'
+
+ if method.name == 'Unmap':
+ print ' VOID *_pbData = 0;'
+ print ' _pbData = _maps[_this];'
+ print ' if (_pbData) {'
+ print ' retrace::delRegionByPointer(_pbData);'
+ print ' }'
extern IDirect3DDevice9 *pLastDirect3DDevice9;
-extern const retrace::Entry d3d9_callbacks[];
-extern const retrace::Entry d3d10_callbacks[];
+extern const retrace::Entry d3d_callbacks[];
HWND
void
retrace::addCallbacks(retrace::Retracer &retracer)
{
- retracer.addCallbacks(d3dretrace::d3d9_callbacks);
- retracer.addCallbacks(d3dretrace::d3d10_callbacks);
+ retracer.addCallbacks(d3dretrace::d3d_callbacks);
}
import specs.stdapi as stdapi
-import specs.glapi as glapi
class UnsupportedType(Exception):