]> git.cworth.org Git - apitrace/blob - d3d8.py
Re-add d3d8 support.
[apitrace] / d3d8.py
1 ##########################################################################
2 #
3 # Copyright 2008-2009 VMware, Inc.
4 # All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 ##########################################################################/
25
26 """d3d8.h"""
27
28 from winapi import *
29 from d3d8types import *
30 from d3d8caps import *
31 from trace import DllTracer
32
33 HRESULT = Enum("HRESULT", [
34     "D3D_OK",
35     "D3DERR_WRONGTEXTUREFORMAT",
36     "D3DERR_UNSUPPORTEDCOLOROPERATION",
37     "D3DERR_UNSUPPORTEDCOLORARG",
38     "D3DERR_UNSUPPORTEDALPHAOPERATION",
39     "D3DERR_UNSUPPORTEDALPHAARG",
40     "D3DERR_TOOMANYOPERATIONS",
41     "D3DERR_CONFLICTINGTEXTUREFILTER",
42     "D3DERR_UNSUPPORTEDFACTORVALUE",
43     "D3DERR_CONFLICTINGRENDERSTATE",
44     "D3DERR_UNSUPPORTEDTEXTUREFILTER",
45     "D3DERR_CONFLICTINGTEXTUREPALETTE",
46     "D3DERR_DRIVERINTERNALERROR",
47     "D3DERR_NOTFOUND",
48     "D3DERR_MOREDATA",
49     "D3DERR_DEVICELOST",
50     "D3DERR_DEVICENOTRESET",
51     "D3DERR_NOTAVAILABLE",
52     "D3DERR_OUTOFVIDEOMEMORY",
53     "D3DERR_INVALIDDEVICE",
54     "D3DERR_INVALIDCALL",
55     "D3DERR_DRIVERINVALIDCALL",
56 ])
57
58 IDirect3D8 = Interface("IDirect3D8", IUnknown)
59 IDirect3DDevice8 = Interface("IDirect3DDevice8", IUnknown)
60 IDirect3DSwapChain8 = Interface("IDirect3DSwapChain8", IUnknown)
61 IDirect3DResource8 = Interface("IDirect3DResource8", IUnknown)
62 IDirect3DBaseTexture8 = Interface("IDirect3DBaseTexture8", IDirect3DResource8)
63 IDirect3DTexture8 = Interface("IDirect3DTexture8", IDirect3DBaseTexture8)
64 IDirect3DVolumeTexture8 = Interface("IDirect3DVolumeTexture8", IDirect3DBaseTexture8)
65 IDirect3DCubeTexture8 = Interface("IDirect3DCubeTexture8", IDirect3DBaseTexture8)
66 IDirect3DVertexBuffer8 = Interface("IDirect3DVertexBuffer8", IDirect3DResource8)
67 IDirect3DIndexBuffer8 = Interface("IDirect3DIndexBuffer8", IDirect3DResource8)
68 IDirect3DSurface8 = Interface("IDirect3DSurface8", IUnknown)
69 IDirect3DVolume8 = Interface("IDirect3DVolume8", IUnknown)
70
71 PDIRECT3D8 = WrapPointer(IDirect3D8)
72 PDIRECT3DDEVICE8 = WrapPointer(IDirect3DDevice8)
73 PDIRECT3DSWAPCHAIN8 = WrapPointer(IDirect3DSwapChain8)
74 PDIRECT3DRESOURCE8 = WrapPointer(IDirect3DResource8)
75 PDIRECT3DBASETEXTURE8 = WrapPointer(IDirect3DBaseTexture8)
76 PDIRECT3DTEXTURE8 = WrapPointer(IDirect3DTexture8)
77 PDIRECT3DVOLUMETEXTURE8 = WrapPointer(IDirect3DVolumeTexture8)
78 PDIRECT3DCUBETEXTURE8 = WrapPointer(IDirect3DCubeTexture8)
79 PDIRECT3DVERTEXBUFFER8 = WrapPointer(IDirect3DVertexBuffer8)
80 PDIRECT3DINDEXBUFFER8 = WrapPointer(IDirect3DIndexBuffer8)
81 PDIRECT3DSURFACE8 = WrapPointer(IDirect3DSurface8)
82 PDIRECT3DVOLUME8 = WrapPointer(IDirect3DVolume8)
83
84 IDirect3D8.methods += [
85     Method(HRESULT, "RegisterSoftwareDevice", [(OpaquePointer(Void), "pInitializeFunction")]),
86     Method(UINT, "GetAdapterCount", []),
87     Method(HRESULT, "GetAdapterIdentifier", [(UINT, "Adapter"), (DWORD, "Flags"), Out(Pointer(D3DADAPTER_IDENTIFIER8), "pIdentifier")]),
88     Method(UINT, "GetAdapterModeCount", [(UINT, "Adapter")]),
89     Method(HRESULT, "EnumAdapterModes", [(UINT, "Adapter"), (UINT, "Mode"), Out(Pointer(D3DDISPLAYMODE), "pMode")]),
90     Method(HRESULT, "GetAdapterDisplayMode", [(UINT, "Adapter"), Out(Pointer(D3DDISPLAYMODE), "pMode")]),
91     Method(HRESULT, "CheckDeviceType", [(UINT, "Adapter"), (D3DDEVTYPE, "CheckType"), (D3DFORMAT, "DisplayFormat"), (D3DFORMAT, "BackBufferFormat"), (BOOL, "Windowed")]),
92     Method(HRESULT, "CheckDeviceFormat", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "AdapterFormat"), (DWORD, "Usage"), (D3DRESOURCETYPE, "RType"), (D3DFORMAT, "CheckFormat")]),
93     Method(HRESULT, "CheckDeviceMultiSampleType", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "SurfaceFormat"), (BOOL, "Windowed"), (D3DMULTISAMPLE_TYPE, "MultiSampleType")]),
94     Method(HRESULT, "CheckDepthStencilMatch", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "AdapterFormat"), (D3DFORMAT, "RenderTargetFormat"), (D3DFORMAT, "DepthStencilFormat")]),
95     Method(HRESULT, "GetDeviceCaps", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), Out(Pointer(D3DCAPS8), "pCaps")]),
96     Method(HMONITOR, "GetAdapterMonitor", [(UINT, "Adapter")]),
97     Method(HRESULT, "CreateDevice", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (DWORD, "BehaviorFlags"), Out(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), Out(Pointer(PDIRECT3DDEVICE8), "ppReturnedDeviceInterface")]),
98 ]
99
100 IDirect3DDevice8.methods += [
101     Method(HRESULT, "TestCooperativeLevel", []),
102     Method(UINT, "GetAvailableTextureMem", []),
103     Method(HRESULT, "ResourceManagerDiscardBytes", [(DWORD, "Bytes")]),
104     Method(HRESULT, "GetDirect3D", [Out(Pointer(PDIRECT3D8), "ppD3D8")]),
105     Method(HRESULT, "GetDeviceCaps", [Out(Pointer(D3DCAPS8), "pCaps")]),
106     Method(HRESULT, "GetDisplayMode", [Out(Pointer(D3DDISPLAYMODE), "pMode")]),
107     Method(HRESULT, "GetCreationParameters", [Out(Pointer(D3DDEVICE_CREATION_PARAMETERS), "pParameters")]),
108     Method(HRESULT, "SetCursorProperties", [(UINT, "XHotSpot"), (UINT, "YHotSpot"), (PDIRECT3DSURFACE8, "pCursorBitmap")]),
109     Method(Void, "SetCursorPosition", [(Int, "X"), (Int, "Y"), (DWORD, "Flags")]),
110     Method(BOOL, "ShowCursor", [(BOOL, "bShow")]),
111     Method(HRESULT, "CreateAdditionalSwapChain", [Out(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), Out(Pointer(PDIRECT3DSWAPCHAIN8), "pSwapChain")]),
112     Method(HRESULT, "Reset", [Out(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters")]),
113     Method(HRESULT, "Present", [(ConstPointer(RECT), "pSourceRect"), (ConstPointer(RECT), "pDestRect"), (HWND, "hDestWindowOverride"), (ConstPointer(RGNDATA), "pDirtyRegion")]),
114     Method(HRESULT, "GetBackBuffer", [(UINT, "BackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), Out(Pointer(PDIRECT3DSURFACE8), "ppBackBuffer")]),
115     Method(HRESULT, "GetRasterStatus", [Out(Pointer(D3DRASTER_STATUS), "pRasterStatus")]),
116     Method(Void, "SetGammaRamp", [(DWORD, "Flags"), (ConstPointer(D3DGAMMARAMP), "pRamp")]),
117     Method(Void, "GetGammaRamp", [Out(Pointer(D3DGAMMARAMP), "pRamp")]),
118     Method(HRESULT, "CreateTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), Out(Pointer(PDIRECT3DTEXTURE8), "ppTexture")]),
119     Method(HRESULT, "CreateVolumeTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Depth"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), Out(Pointer(PDIRECT3DVOLUMETEXTURE8), "ppVolumeTexture")]),
120     Method(HRESULT, "CreateCubeTexture", [(UINT, "EdgeLength"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), Out(Pointer(PDIRECT3DCUBETEXTURE8), "ppCubeTexture")]),
121     Method(HRESULT, "CreateVertexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (DWORD, "FVF"), (D3DPOOL, "Pool"), Out(Pointer(PDIRECT3DVERTEXBUFFER8), "ppVertexBuffer")]),
122     Method(HRESULT, "CreateIndexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), Out(Pointer(PDIRECT3DINDEXBUFFER8), "ppIndexBuffer")]),
123     Method(HRESULT, "CreateRenderTarget", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (BOOL, "Lockable"), Out(Pointer(PDIRECT3DSURFACE8), "ppSurface")]),
124     Method(HRESULT, "CreateDepthStencilSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), Out(Pointer(PDIRECT3DSURFACE8), "ppSurface")]),
125     Method(HRESULT, "CreateImageSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), Out(Pointer(PDIRECT3DSURFACE8), "ppSurface")]),
126     Method(HRESULT, "CopyRects", [(PDIRECT3DSURFACE8, "pSourceSurface"), (ConstPointer(RECT), "pSourceRectsArray"), (UINT, "cRects"), (PDIRECT3DSURFACE8, "pDestinationSurface"), (ConstPointer(POINT), "pDestPointsArray")]),
127     Method(HRESULT, "UpdateTexture", [(PDIRECT3DBASETEXTURE8, "pSourceTexture"), (PDIRECT3DBASETEXTURE8, "pDestinationTexture")]),
128     Method(HRESULT, "GetFrontBuffer", [(PDIRECT3DSURFACE8, "pDestSurface")]),
129     Method(HRESULT, "SetRenderTarget", [(PDIRECT3DSURFACE8, "pRenderTarget"), (PDIRECT3DSURFACE8, "pNewZStencil")]),
130     Method(HRESULT, "GetRenderTarget", [Out(Pointer(PDIRECT3DSURFACE8), "ppRenderTarget")]),
131     Method(HRESULT, "GetDepthStencilSurface", [Out(Pointer(PDIRECT3DSURFACE8), "ppZStencilSurface")]),
132     Method(HRESULT, "BeginScene", []),
133     Method(HRESULT, "EndScene", []),
134     Method(HRESULT, "Clear", [(DWORD, "Count"), (ConstPointer(D3DRECT), "pRects"), (DWORD, "Flags"), (D3DCOLOR, "Color"), (Float, "Z"), (DWORD, "Stencil")]),
135     Method(HRESULT, "SetTransform", [(D3DTRANSFORMSTATETYPE, "State"), (ConstPointer(D3DMATRIX), "pMatrix")]),
136     Method(HRESULT, "GetTransform", [(D3DTRANSFORMSTATETYPE, "State"), Out(Pointer(D3DMATRIX), "pMatrix")]),
137     Method(HRESULT, "MultiplyTransform", [(D3DTRANSFORMSTATETYPE, "State"), (ConstPointer(D3DMATRIX), "pMatrix")]),
138     Method(HRESULT, "SetViewport", [(ConstPointer(D3DVIEWPORT8), "pViewport")]),
139     Method(HRESULT, "GetViewport", [Out(Pointer(D3DVIEWPORT8), "pViewport")]),
140     Method(HRESULT, "SetMaterial", [(ConstPointer(D3DMATERIAL8), "pMaterial")]),
141     Method(HRESULT, "GetMaterial", [Out(Pointer(D3DMATERIAL8), "pMaterial")]),
142     Method(HRESULT, "SetLight", [(DWORD, "Index"), (ConstPointer(D3DLIGHT8), "pLight")]),
143     Method(HRESULT, "GetLight", [(DWORD, "Index"), Out(Pointer(D3DLIGHT8), "pLight")]),
144     Method(HRESULT, "LightEnable", [(DWORD, "Index"), (BOOL, "Enable")]),
145     Method(HRESULT, "GetLightEnable", [(DWORD, "Index"), Out(Pointer(BOOL), "pEnable")]),
146     Method(HRESULT, "SetClipPlane", [(DWORD, "Index"), (ConstPointer(Float), "pPlane")]),
147     Method(HRESULT, "GetClipPlane", [(DWORD, "Index"), Out(Pointer(Float), "pPlane")]),
148     Method(HRESULT, "SetRenderState", [(D3DRENDERSTATETYPE, "State"), (DWORD, "Value")]),
149     Method(HRESULT, "GetRenderState", [(D3DRENDERSTATETYPE, "State"), Out(Pointer(DWORD), "pValue")]),
150     Method(HRESULT, "BeginStateBlock", []),
151     Method(HRESULT, "EndStateBlock", [Out(Pointer(DWORD), "pToken")]),
152     Method(HRESULT, "ApplyStateBlock", [(DWORD, "Token")]),
153     Method(HRESULT, "CaptureStateBlock", [(DWORD, "Token")]),
154     Method(HRESULT, "DeleteStateBlock", [(DWORD, "Token")]),
155     Method(HRESULT, "CreateStateBlock", [(D3DSTATEBLOCKTYPE, "Type"), Out(Pointer(DWORD), "pToken")]),
156     Method(HRESULT, "SetClipStatus", [(ConstPointer(D3DCLIPSTATUS8), "pClipStatus")]),
157     Method(HRESULT, "GetClipStatus", [Out(Pointer(D3DCLIPSTATUS8), "pClipStatus")]),
158     Method(HRESULT, "GetTexture", [(DWORD, "Stage"), Out(Pointer(PDIRECT3DBASETEXTURE8), "ppTexture")]),
159     Method(HRESULT, "SetTexture", [(DWORD, "Stage"), (PDIRECT3DBASETEXTURE8, "pTexture")]),
160     Method(HRESULT, "GetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), Out(Pointer(DWORD), "pValue")]),
161     Method(HRESULT, "SetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), (DWORD, "Value")]),
162     Method(HRESULT, "ValidateDevice", [Out(Pointer(DWORD), "pNumPasses")]),
163     Method(HRESULT, "GetInfo", [(DWORD, "DevInfoID"), Out(OpaquePointer(Void), "pDevInfoStruct"), (DWORD, "DevInfoStructSize")]),
164     Method(HRESULT, "SetPaletteEntries", [(UINT, "PaletteNumber"), (ConstPointer(PALETTEENTRY), "pEntries")]),
165     Method(HRESULT, "GetPaletteEntries", [(UINT, "PaletteNumber"), Out(Pointer(PALETTEENTRY), "pEntries")]),
166     Method(HRESULT, "SetCurrentTexturePalette", [(UINT, "PaletteNumber")]),
167     Method(HRESULT, "GetCurrentTexturePalette", [Out(Pointer(UINT), "PaletteNumber")]),
168     Method(HRESULT, "DrawPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "StartVertex"), (UINT, "PrimitiveCount")]),
169     Method(HRESULT, "DrawIndexedPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "minIndex"), (UINT, "NumVertices"), (UINT, "startIndex"), (UINT, "primCount")]),
170     Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (OpaquePointer(Const(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]),
171     Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertexIndices"), (UINT, "PrimitiveCount"), (OpaquePointer(Const(Void)), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (OpaquePointer(Const(Void)), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]),
172     Method(HRESULT, "ProcessVertices", [(UINT, "SrcStartIndex"), (UINT, "DestIndex"), (UINT, "VertexCount"), (PDIRECT3DVERTEXBUFFER8, "pDestBuffer"), (DWORD, "Flags")]),
173     Method(HRESULT, "CreateVertexShader", [(ConstPointer(DWORD), "pDeclaration"), (ConstPointer(DWORD), "pFunction"), Out(Pointer(DWORD), "pHandle"), (DWORD, "Usage")]),
174     Method(HRESULT, "SetVertexShader", [(DWORD, "Handle")]),
175     Method(HRESULT, "GetVertexShader", [Out(Pointer(DWORD), "pHandle")]),
176     Method(HRESULT, "DeleteVertexShader", [(DWORD, "Handle")]),
177     Method(HRESULT, "SetVertexShaderConstant", [(DWORD, "Register"), (OpaquePointer(Const(Void)), "pConstantData"), (DWORD, "ConstantCount")]),
178     Method(HRESULT, "GetVertexShaderConstant", [(DWORD, "Register"), Out(OpaquePointer(Void), "pConstantData"), (DWORD, "ConstantCount")]),
179     Method(HRESULT, "GetVertexShaderDeclaration", [(DWORD, "Handle"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]),
180     Method(HRESULT, "GetVertexShaderFunction", [(DWORD, "Handle"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]),
181     Method(HRESULT, "SetStreamSource", [(UINT, "StreamNumber"), (PDIRECT3DVERTEXBUFFER8, "pStreamData"), (UINT, "Stride")]),
182     Method(HRESULT, "GetStreamSource", [(UINT, "StreamNumber"), Out(Pointer(PDIRECT3DVERTEXBUFFER8), "ppStreamData"), Out(Pointer(UINT), "pStride")]),
183     Method(HRESULT, "SetIndices", [(PDIRECT3DINDEXBUFFER8, "pIndexData"), (UINT, "BaseVertexIndex")]),
184     Method(HRESULT, "GetIndices", [Out(Pointer(PDIRECT3DINDEXBUFFER8), "ppIndexData"), Out(Pointer(UINT), "pBaseVertexIndex")]),
185     Method(HRESULT, "CreatePixelShader", [(ConstPointer(DWORD), "pFunction"), Out(Pointer(DWORD), "pHandle")]),
186     Method(HRESULT, "SetPixelShader", [(DWORD, "Handle")]),
187     Method(HRESULT, "GetPixelShader", [Out(Pointer(DWORD), "pHandle")]),
188     Method(HRESULT, "DeletePixelShader", [(DWORD, "Handle")]),
189     Method(HRESULT, "SetPixelShaderConstant", [(DWORD, "Register"), (OpaquePointer(Const(Void)), "pConstantData"), (DWORD, "ConstantCount")]),
190     Method(HRESULT, "GetPixelShaderConstant", [(DWORD, "Register"), Out(OpaquePointer(Void), "pConstantData"), (DWORD, "ConstantCount")]),
191     Method(HRESULT, "GetPixelShaderFunction", [(DWORD, "Handle"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]),
192     Method(HRESULT, "DrawRectPatch", [(UINT, "Handle"), (ConstPointer(Float), "pNumSegs"), (ConstPointer(D3DRECTPATCH_INFO), "pRectPatchInfo")]),
193     Method(HRESULT, "DrawTriPatch", [(UINT, "Handle"), (ConstPointer(Float), "pNumSegs"), (ConstPointer(D3DTRIPATCH_INFO), "pTriPatchInfo")]),
194     Method(HRESULT, "DeletePatch", [(UINT, "Handle")]),
195 ]
196
197 IDirect3DSwapChain8.methods += [
198     Method(HRESULT, "Present", [(ConstPointer(RECT), "pSourceRect"), (ConstPointer(RECT), "pDestRect"), (HWND, "hDestWindowOverride"), (ConstPointer(RGNDATA), "pDirtyRegion")]),
199     Method(HRESULT, "GetBackBuffer", [(UINT, "BackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), Out(Pointer(PDIRECT3DSURFACE8), "ppBackBuffer")]),
200 ]
201
202 IDirect3DResource8.methods += [
203     Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE8), "ppDevice")]),
204     Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
205     Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]),
206     Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
207     Method(DWORD, "SetPriority", [(DWORD, "PriorityNew")]),
208     Method(DWORD, "GetPriority", []),
209     Method(Void, "PreLoad", []),
210     Method(D3DRESOURCETYPE, "GetType", []),
211 ]
212
213 IDirect3DBaseTexture8.methods += [
214     Method(DWORD, "SetLOD", [(DWORD, "LODNew")]),
215     Method(DWORD, "GetLOD", []),
216     Method(DWORD, "GetLevelCount", []),
217 ]
218
219 IDirect3DTexture8.methods += [
220     Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), Out(Pointer(D3DSURFACE_DESC), "pDesc")]),
221     Method(HRESULT, "GetSurfaceLevel", [(UINT, "Level"), Out(Pointer(PDIRECT3DSURFACE8), "ppSurfaceLevel")]),
222     Method(HRESULT, "LockRect", [(UINT, "Level"), Out(Pointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]),
223     Method(HRESULT, "UnlockRect", [(UINT, "Level")]),
224     Method(HRESULT, "AddDirtyRect", [(ConstPointer(RECT), "pDirtyRect")]),
225 ]
226
227 IDirect3DVolumeTexture8.methods += [
228     Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), Out(Pointer(D3DVOLUME_DESC), "pDesc")]),
229     Method(HRESULT, "GetVolumeLevel", [(UINT, "Level"), Out(Pointer(PDIRECT3DVOLUME8), "ppVolumeLevel")]),
230     Method(HRESULT, "LockBox", [(UINT, "Level"), Out(Pointer(D3DLOCKED_BOX), "pLockedVolume"), (ConstPointer(D3DBOX), "pBox"), (DWORD, "Flags")]),
231     Method(HRESULT, "UnlockBox", [(UINT, "Level")]),
232     Method(HRESULT, "AddDirtyBox", [(ConstPointer(D3DBOX), "pDirtyBox")]),
233 ]
234
235 IDirect3DCubeTexture8.methods += [
236     Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), Out(Pointer(D3DSURFACE_DESC), "pDesc")]),
237     Method(HRESULT, "GetCubeMapSurface", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), Out(Pointer(PDIRECT3DSURFACE8), "ppCubeMapSurface")]),
238     Method(HRESULT, "LockRect", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), Out(Pointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]),
239     Method(HRESULT, "UnlockRect", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level")]),
240     Method(HRESULT, "AddDirtyRect", [(D3DCUBEMAP_FACES, "FaceType"), (ConstPointer(RECT), "pDirtyRect")]),
241 ]
242
243 IDirect3DVertexBuffer8.methods += [
244     Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(Pointer(BYTE)), "ppbData"), (DWORD, "Flags")]),
245     Method(HRESULT, "Unlock", []),
246     Method(HRESULT, "GetDesc", [Out(Pointer(D3DVERTEXBUFFER_DESC), "pDesc")]),
247 ]
248
249 IDirect3DIndexBuffer8.methods += [
250     Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), Out(Pointer(Pointer(BYTE)), "ppbData"), (DWORD, "Flags")]),
251     Method(HRESULT, "Unlock", []),
252     Method(HRESULT, "GetDesc", [Out(Pointer(D3DINDEXBUFFER_DESC), "pDesc")]),
253 ]
254
255 IDirect3DSurface8.methods += [
256     Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE8), "ppDevice")]),
257     Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
258     Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]),
259     Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
260     Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppContainer")]),
261     Method(HRESULT, "GetDesc", [Out(Pointer(D3DSURFACE_DESC), "pDesc")]),
262     Method(HRESULT, "LockRect", [Out(Pointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]),
263     Method(HRESULT, "UnlockRect", []),
264 ]
265
266 IDirect3DVolume8.methods += [
267     Method(HRESULT, "GetDevice", [Out(Pointer(PDIRECT3DDEVICE8), "ppDevice")]),
268     Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (OpaquePointer(Const(Void)), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
269     Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), Out(OpaquePointer(Void), "pData"), Out(Pointer(DWORD), "pSizeOfData")]),
270     Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
271     Method(HRESULT, "GetContainer", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppContainer")]),
272     Method(HRESULT, "GetDesc", [Out(Pointer(D3DVOLUME_DESC), "pDesc")]),
273     Method(HRESULT, "LockBox", [Out(Pointer(D3DLOCKED_BOX), "pLockedVolume"), (ConstPointer(D3DBOX), "pBox"), (DWORD, "Flags")]),
274     Method(HRESULT, "UnlockBox", []),
275 ]
276
277 d3d8 = API("d3d8")
278 d3d8.add_functions([
279     StdFunction(PDIRECT3D8, "Direct3DCreate8", [(UINT, "SDKVersion")]),
280 ])
281
282
283 class D3D8Tracer(DllTracer):
284
285     pass
286
287
288 if __name__ == '__main__':
289     print '#include <windows.h>'
290     print '#include <d3d8.h>'
291     print
292     print '#include "trace_write.hpp"'
293     print '#include "os.hpp"'
294     print
295     tracer = D3D8Tracer('d3d8.dll')
296     tracer.trace_api(d3d8)
297