From fbbb1e2ca5f554f0fcf8863367f55da5281b9c6b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 30 Apr 2012 16:51:08 +0100 Subject: [PATCH 1/1] Eliminate dependency on D3DX10/D3DX11. Given that it's being deprecated. --- dispatch/d3d10_1imports.hpp | 43 +++++++++++++++++++++++++ dispatch/d3d10imports.hpp | 43 +++++++++++++++++++++++++ dispatch/d3d11imports.hpp | 43 +++++++++++++++++++++++++ dispatch/d3derr.hpp | 63 +++++++++++++++++++++++++++++++++++++ wrappers/CMakeLists.txt | 10 +++--- wrappers/d3d10_1trace.py | 7 +---- wrappers/d3d10trace.py | 7 +---- wrappers/d3d11trace.py | 8 ++--- 8 files changed, 201 insertions(+), 23 deletions(-) create mode 100644 dispatch/d3d10_1imports.hpp create mode 100644 dispatch/d3d10imports.hpp create mode 100644 dispatch/d3d11imports.hpp create mode 100644 dispatch/d3derr.hpp diff --git a/dispatch/d3d10_1imports.hpp b/dispatch/d3d10_1imports.hpp new file mode 100644 index 0000000..254323e --- /dev/null +++ b/dispatch/d3d10_1imports.hpp @@ -0,0 +1,43 @@ +/************************************************************************** + * + * 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 includes, and respective OS dependent headers. + */ + +#ifndef _D3D10_1IMPORTS_HPP_ +#define _D3D10_1IMPORTS_HPP_ + + +#include + +#include "compat.h" + +#include + +#include "d3derr.hpp" + + +#endif /* _D3D10_1IMPORTS_HPP_ */ diff --git a/dispatch/d3d10imports.hpp b/dispatch/d3d10imports.hpp new file mode 100644 index 0000000..d21aec8 --- /dev/null +++ b/dispatch/d3d10imports.hpp @@ -0,0 +1,43 @@ +/************************************************************************** + * + * 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 includes, and respective OS dependent headers. + */ + +#ifndef _D3D10IMPORTS_HPP_ +#define _D3D10IMPORTS_HPP_ + + +#include + +#include "compat.h" + +#include + +#include "d3derr.hpp" + + +#endif /* _D3D10IMPORTS_HPP_ */ diff --git a/dispatch/d3d11imports.hpp b/dispatch/d3d11imports.hpp new file mode 100644 index 0000000..eabcaf1 --- /dev/null +++ b/dispatch/d3d11imports.hpp @@ -0,0 +1,43 @@ +/************************************************************************** + * + * 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 D3D11 includes, and respective OS dependent headers. + */ + +#ifndef _D3D11IMPORTS_HPP_ +#define _D3D11IMPORTS_HPP_ + + +#include + +#include "compat.h" + +#include + +#include "d3derr.hpp" + + +#endif /* _D3D11IMPORTS_HPP_ */ diff --git a/dispatch/d3derr.hpp b/dispatch/d3derr.hpp new file mode 100644 index 0000000..39a3e9c --- /dev/null +++ b/dispatch/d3derr.hpp @@ -0,0 +1,63 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +/* + * D3DERR return codes. + * + * These were defined in d3dx10.h/d3dx11.h on DirectX SDK, and moved to + * winerror.h on Windows 8 SDK. + * + * See also: + * - http://msdn.microsoft.com/en-us/library/windows/desktop/ff476174.aspx + * - http://msdn.microsoft.com/en-us/library/windows/desktop/bb205278.aspx + * - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172554.aspx + */ + +#ifndef _D3DERR_HPP_ +#define _D3DERR_HPP_ + + +#ifndef _FACD3D +#define _FACD3D 0x876 +#endif + +#ifndef MAKE_D3DHRESULT +#define MAKE_D3DHRESULT(code) MAKE_HRESULT(1, _FACD3D, code) +#endif + +#ifndef MAKE_D3DSTATUS +#define MAKE_D3DSTATUS(code) MAKE_HRESULT(0, _FACD3D, code) +#endif + +#ifndef D3DERR_INVALIDCALL +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#endif + +#ifndef D3DERR_WASSTILLDRAWING +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) +#endif + + +#endif /* _D3DERR_HPP_ */ diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index 59bc2dc..602932b 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -108,8 +108,8 @@ if (WIN32) endif () # d3d10.dll - if (DirectX_D3DX10_INCLUDE_DIR) - include_directories (SYSTEM ${DirectX_D3DX10_INCLUDE_DIR}) + if (DirectX_D3D10_INCLUDE_DIR) + include_directories (SYSTEM ${DirectX_D3D10_INCLUDE_DIR}) add_custom_command ( OUTPUT d3d10trace.cpp COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3d10trace.cpp @@ -142,7 +142,7 @@ if (WIN32) endif () # d3d10_1.dll - if (DirectX_D3DX10_INCLUDE_DIR AND DirectX_D3D10_1_INCLUDE_DIR) + if (DirectX_D3D10_1_INCLUDE_DIR) include_directories (SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR}) add_custom_command ( OUTPUT d3d10_1trace.cpp @@ -176,14 +176,14 @@ if (WIN32) endif () # d3d11.dll - if (DirectX_D3DX11_INCLUDE_DIR) + if (DirectX_D3D11_INCLUDE_DIR) if (DirectX_D3D11_1_INCLUDE_DIR) set (HAVE_D3D11_1 1) else () set (HAVE_D3D11_1 0) endif () - include_directories (SYSTEM ${DirectX_D3DX11_INCLUDE_DIR}) + include_directories (SYSTEM ${DirectX_D3D11_INCLUDE_DIR}) add_custom_command ( OUTPUT d3d11trace.cpp COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d11trace.py ${HAVE_D3D11_1} > ${CMAKE_CURRENT_BINARY_DIR}/d3d11trace.cpp diff --git a/wrappers/d3d10_1trace.py b/wrappers/d3d10_1trace.py index fb84835..485ec32 100644 --- a/wrappers/d3d10_1trace.py +++ b/wrappers/d3d10_1trace.py @@ -34,12 +34,7 @@ if __name__ == '__main__': print '#include "trace_writer_local.hpp"' print '#include "os.hpp"' print - print '#include ' - print - print '#include "compat.h"' - print - print '#include ' - print '#include ' + print '#include "d3d10_1imports.hpp"' print tracer = DllTracer('d3d10_1.dll') tracer.traceApi(d3d10_1) diff --git a/wrappers/d3d10trace.py b/wrappers/d3d10trace.py index d13f65d..3529d58 100644 --- a/wrappers/d3d10trace.py +++ b/wrappers/d3d10trace.py @@ -34,12 +34,7 @@ if __name__ == '__main__': print '#include "trace_writer_local.hpp"' print '#include "os.hpp"' print - print '#include ' - print - print '#include "compat.h"' - print - print '#include ' - print '#include ' + print '#include "d3d10imports.hpp"' print tracer = DllTracer('d3d10.dll') tracer.traceApi(d3d10) diff --git a/wrappers/d3d11trace.py b/wrappers/d3d11trace.py index ceafdcc..80e855f 100644 --- a/wrappers/d3d11trace.py +++ b/wrappers/d3d11trace.py @@ -36,17 +36,13 @@ if __name__ == '__main__': print '#include "trace_writer_local.hpp"' print '#include "os.hpp"' print - print '#include ' + print '#include "d3d11imports.hpp"' print - print '#include "compat.h"' - print - print '#include ' if int(sys.argv[1]): import specs.d3d11_1 print '#include ' + print - print '#include ' - print tracer = DllTracer('d3d11.dll') tracer.traceApi(d3d11) -- 2.43.0