]> git.cworth.org Git - apitrace/blobdiff - wrappers/d3d9trace.py
Recognize IDirect3DSwapChain9::Present as end of frame
[apitrace] / wrappers / d3d9trace.py
index d3f2e024a0330146d35f79a2de80fd05148fbcf2..17ebe197d872a17b5dcf779dbcc0b123676861af 100644 (file)
@@ -27,6 +27,8 @@
 from dlltrace import DllTracer
 from specs.d3d9 import d3d9, D3DSHADER9
 
+import specs.d3d9dxva2
+
 
 class D3D9Tracer(DllTracer):
 
@@ -52,6 +54,12 @@ class D3D9Tracer(DllTracer):
         return variables
 
     def implementWrapperInterfaceMethodBody(self, interface, base, method):
+        if method.name == 'DecodeExecute':
+            print r'    _NumCompBuffers = pExecuteParams->NumCompBuffers;'
+
+        if method.name == 'VideoProcessBlt':
+            print r'    _NumSrcSurfaces = pData->NumSrcSurfaces;'
+
         if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'):
             print '    if (_LockedSize && m_pbData) {'
             self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', '_LockedSize')
@@ -59,20 +67,13 @@ class D3D9Tracer(DllTracer):
 
         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 '    }'
 
 
@@ -84,7 +85,8 @@ if __name__ == '__main__':
     print
     print '#include "d3d9imports.hpp"'
     print '#include "d3dsize.hpp"'
-    print '#include "d3dshader.hpp"'
+    print '#include "d3d9shader.hpp"'
+    print '#include "dxvaint.h"'
     print
     print '''
 static inline size_t
@@ -96,6 +98,9 @@ _declCount(const D3DVERTEXELEMENT9 *pVertexElements) {
     }
     return count;
 }
+
+static UINT _NumCompBuffers = 0; /* XXX */
+static UINT _NumSrcSurfaces = 0; /* XXX */
 '''
     tracer = D3D9Tracer('d3d9.dll')
     tracer.traceApi(d3d9)