]> git.cworth.org Git - apitrace/blobdiff - retrace/d3dretrace.py
Trace LockBox blobs.
[apitrace] / retrace / d3dretrace.py
index c3bec0e7ba2eee31b8bbe07e43b1a873f5ae20ad..14ce35934366dbde3147a274b1224cd4fdf14af4 100644 (file)
@@ -60,34 +60,8 @@ class D3DRetracer(Retracer):
             print r'        retrace::warning(call) << "failed\n";'
             print r'    }'
 
-        if interface.name in self.bufferInterfaceNames and method.name == 'Lock' or \
-           interface.name == 'IDirect3DSurface9' and method.name == 'LockRect':
-            getDescMethod = interface.getMethodByName('GetDesc')
-            descArg = getDescMethod.args[0]
-            assert descArg.output
-            descType = getDescMethod.args[0].type.type
-
-            if interface.name in self.bufferInterfaceNames:
-                print '        if (!SizeToLock) {'
-                print '            %s Desc;' % descType
-                print '            _this->GetDesc(&Desc);'
-                print '            SizeToLock = Desc.Size;'
-                print '        }'
-            elif interface.name == 'IDirect3DSurface9':
-                print '        UINT Width;'
-                print '        UINT Height;'
-                print '        if (pRect) {'
-                print '            Width  = pRect->right  - pRect->left;'
-                print '            Height = pRect->bottom - pRect->top;'
-                print '        } else {'
-                print '            %s Desc;' % descType
-                print '            _this->GetDesc(&Desc);'
-                print '            Width  = Desc.Width;'
-                print '            Height = Desc.Height;'
-                print '        }'
-                print '        UINT m_SizeToLock = Height * pLockedRect->Pitch;'
-                # TODO: take in consideration the width and pixels and blocks
-                print '        (void)Width;'
+        if method.name in ('Lock', 'LockRect', 'LockBox'):
+            print '        size_t _LockedSize = _getLockSize(_this, %s);' % ', '.join(method.argNames()[:-1])
 
 
 if __name__ == '__main__':
@@ -97,6 +71,7 @@ if __name__ == '__main__':
 #include <iostream>
 
 #include "d3d9imports.hpp"
+#include "d3dsize.hpp"
 #include "d3dretrace.hpp"
 
 
@@ -226,7 +201,7 @@ found:
         HRESULT hr;
 
         hr = pfnD3DXAssembleShader(pSrcData, strlen(pSrcData), NULL, NULL, 0, &pTokens, NULL);
-        if (hr == D3D_OK) {
+        if (SUCCEEDED(hr)) {
             return (DWORD *)pTokens->GetBufferPointer();
         }