]> git.cworth.org Git - apitrace/commitdiff
Unwrap input pointers.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Mon, 7 Jul 2008 04:44:00 +0000 (13:44 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Mon, 7 Jul 2008 04:44:00 +0000 (13:44 +0900)
base.py
d3d8.py

diff --git a/base.py b/base.py
index ea0034200c47dbce729ce7836301ae8dd437d5bf..889e279f3f081a4bb904d1cd51b3c42d9640a926 100644 (file)
--- a/base.py
+++ b/base.py
@@ -14,6 +14,9 @@ class Type:
     def wrap_instance(self, instance):
         pass
 
+    def unwrap_instance(self, instance):
+        pass
+
 
 class Void(Type):
 
@@ -52,6 +55,9 @@ class Pointer(Type):
     def wrap_instance(self, instance):
         self.type.wrap_instance("*" + instance)
 
+    def unwrap_instance(self, instance):
+        self.type.wrap_instance("*" + instance)
+
 
 class Output(Type):
 
@@ -68,6 +74,12 @@ class Output(Type):
     def wrap_instance(self, instance):
         self.type.wrap_instance(instance)
 
+    def unwrap_instance(self, instance):
+        self.type.wrap_instance(instance)
+
+def OutPointer(type):
+    return Output(Pointer(type))
+
 
 class Enum(Type):
 
@@ -156,8 +168,7 @@ class Interface(Type):
         for method in self.itermethods():
             print "    " + method.prototype() + ";"
         print
-        print "private:"
-        print "    Log *m_pLog;"
+        #print "private:"
         print "    %s * m_pInstance;" % (self.name,)
         print "};"
         print
@@ -178,6 +189,9 @@ class Interface(Type):
                 print '    %s result;' % method.type
                 result = 'result = '
             print '    g_pLog->BeginCall("%s");' % (self.name + '::' + method.name)
+            for type, name in method.args:
+                if not type.isoutput():
+                    type.unwrap_instance(name)
             print '    %sm_pInstance->%s(%s);' % (result, method.name, ', '.join([str(name) for type, name in method.args]))
             print '    g_pLog->EndCall();'
             for type, name in method.args:
@@ -218,6 +232,10 @@ class WrapPointer(Pointer):
         print "    if(%s)" % instance
         print "        %s = new %s(%s);" % (instance, self.type.wrap_name(), instance)
 
+    def unwrap_instance(self, instance):
+        print "    if(%s)" % instance
+        print "        %s = static_cast<%s *>(%s)->m_pInstance;" % (instance, self.type.wrap_name(), instance)
+
 String = Intrinsic("char *", "%s")
 Int = Intrinsic("int", "%i")
 Long = Intrinsic("long", "%li")
diff --git a/d3d8.py b/d3d8.py
index a125ad481acbed5346cee4418fc6394f4a3e3465..4c4c278d00570889a0e7e7fb85d38b3f2dd1c1fc 100755 (executable)
--- a/d3d8.py
+++ b/d3d8.py
@@ -17,18 +17,18 @@ IDirect3DIndexBuffer8 = Interface("IDirect3DIndexBuffer8", IDirect3DResource8)
 IDirect3DSurface8 = Interface("IDirect3DSurface8", IUnknown)
 IDirect3DVolume8 = Interface("IDirect3DVolume8", IUnknown)
 
-PDIRECT3D8 = LPDIRECT3D8 = Pointer(IDirect3D8)
-PDIRECT3DDEVICE8 = LPDIRECT3DDEVICE8 = Pointer(IDirect3DDevice8)
-PDIRECT3DSWAPCHAIN8 = LPDIRECT3DSWAPCHAIN8 = Pointer(IDirect3DSwapChain8)
-PDIRECT3DRESOURCE8 = LPDIRECT3DRESOURCE8 = Pointer(IDirect3DResource8)
-PDIRECT3DBASETEXTURE8 = LPDIRECT3DBASETEXTURE8 = Pointer(IDirect3DBaseTexture8)
-PDIRECT3DTEXTURE8 = LPDIRECT3DTEXTURE8 = Pointer(IDirect3DTexture8)
-PDIRECT3DVOLUMETEXTURE8 = LPDIRECT3DVOLUMETEXTURE8 = Pointer(IDirect3DVolumeTexture8)
-PDIRECT3DCUBETEXTURE8 = LPDIRECT3DCUBETEXTURE8 = Pointer(IDirect3DCubeTexture8)
-PDIRECT3DVERTEXBUFFER8 = LPDIRECT3DVERTEXBUFFER8 = Pointer(IDirect3DVertexBuffer8)
-PDIRECT3DINDEXBUFFER8 = LPDIRECT3DINDEXBUFFER8 = Pointer(IDirect3DIndexBuffer8)
-PDIRECT3DSURFACE8 = LPDIRECT3DSURFACE8 = Pointer(IDirect3DSurface8)
-PDIRECT3DVOLUME8 = LPDIRECT3DVOLUME8 = Pointer(IDirect3DVolume8)
+PDIRECT3D8 = WrapPointer(IDirect3D8)
+PDIRECT3DDEVICE8 = WrapPointer(IDirect3DDevice8)
+PDIRECT3DSWAPCHAIN8 = WrapPointer(IDirect3DSwapChain8)
+PDIRECT3DRESOURCE8 = WrapPointer(IDirect3DResource8)
+PDIRECT3DBASETEXTURE8 = WrapPointer(IDirect3DBaseTexture8)
+PDIRECT3DTEXTURE8 = WrapPointer(IDirect3DTexture8)
+PDIRECT3DVOLUMETEXTURE8 = WrapPointer(IDirect3DVolumeTexture8)
+PDIRECT3DCUBETEXTURE8 = WrapPointer(IDirect3DCubeTexture8)
+PDIRECT3DVERTEXBUFFER8 = WrapPointer(IDirect3DVertexBuffer8)
+PDIRECT3DINDEXBUFFER8 = WrapPointer(IDirect3DIndexBuffer8)
+PDIRECT3DSURFACE8 = WrapPointer(IDirect3DSurface8)
+PDIRECT3DVOLUME8 = WrapPointer(IDirect3DVolume8)
 
 IDirect3D8.methods += [
        Method(HRESULT, "RegisterSoftwareDevice", [(Pointer(Void), "pInitializeFunction")]),
@@ -43,41 +43,41 @@ IDirect3D8.methods += [
        Method(HRESULT, "CheckDepthStencilMatch", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "AdapterFormat"), (D3DFORMAT, "RenderTargetFormat"), (D3DFORMAT, "DepthStencilFormat")]),
        Method(HRESULT, "GetDeviceCaps", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (Pointer(D3DCAPS8), "pCaps")]),
        Method(HMONITOR, "GetAdapterMonitor", [(UINT, "Adapter")]),
-       Method(HRESULT, "CreateDevice", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (DWORD, "BehaviorFlags"), (Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (Output(Pointer(WrapPointer(IDirect3DDevice8))), "ppReturnedDeviceInterface")]),
+       Method(HRESULT, "CreateDevice", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (DWORD, "BehaviorFlags"), (Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (OutPointer(PDIRECT3DDEVICE8), "ppReturnedDeviceInterface")]),
 ]
 
 IDirect3DDevice8.methods += [
        Method(HRESULT, "TestCooperativeLevel", []),
        Method(UINT, "GetAvailableTextureMem", []),
        Method(HRESULT, "ResourceManagerDiscardBytes", [(DWORD, "Bytes")]),
-       Method(HRESULT, "GetDirect3D", [(Pointer(Pointer(IDirect3D8)), "ppD3D8")]),
+       Method(HRESULT, "GetDirect3D", [(Pointer(PDIRECT3D8), "ppD3D8")]),
        Method(HRESULT, "GetDeviceCaps", [(Pointer(D3DCAPS8), "pCaps")]),
        Method(HRESULT, "GetDisplayMode", [(Pointer(D3DDISPLAYMODE), "pMode")]),
        Method(HRESULT, "GetCreationParameters", [(Pointer(D3DDEVICE_CREATION_PARAMETERS), "pParameters")]),
-       Method(HRESULT, "SetCursorProperties", [(UINT, "XHotSpot"), (UINT, "YHotSpot"), (Pointer(IDirect3DSurface8), "pCursorBitmap")]),
+       Method(HRESULT, "SetCursorProperties", [(UINT, "XHotSpot"), (UINT, "YHotSpot"), (PDIRECT3DSURFACE8, "pCursorBitmap")]),
        Method(Void, "SetCursorPosition", [(Int, "X"), (Int, "Y"), (DWORD, "Flags")]),
        Method(BOOL, "ShowCursor", [(BOOL, "bShow")]),
-       Method(HRESULT, "CreateAdditionalSwapChain", [(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (Pointer(Pointer(IDirect3DSwapChain8)), "pSwapChain")]),
+       Method(HRESULT, "CreateAdditionalSwapChain", [(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (OutPointer(PDIRECT3DSWAPCHAIN8), "pSwapChain")]),
        Method(HRESULT, "Reset", [(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters")]),
        Method(HRESULT, "Present", [(Pointer(Const(RECT)), "pSourceRect"), (Pointer(Const(RECT)), "pDestRect"), (HWND, "hDestWindowOverride"), (Const(Pointer(RGNDATA)), "pDirtyRegion")]),
-       Method(HRESULT, "GetBackBuffer", [(UINT, "BackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), (Pointer(Pointer(IDirect3DSurface8)), "ppBackBuffer")]),
+       Method(HRESULT, "GetBackBuffer", [(UINT, "BackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), (OutPointer(PDIRECT3DSURFACE8), "ppBackBuffer")]),
        Method(HRESULT, "GetRasterStatus", [(Pointer(D3DRASTER_STATUS), "pRasterStatus")]),
        Method(Void, "SetGammaRamp", [(DWORD, "Flags"), (Pointer(Const(D3DGAMMARAMP)), "pRamp")]),
        Method(Void, "GetGammaRamp", [(Pointer(D3DGAMMARAMP), "pRamp")]),
-       Method(HRESULT, "CreateTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (Pointer(WrapPointer(IDirect3DTexture8)), "ppTexture")]),
-       Method(HRESULT, "CreateVolumeTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Depth"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (Pointer(WrapPointer(IDirect3DVolumeTexture8)), "ppVolumeTexture")]),
-       Method(HRESULT, "CreateCubeTexture", [(UINT, "EdgeLength"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (Pointer(Pointer(IDirect3DCubeTexture8)), "ppCubeTexture")]),
-       Method(HRESULT, "CreateVertexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (DWORD, "FVF"), (D3DPOOL, "Pool"), (Pointer(WrapPointer(IDirect3DVertexBuffer8)), "ppVertexBuffer")]),
-       Method(HRESULT, "CreateIndexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (Pointer(WrapPointer(IDirect3DIndexBuffer8)), "ppIndexBuffer")]),
-       Method(HRESULT, "CreateRenderTarget", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (BOOL, "Lockable"), (Pointer(WrapPointer(IDirect3DSurface8)), "ppSurface")]),
-       Method(HRESULT, "CreateDepthStencilSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (Pointer(WrapPointer(IDirect3DSurface8)), "ppSurface")]),
-       Method(HRESULT, "CreateImageSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (Pointer(WrapPointer(IDirect3DSurface8)), "ppSurface")]),
-       Method(HRESULT, "CopyRects", [(Pointer(IDirect3DSurface8), "pSourceSurface"), (Pointer(Const(RECT)), "pSourceRectsArray"), (UINT, "cRects"), (Pointer(IDirect3DSurface8), "pDestinationSurface"), (Pointer(Const(POINT)), "pDestPointsArray")]),
-       Method(HRESULT, "UpdateTexture", [(Pointer(IDirect3DBaseTexture8), "pSourceTexture"), (Pointer(IDirect3DBaseTexture8), "pDestinationTexture")]),
-       Method(HRESULT, "GetFrontBuffer", [(Pointer(IDirect3DSurface8), "pDestSurface")]),
-       Method(HRESULT, "SetRenderTarget", [(Pointer(IDirect3DSurface8), "pRenderTarget"), (Pointer(IDirect3DSurface8), "pNewZStencil")]),
-       Method(HRESULT, "GetRenderTarget", [(Pointer(Pointer(IDirect3DSurface8)), "ppRenderTarget")]),
-       Method(HRESULT, "GetDepthStencilSurface", [(Pointer(Pointer(IDirect3DSurface8)), "ppZStencilSurface")]),
+       Method(HRESULT, "CreateTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DTEXTURE8), "ppTexture")]),
+       Method(HRESULT, "CreateVolumeTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Depth"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DVOLUMETEXTURE8), "ppVolumeTexture")]),
+       Method(HRESULT, "CreateCubeTexture", [(UINT, "EdgeLength"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DCUBETEXTURE8), "ppCubeTexture")]),
+       Method(HRESULT, "CreateVertexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (DWORD, "FVF"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DVERTEXBUFFER8), "ppVertexBuffer")]),
+       Method(HRESULT, "CreateIndexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DINDEXBUFFER8), "ppIndexBuffer")]),
+       Method(HRESULT, "CreateRenderTarget", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (BOOL, "Lockable"), (OutPointer(PDIRECT3DSURFACE8), "ppSurface")]),
+       Method(HRESULT, "CreateDepthStencilSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (OutPointer(PDIRECT3DSURFACE8), "ppSurface")]),
+       Method(HRESULT, "CreateImageSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (OutPointer(PDIRECT3DSURFACE8), "ppSurface")]),
+       Method(HRESULT, "CopyRects", [(PDIRECT3DSURFACE8, "pSourceSurface"), (Pointer(Const(RECT)), "pSourceRectsArray"), (UINT, "cRects"), (PDIRECT3DSURFACE8, "pDestinationSurface"), (Pointer(Const(POINT)), "pDestPointsArray")]),
+       Method(HRESULT, "UpdateTexture", [(PDIRECT3DBASETEXTURE8, "pSourceTexture"), (PDIRECT3DBASETEXTURE8, "pDestinationTexture")]),
+       Method(HRESULT, "GetFrontBuffer", [(PDIRECT3DSURFACE8, "pDestSurface")]),
+       Method(HRESULT, "SetRenderTarget", [(PDIRECT3DSURFACE8, "pRenderTarget"), (PDIRECT3DSURFACE8, "pNewZStencil")]),
+       Method(HRESULT, "GetRenderTarget", [(OutPointer(PDIRECT3DSURFACE8), "ppRenderTarget")]),
+       Method(HRESULT, "GetDepthStencilSurface", [(OutPointer(PDIRECT3DSURFACE8), "ppZStencilSurface")]),
        Method(HRESULT, "BeginScene", []),
        Method(HRESULT, "EndScene", []),
        Method(HRESULT, "Clear", [(DWORD, "Count"), (Pointer(Const(D3DRECT)), "pRects"), (DWORD, "Flags"), (D3DCOLOR, "Color"), (Float, "Z"), (DWORD, "Stencil")]),
@@ -104,8 +104,8 @@ IDirect3DDevice8.methods += [
        Method(HRESULT, "CreateStateBlock", [(D3DSTATEBLOCKTYPE, "Type"), (Pointer(DWORD), "pToken")]),
        Method(HRESULT, "SetClipStatus", [(Pointer(Const(D3DCLIPSTATUS8)), "pClipStatus")]),
        Method(HRESULT, "GetClipStatus", [(Pointer(D3DCLIPSTATUS8), "pClipStatus")]),
-       Method(HRESULT, "GetTexture", [(DWORD, "Stage"), (Pointer(Pointer(IDirect3DBaseTexture8)), "ppTexture")]),
-       Method(HRESULT, "SetTexture", [(DWORD, "Stage"), (Pointer(IDirect3DBaseTexture8), "pTexture")]),
+       Method(HRESULT, "GetTexture", [(DWORD, "Stage"), (OutPointer(PDIRECT3DBASETEXTURE8), "ppTexture")]),
+       Method(HRESULT, "SetTexture", [(DWORD, "Stage"), (PDIRECT3DBASETEXTURE8, "pTexture")]),
        Method(HRESULT, "GetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), (Pointer(DWORD), "pValue")]),
        Method(HRESULT, "SetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), (DWORD, "Value")]),
        Method(HRESULT, "ValidateDevice", [(Pointer(DWORD), "pNumPasses")]),
@@ -118,7 +118,7 @@ IDirect3DDevice8.methods += [
        Method(HRESULT, "DrawIndexedPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "minIndex"), (UINT, "NumVertices"), (UINT, "startIndex"), (UINT, "primCount")]),
        Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (Const(Pointer(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]),
        Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertexIndices"), (UINT, "PrimitiveCount"), (Const(Pointer(Void)), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (Const(Pointer(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]),
-       Method(HRESULT, "ProcessVertices", [(UINT, "SrcStartIndex"), (UINT, "DestIndex"), (UINT, "VertexCount"), (Pointer(IDirect3DVertexBuffer8), "pDestBuffer"), (DWORD, "Flags")]),
+       Method(HRESULT, "ProcessVertices", [(UINT, "SrcStartIndex"), (UINT, "DestIndex"), (UINT, "VertexCount"), (PDIRECT3DVERTEXBUFFER8, "pDestBuffer"), (DWORD, "Flags")]),
        Method(HRESULT, "CreateVertexShader", [(Pointer(Const(DWORD)), "pDeclaration"), (Pointer(Const(DWORD)), "pFunction"), (Pointer(DWORD), "pHandle"), (DWORD, "Usage")]),
        Method(HRESULT, "SetVertexShader", [(DWORD, "Handle")]),
        Method(HRESULT, "GetVertexShader", [(Pointer(DWORD), "pHandle")]),
@@ -127,10 +127,10 @@ IDirect3DDevice8.methods += [
        Method(HRESULT, "GetVertexShaderConstant", [(DWORD, "Register"), (Pointer(Void), "pConstantData"), (DWORD, "ConstantCount")]),
        Method(HRESULT, "GetVertexShaderDeclaration", [(DWORD, "Handle"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
        Method(HRESULT, "GetVertexShaderFunction", [(DWORD, "Handle"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
-       Method(HRESULT, "SetStreamSource", [(UINT, "StreamNumber"), (Pointer(IDirect3DVertexBuffer8), "pStreamData"), (UINT, "Stride")]),
-       Method(HRESULT, "GetStreamSource", [(UINT, "StreamNumber"), (Pointer(Pointer(IDirect3DVertexBuffer8)), "ppStreamData"), (Pointer(UINT), "pStride")]),
-       Method(HRESULT, "SetIndices", [(Pointer(IDirect3DIndexBuffer8), "pIndexData"), (UINT, "BaseVertexIndex")]),
-       Method(HRESULT, "GetIndices", [(Pointer(Pointer(IDirect3DIndexBuffer8)), "ppIndexData"), (Pointer(UINT), "pBaseVertexIndex")]),
+       Method(HRESULT, "SetStreamSource", [(UINT, "StreamNumber"), (PDIRECT3DVERTEXBUFFER8, "pStreamData"), (UINT, "Stride")]),
+       Method(HRESULT, "GetStreamSource", [(UINT, "StreamNumber"), (OutPointer(PDIRECT3DVERTEXBUFFER8), "ppStreamData"), (Pointer(UINT), "pStride")]),
+       Method(HRESULT, "SetIndices", [(PDIRECT3DINDEXBUFFER8, "pIndexData"), (UINT, "BaseVertexIndex")]),
+       Method(HRESULT, "GetIndices", [(OutPointer(PDIRECT3DINDEXBUFFER8), "ppIndexData"), (Pointer(UINT), "pBaseVertexIndex")]),
        Method(HRESULT, "CreatePixelShader", [(Pointer(Const(DWORD)), "pFunction"), (Pointer(DWORD), "pHandle")]),
        Method(HRESULT, "SetPixelShader", [(DWORD, "Handle")]),
        Method(HRESULT, "GetPixelShader", [(Pointer(DWORD), "pHandle")]),
@@ -145,11 +145,11 @@ IDirect3DDevice8.methods += [
 
 IDirect3DSwapChain8.methods += [
        Method(HRESULT, "Present", [(Pointer(Const(RECT)), "pSourceRect"), (Pointer(Const(RECT)), "pDestRect"), (HWND, "hDestWindowOverride"), (Const(Pointer(RGNDATA)), "pDirtyRegion")]),
-       Method(HRESULT, "GetBackBuffer", [(UINT, "BackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), (Pointer(Pointer(IDirect3DSurface8)), "ppBackBuffer")]),
+       Method(HRESULT, "GetBackBuffer", [(UINT, "BackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), (OutPointer(PDIRECT3DSURFACE8), "ppBackBuffer")]),
 ]
 
 IDirect3DResource8.methods += [
-       Method(HRESULT, "GetDevice", [(Pointer(Pointer(IDirect3DDevice8)), "ppDevice")]),
+       Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE8), "ppDevice")]),
        Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (Const(Pointer(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
        Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
        Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
@@ -167,7 +167,7 @@ IDirect3DBaseTexture8.methods += [
 
 IDirect3DTexture8.methods += [
        Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), (Pointer(D3DSURFACE_DESC), "pDesc")]),
-       Method(HRESULT, "GetSurfaceLevel", [(UINT, "Level"), (Pointer(Pointer(IDirect3DSurface8)), "ppSurfaceLevel")]),
+       Method(HRESULT, "GetSurfaceLevel", [(UINT, "Level"), (OutPointer(PDIRECT3DSURFACE8), "ppSurfaceLevel")]),
        Method(HRESULT, "LockRect", [(UINT, "Level"), (Pointer(D3DLOCKED_RECT), "pLockedRect"), (Pointer(Const(RECT)), "pRect"), (DWORD, "Flags")]),
        Method(HRESULT, "UnlockRect", [(UINT, "Level")]),
        Method(HRESULT, "AddDirtyRect", [(Pointer(Const(RECT)), "pDirtyRect")]),
@@ -175,7 +175,7 @@ IDirect3DTexture8.methods += [
 
 IDirect3DVolumeTexture8.methods += [
        Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), (Pointer(D3DVOLUME_DESC), "pDesc")]),
-       Method(HRESULT, "GetVolumeLevel", [(UINT, "Level"), (Pointer(Pointer(IDirect3DVolume8)), "ppVolumeLevel")]),
+       Method(HRESULT, "GetVolumeLevel", [(UINT, "Level"), (OutPointer(PDIRECT3DVOLUME8), "ppVolumeLevel")]),
        Method(HRESULT, "LockBox", [(UINT, "Level"), (Pointer(D3DLOCKED_BOX), "pLockedVolume"), (Pointer(Const(D3DBOX)), "pBox"), (DWORD, "Flags")]),
        Method(HRESULT, "UnlockBox", [(UINT, "Level")]),
        Method(HRESULT, "AddDirtyBox", [(Pointer(Const(D3DBOX)), "pDirtyBox")]),
@@ -183,7 +183,7 @@ IDirect3DVolumeTexture8.methods += [
 
 IDirect3DCubeTexture8.methods += [
        Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), (Pointer(D3DSURFACE_DESC), "pDesc")]),
-       Method(HRESULT, "GetCubeMapSurface", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), (Pointer(Pointer(IDirect3DSurface8)), "ppCubeMapSurface")]),
+       Method(HRESULT, "GetCubeMapSurface", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), (OutPointer(PDIRECT3DSURFACE8), "ppCubeMapSurface")]),
        Method(HRESULT, "LockRect", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), (Pointer(D3DLOCKED_RECT), "pLockedRect"), (Pointer(Const(RECT)), "pRect"), (DWORD, "Flags")]),
        Method(HRESULT, "UnlockRect", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level")]),
        Method(HRESULT, "AddDirtyRect", [(D3DCUBEMAP_FACES, "FaceType"), (Pointer(Const(RECT)), "pDirtyRect")]),
@@ -202,7 +202,7 @@ IDirect3DIndexBuffer8.methods += [
 ]
 
 IDirect3DSurface8.methods += [
-       Method(HRESULT, "GetDevice", [(Pointer(Pointer(IDirect3DDevice8)), "ppDevice")]),
+       Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE8), "ppDevice")]),
        Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (Const(Pointer(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
        Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
        Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
@@ -213,7 +213,7 @@ IDirect3DSurface8.methods += [
 ]
 
 IDirect3DVolume8.methods += [
-       Method(HRESULT, "GetDevice", [(Pointer(Pointer(IDirect3DDevice8)), "ppDevice")]),
+       Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE8), "ppDevice")]),
        Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (Const(Pointer(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
        Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (Pointer(Void), "pData"), (Pointer(DWORD), "pSizeOfData")]),
        Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
@@ -225,7 +225,7 @@ IDirect3DVolume8.methods += [
 
 d3d8 = Dll("d3d8")
 d3d8.functions += [
-    Function(WrapPointer(IDirect3D8), "Direct3DCreate8", [(UINT, "SDKVersion")]),
+    Function(PDIRECT3D8, "Direct3DCreate8", [(UINT, "SDKVersion")]),
 ]
 
 if __name__ == '__main__':