d3d9trace.cpp
ddrawtrace.cpp
dlltrace.cpp
-dwritetrace.cpp
egltrace.cpp
gltrace.cpp
glxtrace.cpp
${CMAKE_SOURCE_DIR}/specs/winapi.py
${CMAKE_SOURCE_DIR}/specs/stdapi.py
)
- add_library (d2d1 MODULE d2d1.def d2d1trace.cpp)
+ add_library (d2d1 SHARED d2d1.def d2d1trace.cpp)
target_link_libraries (d2d1
common_trace
common
PROPERTIES PREFIX ""
OUTPUT_NAME d2d1
)
- install (TARGETS d2d1 LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR})
-
- add_custom_command (
- OUTPUT dwritetrace.cpp
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dwritetrace.py > ${CMAKE_CURRENT_BINARY_DIR}/dwritetrace.cpp
- DEPENDS
- dwritetrace.py
- trace.py
- ${CMAKE_SOURCE_DIR}/specs/d2d1.py
- ${CMAKE_SOURCE_DIR}/specs/d2d1.py
- ${CMAKE_SOURCE_DIR}/specs/d2dbasetypes.py
- ${CMAKE_SOURCE_DIR}/specs/d2derr.py
- ${CMAKE_SOURCE_DIR}/specs/dwrite.py
- ${CMAKE_SOURCE_DIR}/specs/dcommon.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
- )
- add_library (dwrite MODULE dwrite.def dwritetrace.cpp)
- target_link_libraries (dwrite
- common_trace
- common
- ${ZLIB_LIBRARIES}
- ${SNAPPY_LIBRARIES}
+ # http://www.cmake.org/pipermail/cmake/2009-March/028221.html
+ install (TARGETS d2d1
+ RUNTIME DESTINATION ${WRAPPER_INSTALL_DIR} COMPONENT RUNTIME
+ LIBRARY DESTINATION ${WRAPPER_INSTALL_DIR} COMPONENT RUNTIME
)
+
+ # dwrite.dll is just an empty stub for d2d1.dll
+ add_library (dwrite MODULE dwrite.def)
+ target_link_libraries (dwrite d2d1)
set_target_properties (dwrite
PROPERTIES PREFIX ""
OUTPUT_NAME dwrite
D2D1IsMatrixInvertible
D2D1MakeRotateMatrix
D2D1MakeSkewMatrix
+
+ DWriteCreateFactory
from dlltrace import DllTracer
+from specs.stdapi import API
+from specs.dwrite import dwrite
from specs.d2d1 import d2d1
print '#include "trace_writer_local.hpp"'
print '#include "os.hpp"'
print
+ print '#define DWRITE_EXPORT WINAPI'
+ print
print '#include "d2dimports.hpp"'
print
- tracer = DllTracer('d2d1.dll')
- tracer.traceModule(d2d1)
+ api = API()
+ api.addModule(d2d1)
+ api.addModule(dwrite)
+ tracer = DllTracer()
+ tracer.traceApi(api)
from d3dcommontrace import D3DCommonTracer
+from specs.stdapi import API
from specs.d3d10_1 import d3d10_1
print '#include "d3dcommonshader.hpp"'
print '#include "d3d10size.hpp"'
print
- tracer = D3DCommonTracer('d3d10_1.dll')
- tracer.traceModule(d3d10_1)
+
+ api = API()
+ api.addModule(d3d10_1)
+ tracer = D3DCommonTracer()
+ tracer.traceApi(api)
from d3dcommontrace import D3DCommonTracer
+from specs.stdapi import API
from specs.d3d10misc import d3d10
print '#include "d3dcommonshader.hpp"'
print '#include "d3d10size.hpp"'
print
- tracer = D3DCommonTracer('d3d10.dll')
- tracer.traceModule(d3d10)
+
+ api = API()
+ api.addModule(d3d10)
+ tracer = D3DCommonTracer()
+ tracer.traceApi(api)
import sys
from d3dcommontrace import D3DCommonTracer
+from specs.stdapi import API
from specs.d3d11 import d3d11
print '#include "d3dcommonshader.hpp"'
print '#include "d3d11size.hpp"'
print
- tracer = D3DCommonTracer('d3d11.dll')
- tracer.traceModule(d3d11)
+
+ api = API()
+ api.addModule(d3d11)
+ tracer = D3DCommonTracer()
+ tracer.traceApi(api)
from dlltrace import DllTracer
+from specs.stdapi import API
from specs.d3d8 import d3d8
print '#include "trace_writer_local.hpp"'
print '#include "os.hpp"'
print
- tracer = D3D8Tracer('d3d8.dll')
- tracer.traceModule(d3d8)
+
+ api = API()
+ api.addModule(d3d8)
+ tracer = D3D8Tracer()
+ tracer.traceApi(api)
from dlltrace import DllTracer
+from specs.stdapi import API
from specs.d3d9 import d3d9, D3DSHADER9
import specs.d3d9dxva2
return count;
}
'''
- tracer = D3D9Tracer('d3d9.dll')
- tracer.traceModule(d3d9)
+ api = API()
+ api.addModule(d3d9)
+ tracer = D3D9Tracer()
+ tracer.traceApi(api)
from dlltrace import DllTracer
+from specs.stdapi import API
from specs.d3d import ddraw, interfaces
print '#include "trace_writer_local.hpp"'
print '#include "os.hpp"'
print
- tracer = DllTracer('ddraw.dll')
- tracer.traceModule(ddraw)
+
+ api = API()
+ api.addModule(ddraw)
+ tracer = DllTracer()
+ tracer.traceApi(api)
"""Trace code generation for Windows DLLs."""
+import ntpath
+
from trace import Tracer
from dispatch import Dispatcher
from specs.stdapi import API
-class DllTracer(Tracer):
+class DllDispatcher(Dispatcher):
- def __init__(self, dllname):
- self.dllname = dllname
-
- def header(self, api):
- print '''
-static HMODULE g_hDll = NULL;
+ def dispatchModule(self, module):
+ tag = module.name.upper()
+ print r'HMODULE g_h%sModule = NULL;' % (tag,)
+ print r''
+ print r'static PROC'
+ print r'_get%sProcAddress(LPCSTR lpProcName) {' % tag
+ print r' if (!g_h%sModule) {' % tag
+ print r' char szDll[MAX_PATH] = {0};'
+ print r' if (!GetSystemDirectoryA(szDll, MAX_PATH)) {'
+ print r' return NULL;'
+ print r' }'
+ print r' strcat(szDll, "\\\\%s.dll");' % module.name
+ print r' g_h%sModule = LoadLibraryA(szDll);' % tag
+ print r' if (!g_h%sModule) {' % tag
+ print r' return NULL;'
+ print r' }'
+ print r' }'
+ print r' return GetProcAddress(g_h%sModule, lpProcName);' % tag
+ print r'}'
+ print r''
-static PROC
-_getPublicProcAddress(LPCSTR lpProcName)
-{
- if (!g_hDll) {
- char szDll[MAX_PATH] = {0};
-
- if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
- return NULL;
- }
-
- strcat(szDll, "\\\\%s");
-
- g_hDll = LoadLibraryA(szDll);
- if (!g_hDll) {
- return NULL;
- }
- }
-
- return GetProcAddress(g_hDll, lpProcName);
-}
+ Dispatcher.dispatchModule(self, module)
-''' % self.dllname
+ def getProcAddressName(self, module, function):
+ assert self.isFunctionPublic(module, function)
+ return '_get%sProcAddress' % (module.name.upper())
+
+
+class DllTracer(Tracer):
+
+ def header(self, api):
for module in api.modules:
- dispatcher = Dispatcher()
+ dispatcher = DllDispatcher()
dispatcher.dispatchModule(module)
Tracer.header(self, api)
-
- def traceModule(self, module):
- api = API()
- api.addModule(module)
- self.traceApi(api)
+++ /dev/null
-##########################################################################
-#
-# Copyright 2008-2009 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.
-#
-##########################################################################/
-
-
-from dlltrace import DllTracer
-from specs.dwrite import dwrite
-from specs.d2d1 import d2d1 # cyclic dependency
-
-
-if __name__ == '__main__':
- print '#define INITGUID'
- print
- print '#include "trace_writer_local.hpp"'
- print '#include "os.hpp"'
- print
- print '#define DWRITE_EXPORT WINAPI'
- print
- print '#include "d2dimports.hpp"'
- print
-
- tracer = DllTracer('dwrite.dll')
- tracer.traceModule(dwrite)