]> git.cworth.org Git - apitrace/commitdiff
d3dretrace: Single retrace for d3d10 and higher
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Nov 2012 10:05:09 +0000 (10:05 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Nov 2012 10:16:28 +0000 (10:16 +0000)
retrace/CMakeLists.txt
retrace/d3d10_1retrace.py [deleted file]
retrace/d3d10retrace.py [deleted file]
retrace/d3d11retrace.py [deleted file]
retrace/d3dcommonretrace.py

index 0999436d98fe1fd055e14af9ecb9a8d9a3df6936..e6c8de0dfa8408132518a739da275257b2fb71d9 100644 (file)
@@ -160,15 +160,36 @@ if (WIN32 AND DirectX_D3DX9_INCLUDE_DIR)
 endif ()
 
 if (WIN32 AND DirectX_D3D10_INCLUDE_DIR)
+    include_directories (SYSTEM ${DirectX_D3D10_INCLUDE_DIR})
+    set (MODULES d3d10)
+    
+    if (DirectX_D3D10_1_INCLUDE_DIR)
+        include_directories (SYSTEM ${DirectX_D3D10_1_INCLUDE_DIR})
+        set (MODULES ${MODULES} d3d10_1)
+    endif ()
+
+    if (DirectX_D3D11_INCLUDE_DIR)
+        include_directories (SYSTEM ${DirectX_D3D11_INCLUDE_DIR})
+        set (MODULES ${MODULES} d3d11)
+    endif ()
+
+    if (DirectX_D3D11_1_INCLUDE_DIR)
+        include_directories (SYSTEM ${DirectX_D3D11_1_INCLUDE_DIR})
+        set (MODULES ${MODULES} d3d11_1)
+    endif ()
+
     add_custom_command (
         OUTPUT d3dretrace_d3d10.cpp
-        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3d10retrace.py > ${CMAKE_CURRENT_BINARY_DIR}/d3dretrace_d3d10.cpp
+        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d3dcommonretrace.py ${MODULES} > ${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/d3d11_1.py
+                ${CMAKE_SOURCE_DIR}/specs/d3d11.py
+                ${CMAKE_SOURCE_DIR}/specs/d3d11sdklayers.py
+                ${CMAKE_SOURCE_DIR}/specs/d3d10_1.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10misc.py
                 ${CMAKE_SOURCE_DIR}/specs/d3d10sdklayers.py
@@ -182,7 +203,6 @@ if (WIN32 AND DirectX_D3D10_INCLUDE_DIR)
                 ${CMAKE_SOURCE_DIR}/specs/stdapi.py
     )
 
-    include_directories (SYSTEM ${DirectX_D3D10_INCLUDE_DIR})
     add_executable (d3d10retrace
         d3dretrace_main.cpp
         d3dretrace_d3d10.cpp
@@ -194,71 +214,3 @@ if (WIN32 AND DirectX_D3D10_INCLUDE_DIR)
 
     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
-    )
-    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
-    )
-    target_link_libraries (d3d11retrace
-        retrace_common
-    )
-
-    install (TARGETS d3d11retrace RUNTIME DESTINATION bin)
-endif ()
diff --git a/retrace/d3d10_1retrace.py b/retrace/d3d10_1retrace.py
deleted file mode 100644 (file)
index 3599a9e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-##########################################################################
-#
-# 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.retraceModule(d3d10_1)
diff --git a/retrace/d3d10retrace.py b/retrace/d3d10retrace.py
deleted file mode 100644 (file)
index ccfd87e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-##########################################################################
-#
-# 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 import d3d10
-
-
-if __name__ == '__main__':
-    print r'''
-#include <string.h>
-
-#include <iostream>
-
-#include "d3d10imports.hpp"
-#include "d3d10size.hpp"
-#include "d3dretrace.hpp"
-
-'''
-
-    retracer = D3DRetracer()
-    retracer.retraceModule(d3d10)
diff --git a/retrace/d3d11retrace.py b/retrace/d3d11retrace.py
deleted file mode 100644 (file)
index 1f349a2..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-##########################################################################
-#
-# 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.retraceModule(d3d11)
index bef1d0993f1454b361a1c5a679fd5baaa7569cea..9cd5da51f579cad0011edc22e80aa7071a351862 100644 (file)
 """D3D retracer generator."""
 
 
+import sys
 from dllretrace import DllRetracer as Retracer
-import specs.stdapi as stdapi
+from specs.stdapi import API
+from specs.dxgi import dxgi
+from specs.d3d10 import d3d10
+from specs.d3d10_1 import d3d10_1
+from specs.d3d11 import d3d11
 
 
 class D3DRetracer(Retracer):
@@ -106,3 +111,42 @@ retrace::dumpState(std::ostream &os)
             print '    if (_pbData) {'
             print '        retrace::delRegionByPointer(_pbData);'
             print '    }'
+
+
+def main():
+    print r'''#include <string.h>'''
+    print
+    print r'#include <iostream>'
+    print
+    print r'#include "d3dretrace.hpp"'
+    print
+
+    moduleNames = sys.argv[1:]
+
+    api = API()
+    if moduleNames:
+        api.addModule(dxgi)
+    if 'd3d10' in moduleNames:
+        if 'd3d10_1' in moduleNames:
+            print r'#include "d3d10_1imports.hpp"'
+            # D3D10CreateBlob is duplicated in d3d10 and d3d10_1
+            d3d10_1.functions = [function for function in d3d10_1.functions if function.name != 'D3D10CreateBlob']
+            api.addModule(d3d10_1)
+        else:
+            print r'#include "d3d10imports.hpp"'
+        print r'#include "d3d10size.hpp"'
+        api.addModule(d3d10)
+    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"'
+        api.addModule(d3d11)
+
+    retracer = D3DRetracer()
+    retracer.retraceApi(api)
+
+
+if __name__ == '__main__':
+    main()