diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-06-13 12:47:19 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-06-13 12:47:19 +0100 |
commit | fc58d05df877d0830452004bcea7f46a684eb022 (patch) | |
tree | 0a94c836d62f9db5b02827e00b4190000c642383 | |
parent | d1819f6bda486bd9d4f1c553a7e149370b56e8f4 (diff) |
dxgitrace/retrace: Require D3D11.1 headers to support D3D10 and higher.
Simplifies build substantially.
-rw-r--r-- | dispatch/compat.h | 3 | ||||
-rw-r--r-- | dispatch/d3d10_1imports.hpp | 48 | ||||
-rw-r--r-- | dispatch/d3d10imports.hpp | 14 | ||||
-rw-r--r-- | dispatch/d3d11imports.hpp | 19 | ||||
-rw-r--r-- | retrace/CMakeLists.txt | 30 | ||||
-rwxr-xr-x | retrace/dxgiretrace.py | 30 | ||||
-rw-r--r-- | retrace/dxgistate.cpp | 6 | ||||
-rw-r--r-- | specs/d3d11.py | 3 | ||||
-rw-r--r-- | wrappers/CMakeLists.txt | 76 | ||||
-rw-r--r-- | wrappers/dxgitrace.py | 39 |
10 files changed, 91 insertions, 177 deletions
diff --git a/dispatch/compat.h b/dispatch/compat.h index 2f5a9a49..33819896 100644 --- a/dispatch/compat.h +++ b/dispatch/compat.h @@ -30,6 +30,9 @@ #ifdef __MINGW32__ +#include <windows.h> + + /* * Several of the defines below clash with libstdc++ internal variables, * so include the headers now, before they are re-defined. diff --git a/dispatch/d3d10_1imports.hpp b/dispatch/d3d10_1imports.hpp deleted file mode 100644 index 2b97cf3c..00000000 --- a/dispatch/d3d10_1imports.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************** - * - * Copyright 2012 VMware, Inc. - * 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. - * - **************************************************************************/ - -/* - * Central place for all D3D10.1 includes, and respective OS dependent headers. - */ - -#ifndef _D3D10_1IMPORTS_HPP_ -#define _D3D10_1IMPORTS_HPP_ - - -#include <windows.h> - -#include "compat.h" - -#include <d3d10_1.h> - -#include "d3derr.hpp" - -#include "dxgiint.h" - -#define D3D10_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY 0x0080 -#define D3D10_CREATE_DEVICE_STRICT_VALIDATION 0x0200 -#define D3D10_CREATE_DEVICE_DEBUGGABLE 0x0400 - -#endif /* _D3D10_1IMPORTS_HPP_ */ diff --git a/dispatch/d3d10imports.hpp b/dispatch/d3d10imports.hpp index 04d4119d..72118434 100644 --- a/dispatch/d3d10imports.hpp +++ b/dispatch/d3d10imports.hpp @@ -35,14 +35,20 @@ #include "compat.h" -#include <d3d10.h> +#include <d3d10_1.h> #include "d3derr.hpp" #include "dxgiint.h" -#define D3D10_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY 0x0080 -#define D3D10_CREATE_DEVICE_STRICT_VALIDATION 0x0200 -#define D3D10_CREATE_DEVICE_DEBUGGABLE 0x0400 + +#ifndef D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS +#define D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D10_HRESULT(1) +#endif + +#ifndef D3D10_ERROR_FILE_NOT_FOUND +#define D3D10_ERROR_FILE_NOT_FOUND MAKE_D3D10_HRESULT(2) +#endif + #endif /* _D3D10IMPORTS_HPP_ */ diff --git a/dispatch/d3d11imports.hpp b/dispatch/d3d11imports.hpp index b667bf85..05ddef9c 100644 --- a/dispatch/d3d11imports.hpp +++ b/dispatch/d3d11imports.hpp @@ -35,11 +35,28 @@ #include "compat.h" -#include <d3d11.h> +#include <d3d11_1.h> #include "d3derr.hpp" #include "dxgiint.h" +#ifndef D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS +#define D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D11_HRESULT(1) +#endif + +#ifndef D3D11_ERROR_FILE_NOT_FOUND +#define D3D11_ERROR_FILE_NOT_FOUND MAKE_D3D11_HRESULT(2) +#endif + +#ifndef D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS +#define D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS MAKE_D3D11_HRESULT(3) +#endif + +#ifndef D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD +#define D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD MAKE_D3D11_HRESULT(4) +#endif + + #endif /* _D3D11IMPORTS_HPP_ */ diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt index 0a7ed5e8..0fd15357 100644 --- a/retrace/CMakeLists.txt +++ b/retrace/CMakeLists.txt @@ -220,32 +220,16 @@ if (WIN32) ${CMAKE_SOURCE_DIR}/specs/stdapi.py ) - if (DirectX_D3D10_INCLUDE_DIR) - include_directories (BEFORE SYSTEM ${DirectX_D3D10_INCLUDE_DIR}) - set (DXGI_MODULES d3d10) - if (DirectX_D3D10_1_INCLUDE_DIR) - include_directories (BEFORE SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR}) - set (DXGI_MODULES ${DXGI_MODULES} d3d10_1) - endif () + if (DirectX_D3D11_1_INCLUDE_DIR) + include_directories (BEFORE + ${DirectX_D3D11_1_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/thirdparty/directxtex/DirectXTex + ) + set (DXGI_MODULES d3d10 d3d10_1 d3d11 d3d11_1) set (D3DSTATE_SOURCES ${D3DSTATE_SOURCES} dxgistate.cpp d3d10state.cpp d3d10state_images.cpp - ) - endif () - - if (DirectX_D3D11_INCLUDE_DIR) - add_definitions (-DHAVE_D3D11) - include_directories (BEFORE SYSTEM - ${DirectX_D3D11_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/thirdparty/directxtex/DirectXTex - ) - set (DXGI_MODULES ${DXGI_MODULES} d3d11) - if (DirectX_D3D11_1_INCLUDE_DIR) - include_directories (BEFORE SYSTEM ${DirectX_D3D11_1_INCLUDE_DIR}) - set (DXGI_MODULES ${DXGI_MODULES} d3d11_1) - endif () - set (D3DSTATE_SOURCES ${D3DSTATE_SOURCES} d3d11state.cpp d3d11state_images.cpp ) @@ -289,7 +273,7 @@ if (WIN32) retrace_common d3dhelpers ) - if (DirectX_D3D11_INCLUDE_DIR) + if (DirectX_D3D11_1_INCLUDE_DIR) target_link_libraries (d3dretrace directxtex) endif () diff --git a/retrace/dxgiretrace.py b/retrace/dxgiretrace.py index f3c47178..9036b052 100755 --- a/retrace/dxgiretrace.py +++ b/retrace/dxgiretrace.py @@ -360,37 +360,23 @@ def main(): if moduleNames: print r'#include "d3dretrace_dxgi.hpp"' - api.addModule(dxgi) - print - print '''static d3dretrace::D3DDumper<IDXGISwapChain> dxgiDumper;''' - print - - if 'd3d10' in moduleNames: - if 'd3d10_1' in moduleNames: - print r'#include "d3d10_1imports.hpp"' - api.addModule(d3d10_1) - else: - print r'#include "d3d10imports.hpp"' + print r'#include "d3d10imports.hpp"' print r'#include "d3d10size.hpp"' print r'#include "d3d10state.hpp"' - api.addModule(d3d10) - print - print '''static d3dretrace::D3DDumper<ID3D10Device> d3d10Dumper;''' - print - - if 'd3d11' in moduleNames: print r'#include "d3d11imports.hpp"' - if 'd3d11_1' in moduleNames: - print '#include <d3d11_1.h>' - import specs.d3d11_1 print r'#include "d3d11size.hpp"' print r'#include "d3dstate.hpp"' - api.addModule(d3d11) - print + print '''static d3dretrace::D3DDumper<IDXGISwapChain> dxgiDumper;''' + print '''static d3dretrace::D3DDumper<ID3D10Device> d3d10Dumper;''' print '''static d3dretrace::D3DDumper<ID3D11DeviceContext> d3d11Dumper;''' print + api.addModule(dxgi) + api.addModule(d3d10) + api.addModule(d3d10_1) + api.addModule(d3d11) + retracer = D3DRetracer() retracer.retraceApi(api) diff --git a/retrace/dxgistate.cpp b/retrace/dxgistate.cpp index ea23ada1..51e1009c 100644 --- a/retrace/dxgistate.cpp +++ b/retrace/dxgistate.cpp @@ -34,9 +34,7 @@ #include "dxgistate.hpp" #include "d3d10state.hpp" -#ifdef HAVE_D3D11 #include "d3d11state.hpp" -#endif #ifdef __MINGW32__ #define nullptr NULL @@ -323,7 +321,6 @@ getRenderTargetImage(IDXGISwapChain *pSwapChain) return getSubResourceImage(pD3D10Device, pD3D10Resource, Format, 0, 0); } -#ifdef HAVE_D3D11 com_ptr<ID3D11Device> pD3D11Device; hr = pSwapChain->GetDevice(IID_ID3D11Device, (void **)&pD3D11Device); if (SUCCEEDED(hr)) { @@ -341,7 +338,6 @@ getRenderTargetImage(IDXGISwapChain *pSwapChain) return getSubResourceImage(pD3D11DeviceContext, pD3D11Resource, Format, 0, 0); } -#endif return NULL; } @@ -360,7 +356,6 @@ dumpDevice(std::ostream &os, IDXGISwapChain *pSwapChain) return; } -#if HAVE_D3D11 com_ptr<ID3D11Device> pD3D11Device; hr = pSwapChain->GetDevice(IID_ID3D11Device, (void **)&pD3D11Device); if (SUCCEEDED(hr)) { @@ -369,7 +364,6 @@ dumpDevice(std::ostream &os, IDXGISwapChain *pSwapChain) dumpDevice(os, pD3D11DeviceContext); return; } -#endif } // Fallback -- this should really never happen. diff --git a/specs/d3d11.py b/specs/d3d11.py index 7d1e1d77..992ce01b 100644 --- a/specs/d3d11.py +++ b/specs/d3d11.py @@ -1229,3 +1229,6 @@ d3d11.addInterfaces([ ID3D11InfoQueue, ID3D11SwitchToRef, ]) + +# Add D3D11.1 +import d3d11_1 diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index ed1757d5..46615e6f 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -121,37 +121,23 @@ if (WIN32) endif () # dxgi.dll, d3d10.dll, d3d10_1.dll, d3d11.dll - set (DXGI_MODULES) - if (DirectX_D3D10_INCLUDE_DIR) + if (DirectX_D3D11_1_INCLUDE_DIR) set (DXGITRACE_DEF ${CMAKE_CURRENT_BINARY_DIR}/dxgitrace.def) file (WRITE ${DXGITRACE_DEF} "EXPORTS\n") file (APPEND ${DXGITRACE_DEF} "CreateDXGIFactory\n") file (APPEND ${DXGITRACE_DEF} "CreateDXGIFactory1\n") file (APPEND ${DXGITRACE_DEF} "D3D10CreateDevice\n") file (APPEND ${DXGITRACE_DEF} "D3D10CreateDeviceAndSwapChain\n") + file (APPEND ${DXGITRACE_DEF} "D3D10CreateDevice1\n") + file (APPEND ${DXGITRACE_DEF} "D3D10CreateDeviceAndSwapChain1\n") + file (APPEND ${DXGITRACE_DEF} "D3D11CreateDevice\n") + file (APPEND ${DXGITRACE_DEF} "D3D11CreateDeviceAndSwapChain\n") + + include_directories (BEFORE SYSTEM ${DirectX_D3D11_1_INCLUDE_DIR}) - include_directories (BEFORE SYSTEM ${DirectX_D3D10_INCLUDE_DIR}) - set (DXGI_MODULES d3d10) - if (DirectX_D3D10_1_INCLUDE_DIR) - include_directories (BEFORE SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR}) - set (DXGI_MODULES ${DXGI_MODULES} d3d10_1) - file (APPEND ${DXGITRACE_DEF} "D3D10CreateDevice1\n") - file (APPEND ${DXGITRACE_DEF} "D3D10CreateDeviceAndSwapChain1\n") - endif () - if (DirectX_D3D11_INCLUDE_DIR) - include_directories (BEFORE SYSTEM ${DirectX_D3D11_INCLUDE_DIR}) - set (DXGI_MODULES ${DXGI_MODULES} d3d11) - if (DirectX_D3D11_1_INCLUDE_DIR) - include_directories (BEFORE SYSTEM ${DirectX_D3D11_1_INCLUDE_DIR}) - set (DXGI_MODULES ${DXGI_MODULES} d3d11_1) - endif () - file (APPEND ${DXGITRACE_DEF} "D3D11CreateDevice\n") - file (APPEND ${DXGITRACE_DEF} "D3D11CreateDeviceAndSwapChain\n") - endif () - add_custom_command ( OUTPUT dxgitrace.cpp - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dxgitrace.py ${DXGI_MODULES} > ${CMAKE_CURRENT_BINARY_DIR}/dxgitrace.cpp + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dxgitrace.py > ${CMAKE_CURRENT_BINARY_DIR}/dxgitrace.cpp DEPENDS dxgitrace.py dlltrace.py @@ -214,33 +200,29 @@ if (WIN32) install (TARGETS d3d10stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR}) # d3d10_1.dll (empty stub for dxgitrace.dll) - if (DirectX_D3D10_1_INCLUDE_DIR) - add_library (d3d10_1stubs MODULE - d3d10_1.def - d3d10stubs.cpp - ) - target_link_libraries (d3d10_1stubs dxgitrace) - set_target_properties (d3d10_1stubs - PROPERTIES PREFIX "" - OUTPUT_NAME d3d10_1 - ) - install (TARGETS d3d10_1stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR}) - endif () + add_library (d3d10_1stubs MODULE + d3d10_1.def + d3d10stubs.cpp + ) + target_link_libraries (d3d10_1stubs dxgitrace) + set_target_properties (d3d10_1stubs + PROPERTIES PREFIX "" + OUTPUT_NAME d3d10_1 + ) + install (TARGETS d3d10_1stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR}) # d3d11.dll (empty stub for dxgitrace.dll) - if (DirectX_D3D11_INCLUDE_DIR) - add_library (d3d11stubs MODULE - d3d11.def - d3d11stubs.cpp - d3dkmtstubs.cpp - ) - target_link_libraries (d3d11stubs dxgitrace) - set_target_properties (d3d11stubs - PROPERTIES PREFIX "" - OUTPUT_NAME d3d11 - ) - install (TARGETS d3d11stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR}) - endif () + add_library (d3d11stubs MODULE + d3d11.def + d3d11stubs.cpp + d3dkmtstubs.cpp + ) + target_link_libraries (d3d11stubs dxgitrace) + set_target_properties (d3d11stubs + PROPERTIES PREFIX "" + OUTPUT_NAME d3d11 + ) + install (TARGETS d3d11stubs LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR}) endif () # d2d1.dll, dwrite.dll diff --git a/wrappers/dxgitrace.py b/wrappers/dxgitrace.py index 45767a0f..5796328f 100644 --- a/wrappers/dxgitrace.py +++ b/wrappers/dxgitrace.py @@ -127,37 +127,24 @@ class D3DCommonTracer(DllTracer): if __name__ == '__main__': - print '#define INITGUID' + print r'#define INITGUID' print - print '#include "trace_writer_local.hpp"' - print '#include "os.hpp"' + print r'#include "trace_writer_local.hpp"' + print r'#include "os.hpp"' print - print '#include "d3dcommonshader.hpp"' + print r'#include "d3dcommonshader.hpp"' + print + print r'#include "d3d10imports.hpp"' + print r'#include "d3d10size.hpp"' + print r'#include "d3d11imports.hpp"' + print r'#include "d3d11size.hpp"' print - - moduleNames = sys.argv[1:] api = API() - - if moduleNames: - api.addModule(dxgi.dxgi) - - if 'd3d10' in moduleNames: - if 'd3d10_1' in moduleNames: - print r'#include "d3d10_1imports.hpp"' - api.addModule(d3d10_1.d3d10_1) - else: - print r'#include "d3d10imports.hpp"' - print r'#include "d3d10size.hpp"' - api.addModule(d3d10.d3d10) - - if 'd3d11' in moduleNames: - print r'#include "d3d11imports.hpp"' - if 'd3d11_1' in moduleNames: - print '#include <d3d11_1.h>' - from specs import d3d11_1 - print r'#include "d3d11size.hpp"' - api.addModule(d3d11.d3d11) + api.addModule(dxgi.dxgi) + api.addModule(d3d10.d3d10) + api.addModule(d3d10_1.d3d10_1) + api.addModule(d3d11.d3d11) tracer = D3DCommonTracer() tracer.traceApi(api) |