From: José Fonseca Date: Sun, 11 Nov 2012 00:39:53 +0000 (+0000) Subject: d3dretrace: Eliminate differences between d3d9/d3d10. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=2b4fc3f4c1204f190f9b7b264d68912d3a49d80d d3dretrace: Eliminate differences between d3d9/d3d10. --- diff --git a/helpers/d3d9size.hpp b/helpers/d3d9size.hpp index 0041e25..69b2222 100644 --- a/helpers/d3d9size.hpp +++ b/helpers/d3d9size.hpp @@ -188,10 +188,10 @@ _getLockSize(D3DFORMAT Format, UINT Width, UINT Height, INT RowPitch, UINT Depth static inline void -_getLockInfo(IDirect3DVertexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, void ** ppbData, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DVertexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, void ** ppbData, + void * & pLockedData, size_t & MappedSize) { pLockedData = *ppbData; - LockedSize = 0; + MappedSize = 0; if (SizeToLock == 0) { D3DVERTEXBUFFER_DESC Desc; @@ -199,18 +199,18 @@ _getLockInfo(IDirect3DVertexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock if (FAILED(hr)) { return; } - LockedSize = Desc.Size; + MappedSize = Desc.Size; } else { - LockedSize = SizeToLock; + MappedSize = SizeToLock; } } static inline void -_getLockInfo(IDirect3DIndexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, void ** ppbData, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DIndexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, void ** ppbData, + void * & pLockedData, size_t & MappedSize) { pLockedData = *ppbData; - LockedSize = 0; + MappedSize = 0; if (SizeToLock == 0) { D3DINDEXBUFFER_DESC Desc; @@ -218,18 +218,18 @@ _getLockInfo(IDirect3DIndexBuffer9 *pBuffer, UINT OffsetToLock, UINT SizeToLock, if (FAILED(hr)) { return; } - LockedSize = Desc.Size; + MappedSize = Desc.Size; } else { - LockedSize = SizeToLock; + MappedSize = SizeToLock; } } static inline void -_getLockInfo(IDirect3DSurface9 *pSurface, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DSurface9 *pSurface, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect, + void * & pLockedData, size_t & MappedSize) { pLockedData = pLockedRect->pBits; - LockedSize = 0; + MappedSize = 0; HRESULT hr; @@ -249,15 +249,15 @@ _getLockInfo(IDirect3DSurface9 *pSurface, const D3DLOCKED_RECT *pLockedRect, con Height = Desc.Height; } - LockedSize = _getLockSize(Desc.Format, Width, Height, pLockedRect->Pitch); + MappedSize = _getLockSize(Desc.Format, Width, Height, pLockedRect->Pitch); } static inline void -_getLockInfo(IDirect3DTexture9 *pTexture, UINT Level, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DTexture9 *pTexture, UINT Level, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect, + void * & pLockedData, size_t & MappedSize) { pLockedData = pLockedRect->pBits; - LockedSize = 0; + MappedSize = 0; HRESULT hr; @@ -277,15 +277,15 @@ _getLockInfo(IDirect3DTexture9 *pTexture, UINT Level, const D3DLOCKED_RECT *pLoc Height = Desc.Height; } - LockedSize = _getLockSize(Desc.Format, Width, Height, pLockedRect->Pitch); + MappedSize = _getLockSize(Desc.Format, Width, Height, pLockedRect->Pitch); } static inline void -_getLockInfo(IDirect3DCubeTexture9 *pTexture, D3DCUBEMAP_FACES FaceType, UINT Level, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DCubeTexture9 *pTexture, D3DCUBEMAP_FACES FaceType, UINT Level, const D3DLOCKED_RECT *pLockedRect, const RECT *pRect, + void * & pLockedData, size_t & MappedSize) { pLockedData = pLockedRect->pBits; - LockedSize = 0; + MappedSize = 0; HRESULT hr; @@ -307,15 +307,15 @@ _getLockInfo(IDirect3DCubeTexture9 *pTexture, D3DCUBEMAP_FACES FaceType, UINT Le Height = Desc.Height; } - LockedSize = _getLockSize(Desc.Format, Width, Height, pLockedRect->Pitch); + MappedSize = _getLockSize(Desc.Format, Width, Height, pLockedRect->Pitch); } static inline void -_getLockInfo(IDirect3DVolume9 *pVolume, const D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DVolume9 *pVolume, const D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, + void * & pLockedData, size_t & MappedSize) { pLockedData = pLockedVolume->pBits; - LockedSize = 0; + MappedSize = 0; HRESULT hr; @@ -338,15 +338,15 @@ _getLockInfo(IDirect3DVolume9 *pVolume, const D3DLOCKED_BOX *pLockedVolume, cons Depth = Desc.Depth; } - LockedSize = _getLockSize(Desc.Format, Width, Height, pLockedVolume->RowPitch, Depth, pLockedVolume->SlicePitch); + MappedSize = _getLockSize(Desc.Format, Width, Height, pLockedVolume->RowPitch, Depth, pLockedVolume->SlicePitch); } static inline void -_getLockInfo(IDirect3DVolumeTexture9 *pTexture, UINT Level, const D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, - void * & pLockedData, size_t & LockedSize) { +_getMapInfo(IDirect3DVolumeTexture9 *pTexture, UINT Level, const D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, + void * & pLockedData, size_t & MappedSize) { pLockedData = pLockedVolume->pBits; - LockedSize = 0; + MappedSize = 0; HRESULT hr; @@ -369,7 +369,7 @@ _getLockInfo(IDirect3DVolumeTexture9 *pTexture, UINT Level, const D3DLOCKED_BOX Depth = Desc.Depth; } - LockedSize = _getLockSize(Desc.Format, Width, Height, pLockedVolume->RowPitch, Depth, pLockedVolume->SlicePitch); + MappedSize = _getLockSize(Desc.Format, Width, Height, pLockedVolume->RowPitch, Depth, pLockedVolume->SlicePitch); } diff --git a/retrace/d3d9retrace.py b/retrace/d3d9retrace.py index c175705..fd265ca 100644 --- a/retrace/d3d9retrace.py +++ b/retrace/d3d9retrace.py @@ -36,7 +36,7 @@ class D3DRetracer(Retracer): def retraceModule(self, api): print '// Swizzling mapping for lock addresses' - print 'static std::map _locks;' + print 'static std::map _maps;' print self.table_name = 'd3dretrace::d3d_callbacks' @@ -99,13 +99,13 @@ class D3DRetracer(Retracer): if method.name in ('Lock', 'LockRect', 'LockBox'): print ' VOID *_pbData = NULL;' - print ' size_t _LockedSize = 0;' - print ' _getLockInfo(_this, %s, _pbData, _LockedSize);' % ', '.join(method.argNames()[:-1]) - print ' _locks[_this] = _pbData;' + print ' size_t _MappedSize = 0;' + print ' _getMapInfo(_this, %s, _pbData, _MappedSize);' % ', '.join(method.argNames()[:-1]) + print ' _maps[_this] = _pbData;' if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'): print ' VOID *_pbData = 0;' - print ' _pbData = _locks[_this];' + print ' _pbData = _maps[_this];' print ' if (_pbData) {' print ' retrace::delRegionByPointer(_pbData);' print ' }' diff --git a/specs/d3d9.py b/specs/d3d9.py index c3f2800..a3b40d1 100644 --- a/specs/d3d9.py +++ b/specs/d3d9.py @@ -347,13 +347,13 @@ IDirect3DCubeTexture9.methods += [ ] IDirect3DVertexBuffer9.methods += [ - StdMethod(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(LinearPointer(Void, "_LockedSize")), "ppbData"), (D3DLOCK, "Flags")]), + StdMethod(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(LinearPointer(Void, "_MappedSize")), "ppbData"), (D3DLOCK, "Flags")]), StdMethod(HRESULT, "Unlock", []), StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3DVERTEXBUFFER_DESC), "pDesc")], sideeffects=False), ] IDirect3DIndexBuffer9.methods += [ - StdMethod(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(LinearPointer(Void, "_LockedSize")), "ppbData"), (D3DLOCK, "Flags")]), + StdMethod(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(LinearPointer(Void, "_MappedSize")), "ppbData"), (D3DLOCK, "Flags")]), StdMethod(HRESULT, "Unlock", []), StdMethod(HRESULT, "GetDesc", [Out(Pointer(D3DINDEXBUFFER_DESC), "pDesc")], sideeffects=False), ] diff --git a/specs/d3d9types.py b/specs/d3d9types.py index 279d6d3..41b6890 100644 --- a/specs/d3d9types.py +++ b/specs/d3d9types.py @@ -929,7 +929,7 @@ D3DVOLUME_DESC = Struct("D3DVOLUME_DESC", [ D3DLOCKED_RECT = Struct("D3DLOCKED_RECT", [ (INT, "Pitch"), - (LinearPointer(Void, "_LockedSize"), "pBits"), + (LinearPointer(Void, "_MappedSize"), "pBits"), ]) D3DBOX = Struct("D3DBOX", [ @@ -944,7 +944,7 @@ D3DBOX = Struct("D3DBOX", [ D3DLOCKED_BOX = Struct("D3DLOCKED_BOX", [ (INT, "RowPitch"), (INT, "SlicePitch"), - (LinearPointer(Void, "_LockedSize"), "pBits"), + (LinearPointer(Void, "_MappedSize"), "pBits"), ]) D3DRANGE = Struct("D3DRANGE", [ diff --git a/wrappers/d3d9trace.py b/wrappers/d3d9trace.py index cec045e..c1cadb6 100644 --- a/wrappers/d3d9trace.py +++ b/wrappers/d3d9trace.py @@ -48,7 +48,7 @@ class D3D9Tracer(DllTracer): interface.getMethodByName('LockRect') is not None or \ interface.getMethodByName('LockBox') is not None: variables += [ - ('size_t', '_LockedSize', '0'), + ('size_t', '_MappedSize', '0'), ('VOID *', 'm_pbData', '0'), ] @@ -56,8 +56,8 @@ class D3D9Tracer(DllTracer): def implementWrapperInterfaceMethodBody(self, interface, base, method): if method.name in ('Unlock', 'UnlockRect', 'UnlockBox'): - print ' if (_LockedSize && m_pbData) {' - self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', '_LockedSize') + print ' if (_MappedSize && m_pbData) {' + self.emit_memcpy('(LPBYTE)m_pbData', '(LPBYTE)m_pbData', '_MappedSize') print ' }' DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method) @@ -65,10 +65,10 @@ class D3D9Tracer(DllTracer): if method.name in ('Lock', 'LockRect', 'LockBox'): # FIXME: handle recursive locks print ' if (SUCCEEDED(_result) && !(Flags & D3DLOCK_READONLY)) {' - print ' _getLockInfo(_this, %s, m_pbData, _LockedSize);' % ', '.join(method.argNames()[:-1]) + print ' _getMapInfo(_this, %s, m_pbData, _MappedSize);' % ', '.join(method.argNames()[:-1]) print ' } else {' print ' m_pbData = NULL;' - print ' _LockedSize = 0;' + print ' _MappedSize = 0;' print ' }'