]> git.cworth.org Git - apitrace/blobdiff - wrappers/d3d9trace.py
d3d1x: Rename d3d10shader -> d3dcommonshader.
[apitrace] / wrappers / d3d9trace.py
index 9185f038e6a63e5d8a6cd96f7881ffd7c4878805..fc6e65ef2ae86982df2f74f340aea5dfda51e799 100644 (file)
@@ -27,6 +27,8 @@
 from dlltrace import DllTracer
 from specs.d3d9 import d3d9, D3DSHADER9
 
+import specs.d3d9dxva2
+
 
 class D3D9Tracer(DllTracer):
 
@@ -41,6 +43,7 @@ class D3D9Tracer(DllTracer):
     def enumWrapperInterfaceVariables(self, interface):
         variables = DllTracer.enumWrapperInterfaceVariables(self, interface)
         
+        # Add additional members to track locks
         if interface.getMethodByName('Lock') is not None or \
            interface.getMethodByName('LockRect') is not None or \
            interface.getMethodByName('LockBox') is not None:
@@ -53,26 +56,19 @@ class D3D9Tracer(DllTracer):
 
     def implementWrapperInterfaceMethodBody(self, interface, base, method):
         if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'):
-            print '    if (m_pbData) {'
+            print '    if (_LockedSize && m_pbData) {'
             self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', '_LockedSize')
             print '    }'
 
         DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method)
 
-        if method.name in ('Lock', 'LockRect', 'LockedBox'):
+        if method.name in ('Lock', 'LockRect', 'LockBox'):
+            # FIXME: handle recursive locks
             print '    if (SUCCEEDED(_result) && !(Flags & D3DLOCK_READONLY)) {'
-            print '        _LockedSize = _getLockSize(_this, %s);' % ', '.join(method.argNames()[:-1])
-            if method.name == 'Lock':
-                # FIXME: handle recursive locks
-                print '        m_pbData = *ppbData;'
-            elif method.name == 'LockRect':
-                print '        m_pbData = pLockedRect->pBits;'
-            elif method.name == 'LockBox':
-                print '        m_pbData = pLockedBox->pBits;'
-            else:
-                raise NotImplementedError
+            print '        _getLockInfo(_this, %s, m_pbData, _LockedSize);' % ', '.join(method.argNames()[:-1])
             print '    } else {'
             print '        m_pbData = NULL;'
+            print '        _LockedSize = 0;'
             print '    }'
 
 
@@ -83,8 +79,9 @@ if __name__ == '__main__':
     print '#include "os.hpp"'
     print
     print '#include "d3d9imports.hpp"'
-    print '#include "d3dsize.hpp"'
-    print '#include "d3dshader.hpp"'
+    print '#include "d3d9size.hpp"'
+    print '#include "d3d9shader.hpp"'
+    print '#include "dxvaint.h"'
     print
     print '''
 static inline size_t