1 #############################################################################
3 # Copyright 2008 Tungsten Graphics, Inc.
5 # This program is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published
7 # by the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #############################################################################
23 from d3d9types import *
24 from d3d9caps import *
26 HRESULT = Enum("HRESULT", [
28 "D3DERR_WRONGTEXTUREFORMAT",
29 "D3DERR_UNSUPPORTEDCOLOROPERATION",
30 "D3DERR_UNSUPPORTEDCOLORARG",
31 "D3DERR_UNSUPPORTEDALPHAOPERATION",
32 "D3DERR_UNSUPPORTEDALPHAARG",
33 "D3DERR_TOOMANYOPERATIONS",
34 "D3DERR_CONFLICTINGTEXTUREFILTER",
35 "D3DERR_UNSUPPORTEDFACTORVALUE",
36 "D3DERR_CONFLICTINGRENDERSTATE",
37 "D3DERR_UNSUPPORTEDTEXTUREFILTER",
38 "D3DERR_CONFLICTINGTEXTUREPALETTE",
39 "D3DERR_DRIVERINTERNALERROR",
43 "D3DERR_DEVICENOTRESET",
44 "D3DERR_NOTAVAILABLE",
45 "D3DERR_OUTOFVIDEOMEMORY",
46 "D3DERR_INVALIDDEVICE",
48 "D3DERR_DRIVERINVALIDCALL",
49 "D3DERR_WASSTILLDRAWING",
51 "D3DERR_DEVICEREMOVED",
53 "S_RESIDENT_IN_SHARED_MEMORY",
54 "S_PRESENT_MODE_CHANGED",
59 IDirect3D9 = Interface("IDirect3D9", IUnknown)
60 IDirect3DDevice9 = Interface("IDirect3DDevice9", IUnknown)
61 IDirect3DStateBlock9 = Interface("IDirect3DStateBlock9", IUnknown)
62 IDirect3DSwapChain9 = Interface("IDirect3DSwapChain9", IUnknown)
63 IDirect3DResource9 = Interface("IDirect3DResource9", IUnknown)
64 IDirect3DVertexDeclaration9 = Interface("IDirect3DVertexDeclaration9", IUnknown)
65 IDirect3DVertexShader9 = Interface("IDirect3DVertexShader9", IUnknown)
66 IDirect3DPixelShader9 = Interface("IDirect3DPixelShader9", IUnknown)
67 IDirect3DBaseTexture9 = Interface("IDirect3DBaseTexture9", IDirect3DResource9)
68 IDirect3DTexture9 = Interface("IDirect3DTexture9", IDirect3DBaseTexture9)
69 IDirect3DVolumeTexture9 = Interface("IDirect3DVolumeTexture9", IDirect3DBaseTexture9)
70 IDirect3DCubeTexture9 = Interface("IDirect3DCubeTexture9", IDirect3DBaseTexture9)
71 IDirect3DVertexBuffer9 = Interface("IDirect3DVertexBuffer9", IDirect3DResource9)
72 IDirect3DIndexBuffer9 = Interface("IDirect3DIndexBuffer9", IDirect3DResource9)
73 IDirect3DSurface9 = Interface("IDirect3DSurface9", IDirect3DResource9)
74 IDirect3DVolume9 = Interface("IDirect3DVolume9", IUnknown)
75 IDirect3DQuery9 = Interface("IDirect3DQuery9", IUnknown)
76 IDirect3D9Ex = Interface("IDirect3D9Ex", IDirect3D9)
77 IDirect3DDevice9Ex = Interface("IDirect3DDevice9Ex", IDirect3DDevice9)
78 IDirect3DSwapChain9Ex = Interface("IDirect3DSwapChain9Ex", IDirect3DSwapChain9)
80 PDIRECT3D9 = WrapPointer(IDirect3D9)
81 PDIRECT3DDEVICE9 = WrapPointer(IDirect3DDevice9)
82 PDIRECT3DSTATEBLOCK9 = WrapPointer(IDirect3DStateBlock9)
83 PDIRECT3DSWAPCHAIN9 = WrapPointer(IDirect3DSwapChain9)
84 PDIRECT3DRESOURCE9 = WrapPointer(IDirect3DResource9)
85 PDIRECT3DVERTEXDECLARATION9 = WrapPointer(IDirect3DVertexDeclaration9)
86 PDIRECT3DVERTEXSHADER9 = WrapPointer(IDirect3DVertexShader9)
87 PDIRECT3DPIXELSHADER9 = WrapPointer(IDirect3DPixelShader9)
88 PDIRECT3DBASETEXTURE9 = WrapPointer(IDirect3DBaseTexture9)
89 PDIRECT3DTEXTURE9 = WrapPointer(IDirect3DTexture9)
90 PDIRECT3DVOLUMETEXTURE9 = WrapPointer(IDirect3DVolumeTexture9)
91 PDIRECT3DCUBETEXTURE9 = WrapPointer(IDirect3DCubeTexture9)
92 PDIRECT3DVERTEXBUFFER9 = WrapPointer(IDirect3DVertexBuffer9)
93 PDIRECT3DINDEXBUFFER9 = WrapPointer(IDirect3DIndexBuffer9)
94 PDIRECT3DSURFACE9 = WrapPointer(IDirect3DSurface9)
95 PDIRECT3DVOLUME9 = WrapPointer(IDirect3DVolume9)
96 PDIRECT3DQUERY9 = WrapPointer(IDirect3DQuery9)
97 PDIRECT3D9EX = WrapPointer(IDirect3D9Ex)
98 PDIRECT3DDEVICE9EX = WrapPointer(IDirect3DDevice9Ex)
99 PDIRECT3DSWAPCHAIN9EX = WrapPointer(IDirect3DSwapChain9Ex)
101 IDirect3D9.methods += [
102 Method(HRESULT, "RegisterSoftwareDevice", [(Pointer(Void), "pInitializeFunction")]),
103 Method(UINT, "GetAdapterCount", []),
104 Method(HRESULT, "GetAdapterIdentifier", [(UINT, "Adapter"), (DWORD, "Flags"), (OutPointer(D3DADAPTER_IDENTIFIER9), "pIdentifier")]),
105 Method(UINT, "GetAdapterModeCount", [(UINT, "Adapter"), (D3DFORMAT, "Format")]),
106 Method(HRESULT, "EnumAdapterModes", [(UINT, "Adapter"), (D3DFORMAT, "Format"), (UINT, "Mode"), (OutPointer(D3DDISPLAYMODE), "pMode")]),
107 Method(HRESULT, "GetAdapterDisplayMode", [(UINT, "Adapter"), (OutPointer(D3DDISPLAYMODE), "pMode")]),
108 Method(HRESULT, "CheckDeviceType", [(UINT, "Adapter"), (D3DDEVTYPE, "DevType"), (D3DFORMAT, "AdapterFormat"), (D3DFORMAT, "BackBufferFormat"), (BOOL, "bWindowed")]),
109 Method(HRESULT, "CheckDeviceFormat", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "AdapterFormat"), (DWORD, "Usage"), (D3DRESOURCETYPE, "RType"), (D3DFORMAT, "CheckFormat")]),
110 Method(HRESULT, "CheckDeviceMultiSampleType", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "SurfaceFormat"), (BOOL, "Windowed"), (D3DMULTISAMPLE_TYPE, "MultiSampleType"), (OutPointer(DWORD), "pQualityLevels")]),
111 Method(HRESULT, "CheckDepthStencilMatch", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "AdapterFormat"), (D3DFORMAT, "RenderTargetFormat"), (D3DFORMAT, "DepthStencilFormat")]),
112 Method(HRESULT, "CheckDeviceFormatConversion", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "SourceFormat"), (D3DFORMAT, "TargetFormat")]),
113 Method(HRESULT, "GetDeviceCaps", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (OutPointer(D3DCAPS9), "pCaps")]),
114 Method(HMONITOR, "GetAdapterMonitor", [(UINT, "Adapter")]),
115 Method(HRESULT, "CreateDevice", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (DWORD, "BehaviorFlags"), (OutPointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (OutPointer(PDIRECT3DDEVICE9), "ppReturnedDeviceInterface")]),
118 IDirect3DDevice9.methods += [
119 Method(HRESULT, "TestCooperativeLevel", []),
120 Method(UINT, "GetAvailableTextureMem", []),
121 Method(HRESULT, "EvictManagedResources", []),
122 Method(HRESULT, "GetDirect3D", [(OutPointer(PDIRECT3D9), "ppD3D9")]),
123 Method(HRESULT, "GetDeviceCaps", [(OutPointer(D3DCAPS9), "pCaps")]),
124 Method(HRESULT, "GetDisplayMode", [(UINT, "iSwapChain"), (OutPointer(D3DDISPLAYMODE), "pMode")]),
125 Method(HRESULT, "GetCreationParameters", [(OutPointer(D3DDEVICE_CREATION_PARAMETERS), "pParameters")]),
126 Method(HRESULT, "SetCursorProperties", [(UINT, "XHotSpot"), (UINT, "YHotSpot"), (PDIRECT3DSURFACE9, "pCursorBitmap")]),
127 Method(Void, "SetCursorPosition", [(Int, "X"), (Int, "Y"), (DWORD, "Flags")]),
128 Method(BOOL, "ShowCursor", [(BOOL, "bShow")]),
129 Method(HRESULT, "CreateAdditionalSwapChain", [(OutPointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (OutPointer(PDIRECT3DSWAPCHAIN9), "pSwapChain")]),
130 Method(HRESULT, "GetSwapChain", [(UINT, "iSwapChain"), (OutPointer(PDIRECT3DSWAPCHAIN9), "pSwapChain")]),
131 Method(UINT, "GetNumberOfSwapChains", []),
132 Method(HRESULT, "Reset", [(OutPointer(D3DPRESENT_PARAMETERS), "pPresentationParameters")]),
133 Method(HRESULT, "Present", [(ConstPointer(RECT), "pSourceRect"), (ConstPointer(RECT), "pDestRect"), (HWND, "hDestWindowOverride"), (ConstPointer(RGNDATA), "pDirtyRegion")]),
134 Method(HRESULT, "GetBackBuffer", [(UINT, "iSwapChain"), (UINT, "iBackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), (OutPointer(PDIRECT3DSURFACE9), "ppBackBuffer")]),
135 Method(HRESULT, "GetRasterStatus", [(UINT, "iSwapChain"), (OutPointer(D3DRASTER_STATUS), "pRasterStatus")]),
136 Method(HRESULT, "SetDialogBoxMode", [(BOOL, "bEnableDialogs")]),
137 Method(Void, "SetGammaRamp", [(UINT, "iSwapChain"), (DWORD, "Flags"), (ConstPointer(D3DGAMMARAMP), "pRamp")]),
138 Method(Void, "GetGammaRamp", [(UINT, "iSwapChain"), (OutPointer(D3DGAMMARAMP), "pRamp")]),
139 Method(HRESULT, "CreateTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DTEXTURE9), "ppTexture"), (OutPointer(HANDLE), "pSharedHandle")]),
140 Method(HRESULT, "CreateVolumeTexture", [(UINT, "Width"), (UINT, "Height"), (UINT, "Depth"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DVOLUMETEXTURE9), "ppVolumeTexture"), (OutPointer(HANDLE), "pSharedHandle")]),
141 Method(HRESULT, "CreateCubeTexture", [(UINT, "EdgeLength"), (UINT, "Levels"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DCUBETEXTURE9), "ppCubeTexture"), (OutPointer(HANDLE), "pSharedHandle")]),
142 Method(HRESULT, "CreateVertexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (DWORD, "FVF"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DVERTEXBUFFER9), "ppVertexBuffer"), (OutPointer(HANDLE), "pSharedHandle")]),
143 Method(HRESULT, "CreateIndexBuffer", [(UINT, "Length"), (DWORD, "Usage"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DINDEXBUFFER9), "ppIndexBuffer"), (OutPointer(HANDLE), "pSharedHandle")]),
144 Method(HRESULT, "CreateRenderTarget", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (DWORD, "MultisampleQuality"), (BOOL, "Lockable"), (OutPointer(PDIRECT3DSURFACE9), "ppSurface"), (OutPointer(HANDLE), "pSharedHandle")]),
145 Method(HRESULT, "CreateDepthStencilSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (DWORD, "MultisampleQuality"), (BOOL, "Discard"), (OutPointer(PDIRECT3DSURFACE9), "ppSurface"), (OutPointer(HANDLE), "pSharedHandle")]),
146 Method(HRESULT, "UpdateSurface", [(PDIRECT3DSURFACE9, "pSourceSurface"), (ConstPointer(RECT), "pSourceRect"), (PDIRECT3DSURFACE9, "pDestinationSurface"), (ConstPointer(POINT), "pDestPoint")]),
147 Method(HRESULT, "UpdateTexture", [(PDIRECT3DBASETEXTURE9, "pSourceTexture"), (PDIRECT3DBASETEXTURE9, "pDestinationTexture")]),
148 Method(HRESULT, "GetRenderTargetData", [(PDIRECT3DSURFACE9, "pRenderTarget"), (PDIRECT3DSURFACE9, "pDestSurface")]),
149 Method(HRESULT, "GetFrontBufferData", [(UINT, "iSwapChain"), (PDIRECT3DSURFACE9, "pDestSurface")]),
150 Method(HRESULT, "StretchRect", [(PDIRECT3DSURFACE9, "pSourceSurface"), (ConstPointer(RECT), "pSourceRect"), (PDIRECT3DSURFACE9, "pDestSurface"), (ConstPointer(RECT), "pDestRect"), (D3DTEXTUREFILTERTYPE, "Filter")]),
151 Method(HRESULT, "ColorFill", [(PDIRECT3DSURFACE9, "pSurface"), (ConstPointer(RECT), "pRect"), (D3DCOLOR, "color")]),
152 Method(HRESULT, "CreateOffscreenPlainSurface", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DSURFACE9), "ppSurface"), (OutPointer(HANDLE), "pSharedHandle")]),
153 Method(HRESULT, "SetRenderTarget", [(DWORD, "RenderTargetIndex"), (PDIRECT3DSURFACE9, "pRenderTarget")]),
154 Method(HRESULT, "GetRenderTarget", [(DWORD, "RenderTargetIndex"), (OutPointer(PDIRECT3DSURFACE9), "ppRenderTarget")]),
155 Method(HRESULT, "SetDepthStencilSurface", [(PDIRECT3DSURFACE9, "pNewZStencil")]),
156 Method(HRESULT, "GetDepthStencilSurface", [(OutPointer(PDIRECT3DSURFACE9), "ppZStencilSurface")]),
157 Method(HRESULT, "BeginScene", []),
158 Method(HRESULT, "EndScene", []),
159 Method(HRESULT, "Clear", [(DWORD, "Count"), (ConstPointer(D3DRECT), "pRects"), (DWORD, "Flags"), (D3DCOLOR, "Color"), (Float, "Z"), (DWORD, "Stencil")]),
160 Method(HRESULT, "SetTransform", [(D3DTRANSFORMSTATETYPE, "State"), (ConstPointer(D3DMATRIX), "pMatrix")]),
161 Method(HRESULT, "GetTransform", [(D3DTRANSFORMSTATETYPE, "State"), (OutPointer(D3DMATRIX), "pMatrix")]),
162 Method(HRESULT, "MultiplyTransform", [(D3DTRANSFORMSTATETYPE, "State"), (ConstPointer(D3DMATRIX), "pMatrix")]),
163 Method(HRESULT, "SetViewport", [(ConstPointer(D3DVIEWPORT9), "pViewport")]),
164 Method(HRESULT, "GetViewport", [(OutPointer(D3DVIEWPORT9), "pViewport")]),
165 Method(HRESULT, "SetMaterial", [(ConstPointer(D3DMATERIAL9), "pMaterial")]),
166 Method(HRESULT, "GetMaterial", [(OutPointer(D3DMATERIAL9), "pMaterial")]),
167 Method(HRESULT, "SetLight", [(DWORD, "Index"), (ConstPointer(D3DLIGHT9), "pLight")]),
168 Method(HRESULT, "GetLight", [(DWORD, "Index"), (OutPointer(D3DLIGHT9), "pLight")]),
169 Method(HRESULT, "LightEnable", [(DWORD, "Index"), (BOOL, "Enable")]),
170 Method(HRESULT, "GetLightEnable", [(DWORD, "Index"), (OutPointer(BOOL), "pEnable")]),
171 Method(HRESULT, "SetClipPlane", [(DWORD, "Index"), (ConstPointer(Float), "pPlane")]),
172 Method(HRESULT, "GetClipPlane", [(DWORD, "Index"), (OutPointer(Float), "pPlane")]),
173 Method(HRESULT, "SetRenderState", [(D3DRENDERSTATETYPE, "State"), (DWORD, "Value")]),
174 Method(HRESULT, "GetRenderState", [(D3DRENDERSTATETYPE, "State"), (OutPointer(DWORD), "pValue")]),
175 Method(HRESULT, "CreateStateBlock", [(D3DSTATEBLOCKTYPE, "Type"), (OutPointer(PDIRECT3DSTATEBLOCK9), "ppSB")]),
176 Method(HRESULT, "BeginStateBlock", []),
177 Method(HRESULT, "EndStateBlock", [(OutPointer(PDIRECT3DSTATEBLOCK9), "ppSB")]),
178 Method(HRESULT, "SetClipStatus", [(ConstPointer(D3DCLIPSTATUS9), "pClipStatus")]),
179 Method(HRESULT, "GetClipStatus", [(OutPointer(D3DCLIPSTATUS9), "pClipStatus")]),
180 Method(HRESULT, "GetTexture", [(DWORD, "Stage"), (OutPointer(PDIRECT3DBASETEXTURE9), "ppTexture")]),
181 Method(HRESULT, "SetTexture", [(DWORD, "Stage"), (PDIRECT3DBASETEXTURE9, "pTexture")]),
182 Method(HRESULT, "GetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), (OutPointer(DWORD), "pValue")]),
183 Method(HRESULT, "SetTextureStageState", [(DWORD, "Stage"), (D3DTEXTURESTAGESTATETYPE, "Type"), (DWORD, "Value")]),
184 Method(HRESULT, "GetSamplerState", [(DWORD, "Sampler"), (D3DSAMPLERSTATETYPE, "Type"), (OutPointer(DWORD), "pValue")]),
185 Method(HRESULT, "SetSamplerState", [(DWORD, "Sampler"), (D3DSAMPLERSTATETYPE, "Type"), (DWORD, "Value")]),
186 Method(HRESULT, "ValidateDevice", [(OutPointer(DWORD), "pNumPasses")]),
187 Method(HRESULT, "SetPaletteEntries", [(UINT, "PaletteNumber"), (ConstPointer(PALETTEENTRY), "pEntries")]),
188 Method(HRESULT, "GetPaletteEntries", [(UINT, "PaletteNumber"), (OutPointer(PALETTEENTRY), "pEntries")]),
189 Method(HRESULT, "SetCurrentTexturePalette", [(UINT, "PaletteNumber")]),
190 Method(HRESULT, "GetCurrentTexturePalette", [(OutPointer(UINT), "PaletteNumber")]),
191 Method(HRESULT, "SetScissorRect", [(ConstPointer(RECT), "pRect")]),
192 Method(HRESULT, "GetScissorRect", [(OutPointer(RECT), "pRect")]),
193 Method(HRESULT, "SetSoftwareVertexProcessing", [(BOOL, "bSoftware")]),
194 Method(BOOL, "GetSoftwareVertexProcessing", []),
195 Method(HRESULT, "SetNPatchMode", [(Float, "nSegments")]),
196 Method(Float, "GetNPatchMode", []),
197 Method(HRESULT, "DrawPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "StartVertex"), (UINT, "PrimitiveCount")]),
198 Method(HRESULT, "DrawIndexedPrimitive", [(D3DPRIMITIVETYPE, "PrimitiveType"), (INT, "BaseVertexIndex"), (UINT, "MinVertexIndex"), (UINT, "NumVertices"), (UINT, "startIndex"), (UINT, "primCount")]),
199 Method(HRESULT, "DrawPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "PrimitiveCount"), (ConstPointer(Void), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]),
200 Method(HRESULT, "DrawIndexedPrimitiveUP", [(D3DPRIMITIVETYPE, "PrimitiveType"), (UINT, "MinVertexIndex"), (UINT, "NumVertices"), (UINT, "PrimitiveCount"), (ConstPointer(Void), "pIndexData"), (D3DFORMAT, "IndexDataFormat"), (ConstPointer(Void), "pVertexStreamZeroData"), (UINT, "VertexStreamZeroStride")]),
201 Method(HRESULT, "ProcessVertices", [(UINT, "SrcStartIndex"), (UINT, "DestIndex"), (UINT, "VertexCount"), (PDIRECT3DVERTEXBUFFER9, "pDestBuffer"), (PDIRECT3DVERTEXDECLARATION9, "pVertexDecl"), (DWORD, "Flags")]),
202 Method(HRESULT, "CreateVertexDeclaration", [(ConstPointer(D3DVERTEXELEMENT9), "pVertexElements"), (OutPointer(PDIRECT3DVERTEXDECLARATION9), "ppDecl")]),
203 Method(HRESULT, "SetVertexDeclaration", [(PDIRECT3DVERTEXDECLARATION9, "pDecl")]),
204 Method(HRESULT, "GetVertexDeclaration", [(OutPointer(PDIRECT3DVERTEXDECLARATION9), "ppDecl")]),
205 Method(HRESULT, "SetFVF", [(DWORD, "FVF")]),
206 Method(HRESULT, "GetFVF", [(OutPointer(DWORD), "pFVF")]),
207 Method(HRESULT, "CreateVertexShader", [(ConstPointer(DWORD), "pFunction"), (OutPointer(PDIRECT3DVERTEXSHADER9), "ppShader")]),
208 Method(HRESULT, "SetVertexShader", [(PDIRECT3DVERTEXSHADER9, "pShader")]),
209 Method(HRESULT, "GetVertexShader", [(OutPointer(PDIRECT3DVERTEXSHADER9), "ppShader")]),
210 Method(HRESULT, "SetVertexShaderConstantF", [(UINT, "StartRegister"), (ConstPointer(Float), "pConstantData"), (UINT, "Vector4fCount")]),
211 Method(HRESULT, "GetVertexShaderConstantF", [(UINT, "StartRegister"), (OutPointer(Float), "pConstantData"), (UINT, "Vector4fCount")]),
212 Method(HRESULT, "SetVertexShaderConstantI", [(UINT, "StartRegister"), (ConstPointer(Int), "pConstantData"), (UINT, "Vector4iCount")]),
213 Method(HRESULT, "GetVertexShaderConstantI", [(UINT, "StartRegister"), (OutPointer(Int), "pConstantData"), (UINT, "Vector4iCount")]),
214 Method(HRESULT, "SetVertexShaderConstantB", [(UINT, "StartRegister"), (ConstPointer(BOOL), "pConstantData"), (UINT, "BoolCount")]),
215 Method(HRESULT, "GetVertexShaderConstantB", [(UINT, "StartRegister"), (OutPointer(BOOL), "pConstantData"), (UINT, "BoolCount")]),
216 Method(HRESULT, "SetStreamSource", [(UINT, "StreamNumber"), (PDIRECT3DVERTEXBUFFER9, "pStreamData"), (UINT, "OffsetInBytes"), (UINT, "Stride")]),
217 Method(HRESULT, "GetStreamSource", [(UINT, "StreamNumber"), (OutPointer(PDIRECT3DVERTEXBUFFER9), "ppStreamData"), (OutPointer(UINT), "pOffsetInBytes"), (OutPointer(UINT), "pStride")]),
218 Method(HRESULT, "SetStreamSourceFreq", [(UINT, "StreamNumber"), (UINT, "Setting")]),
219 Method(HRESULT, "GetStreamSourceFreq", [(UINT, "StreamNumber"), (OutPointer(UINT), "pSetting")]),
220 Method(HRESULT, "SetIndices", [(PDIRECT3DINDEXBUFFER9, "pIndexData")]),
221 Method(HRESULT, "GetIndices", [(OutPointer(PDIRECT3DINDEXBUFFER9), "ppIndexData")]),
222 Method(HRESULT, "CreatePixelShader", [(ConstPointer(DWORD), "pFunction"), (OutPointer(PDIRECT3DPIXELSHADER9), "ppShader")]),
223 Method(HRESULT, "SetPixelShader", [(PDIRECT3DPIXELSHADER9, "pShader")]),
224 Method(HRESULT, "GetPixelShader", [(OutPointer(PDIRECT3DPIXELSHADER9), "ppShader")]),
225 Method(HRESULT, "SetPixelShaderConstantF", [(UINT, "StartRegister"), (ConstPointer(Float), "pConstantData"), (UINT, "Vector4fCount")]),
226 Method(HRESULT, "GetPixelShaderConstantF", [(UINT, "StartRegister"), (OutPointer(Float), "pConstantData"), (UINT, "Vector4fCount")]),
227 Method(HRESULT, "SetPixelShaderConstantI", [(UINT, "StartRegister"), (ConstPointer(Int), "pConstantData"), (UINT, "Vector4iCount")]),
228 Method(HRESULT, "GetPixelShaderConstantI", [(UINT, "StartRegister"), (OutPointer(Int), "pConstantData"), (UINT, "Vector4iCount")]),
229 Method(HRESULT, "SetPixelShaderConstantB", [(UINT, "StartRegister"), (ConstPointer(BOOL), "pConstantData"), (UINT, "BoolCount")]),
230 Method(HRESULT, "GetPixelShaderConstantB", [(UINT, "StartRegister"), (OutPointer(BOOL), "pConstantData"), (UINT, "BoolCount")]),
231 Method(HRESULT, "DrawRectPatch", [(UINT, "Handle"), (ConstPointer(Float), "pNumSegs"), (ConstPointer(D3DRECTPATCH_INFO), "pRectPatchInfo")]),
232 Method(HRESULT, "DrawTriPatch", [(UINT, "Handle"), (ConstPointer(Float), "pNumSegs"), (ConstPointer(D3DTRIPATCH_INFO), "pTriPatchInfo")]),
233 Method(HRESULT, "DeletePatch", [(UINT, "Handle")]),
234 Method(HRESULT, "CreateQuery", [(D3DQUERYTYPE, "Type"), (OutPointer(PDIRECT3DQUERY9), "ppQuery")]),
237 IDirect3DStateBlock9.methods += [
238 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
239 Method(HRESULT, "Capture", []),
240 Method(HRESULT, "Apply", []),
243 IDirect3DSwapChain9.methods += [
244 Method(HRESULT, "Present", [(ConstPointer(RECT), "pSourceRect"), (ConstPointer(RECT), "pDestRect"), (HWND, "hDestWindowOverride"), (ConstPointer(RGNDATA), "pDirtyRegion"), (DWORD, "dwFlags")]),
245 Method(HRESULT, "GetFrontBufferData", [(PDIRECT3DSURFACE9, "pDestSurface")]),
246 Method(HRESULT, "GetBackBuffer", [(UINT, "iBackBuffer"), (D3DBACKBUFFER_TYPE, "Type"), (OutPointer(PDIRECT3DSURFACE9), "ppBackBuffer")]),
247 Method(HRESULT, "GetRasterStatus", [(OutPointer(D3DRASTER_STATUS), "pRasterStatus")]),
248 Method(HRESULT, "GetDisplayMode", [(OutPointer(D3DDISPLAYMODE), "pMode")]),
249 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
250 Method(HRESULT, "GetPresentParameters", [(OutPointer(D3DPRESENT_PARAMETERS), "pPresentationParameters")]),
253 IDirect3DResource9.methods += [
254 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
255 Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
256 Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (OutPointer(Void), "pData"), (OutPointer(DWORD), "pSizeOfData")]),
257 Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
258 Method(DWORD, "SetPriority", [(DWORD, "PriorityNew")]),
259 Method(DWORD, "GetPriority", []),
260 Method(Void, "PreLoad", []),
261 Method(D3DRESOURCETYPE, "GetType", []),
264 IDirect3DVertexDeclaration9.methods += [
265 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
266 Method(HRESULT, "GetDeclaration", [(OutPointer(D3DVERTEXELEMENT9), "pElement"), (OutPointer(UINT), "pNumElements")]),
269 IDirect3DVertexShader9.methods += [
270 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
271 Method(HRESULT, "GetFunction", [(OutPointer(Void), "pData"), (OutPointer(UINT), "pSizeOfData")]),
274 IDirect3DPixelShader9.methods += [
275 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
276 Method(HRESULT, "GetFunction", [(OutPointer(Void), "pData"), (OutPointer(UINT), "pSizeOfData")]),
279 IDirect3DBaseTexture9.methods += [
280 Method(DWORD, "SetLOD", [(DWORD, "LODNew")]),
281 Method(DWORD, "GetLOD", []),
282 Method(DWORD, "GetLevelCount", []),
283 Method(HRESULT, "SetAutoGenFilterType", [(D3DTEXTUREFILTERTYPE, "FilterType")]),
284 Method(D3DTEXTUREFILTERTYPE, "GetAutoGenFilterType", []),
285 Method(Void, "GenerateMipSubLevels", []),
288 IDirect3DTexture9.methods += [
289 Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), (OutPointer(D3DSURFACE_DESC), "pDesc")]),
290 Method(HRESULT, "GetSurfaceLevel", [(UINT, "Level"), (OutPointer(PDIRECT3DSURFACE9), "ppSurfaceLevel")]),
291 Method(HRESULT, "LockRect", [(UINT, "Level"), (OutPointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]),
292 Method(HRESULT, "UnlockRect", [(UINT, "Level")]),
293 Method(HRESULT, "AddDirtyRect", [(ConstPointer(RECT), "pDirtyRect")]),
296 IDirect3DVolumeTexture9.methods += [
297 Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), (OutPointer(D3DVOLUME_DESC), "pDesc")]),
298 Method(HRESULT, "GetVolumeLevel", [(UINT, "Level"), (OutPointer(PDIRECT3DVOLUME9), "ppVolumeLevel")]),
299 Method(HRESULT, "LockBox", [(UINT, "Level"), (OutPointer(D3DLOCKED_BOX), "pLockedVolume"), (ConstPointer(D3DBOX), "pBox"), (DWORD, "Flags")]),
300 Method(HRESULT, "UnlockBox", [(UINT, "Level")]),
301 Method(HRESULT, "AddDirtyBox", [(ConstPointer(D3DBOX), "pDirtyBox")]),
304 IDirect3DCubeTexture9.methods += [
305 Method(HRESULT, "GetLevelDesc", [(UINT, "Level"), (OutPointer(D3DSURFACE_DESC), "pDesc")]),
306 Method(HRESULT, "GetCubeMapSurface", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), (OutPointer(PDIRECT3DSURFACE9), "ppCubeMapSurface")]),
307 Method(HRESULT, "LockRect", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level"), (OutPointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]),
308 Method(HRESULT, "UnlockRect", [(D3DCUBEMAP_FACES, "FaceType"), (UINT, "Level")]),
309 Method(HRESULT, "AddDirtyRect", [(D3DCUBEMAP_FACES, "FaceType"), (ConstPointer(RECT), "pDirtyRect")]),
312 IDirect3DVertexBuffer9.methods += [
313 Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), (OutPointer(Pointer(Void)), "ppbData"), (DWORD, "Flags")]),
314 Method(HRESULT, "Unlock", []),
315 Method(HRESULT, "GetDesc", [(OutPointer(D3DVERTEXBUFFER_DESC), "pDesc")]),
318 IDirect3DIndexBuffer9.methods += [
319 Method(HRESULT, "Lock", [(UINT, "OffsetToLock"), (UINT, "SizeToLock"), (OutPointer(Pointer(Void)), "ppbData"), (DWORD, "Flags")]),
320 Method(HRESULT, "Unlock", []),
321 Method(HRESULT, "GetDesc", [(OutPointer(D3DINDEXBUFFER_DESC), "pDesc")]),
324 IDirect3DSurface9.methods += [
325 Method(HRESULT, "GetContainer", [(REFIID, "riid"), (OutPointer(Pointer(Void)), "ppContainer")]),
326 Method(HRESULT, "GetDesc", [(OutPointer(D3DSURFACE_DESC), "pDesc")]),
327 Method(HRESULT, "LockRect", [(OutPointer(D3DLOCKED_RECT), "pLockedRect"), (ConstPointer(RECT), "pRect"), (DWORD, "Flags")]),
328 Method(HRESULT, "UnlockRect", []),
329 Method(HRESULT, "GetDC", [(OutPointer(HDC), "phdc")]),
330 Method(HRESULT, "ReleaseDC", [(HDC, "hdc")]),
333 IDirect3DVolume9.methods += [
334 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
335 Method(HRESULT, "SetPrivateData", [(REFGUID, "refguid"), (ConstPointer(Void), "pData"), (DWORD, "SizeOfData"), (DWORD, "Flags")]),
336 Method(HRESULT, "GetPrivateData", [(REFGUID, "refguid"), (OutPointer(Void), "pData"), (OutPointer(DWORD), "pSizeOfData")]),
337 Method(HRESULT, "FreePrivateData", [(REFGUID, "refguid")]),
338 Method(HRESULT, "GetContainer", [(REFIID, "riid"), (OutPointer(Pointer(Void)), "ppContainer")]),
339 Method(HRESULT, "GetDesc", [(OutPointer(D3DVOLUME_DESC), "pDesc")]),
340 Method(HRESULT, "LockBox", [(OutPointer(D3DLOCKED_BOX), "pLockedVolume"), (ConstPointer(D3DBOX), "pBox"), (DWORD, "Flags")]),
341 Method(HRESULT, "UnlockBox", []),
344 IDirect3DQuery9.methods += [
345 Method(HRESULT, "GetDevice", [(OutPointer(PDIRECT3DDEVICE9), "ppDevice")]),
346 Method(D3DQUERYTYPE, "GetType", []),
347 Method(DWORD, "GetDataSize", []),
348 Method(HRESULT, "Issue", [(DWORD, "dwIssueFlags")]),
349 Method(HRESULT, "GetData", [(OutPointer(Void), "pData"), (DWORD, "dwSize"), (DWORD, "dwGetDataFlags")]),
352 IDirect3D9Ex.methods += [
353 Method(UINT, "GetAdapterModeCountEx", [(UINT, "Adapter"), (ConstPointer(D3DDISPLAYMODEFILTER), "pFilter") ]),
354 Method(HRESULT, "EnumAdapterModesEx", [(UINT, "Adapter"), (ConstPointer(D3DDISPLAYMODEFILTER), "pFilter"), (UINT, "Mode"), (OutPointer(D3DDISPLAYMODEEX), "pMode")]),
355 Method(HRESULT, "GetAdapterDisplayModeEx", [(UINT, "Adapter"), (OutPointer(D3DDISPLAYMODEEX), "pMode"), (OutPointer(D3DDISPLAYROTATION), "pRotation")]),
356 Method(HRESULT, "CreateDeviceEx", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (DWORD, "BehaviorFlags"), (OutPointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (OutPointer(D3DDISPLAYMODEEX), "pFullscreenDisplayMode"), (OutPointer(PDIRECT3DDEVICE9EX), "ppReturnedDeviceInterface")]),
357 Method(HRESULT, "GetAdapterLUID", [(UINT, "Adapter"), (OutPointer(LUID), "pLUID")]),
360 IDirect3DDevice9Ex.methods += [
361 Method(HRESULT, "SetConvolutionMonoKernel", [(UINT, "width"), (UINT, "height"), (OutPointer(Float), "rows"), (OutPointer(Float), "columns")]),
362 Method(HRESULT, "ComposeRects", [(PDIRECT3DSURFACE9, "pSrc"), (PDIRECT3DSURFACE9, "pDst"), (PDIRECT3DVERTEXBUFFER9, "pSrcRectDescs"), (UINT, "NumRects"), (PDIRECT3DVERTEXBUFFER9, "pDstRectDescs"), (D3DCOMPOSERECTSOP, "Operation"), (Int, "Xoffset"), (Int, "Yoffset")]),
363 Method(HRESULT, "PresentEx", [(ConstPointer(RECT), "pSourceRect"), (ConstPointer(RECT), "pDestRect"), (HWND, "hDestWindowOverride"), (ConstPointer(RGNDATA), "pDirtyRegion"), (DWORD, "dwFlags")]),
364 Method(HRESULT, "GetGPUThreadPriority", [(OutPointer(INT), "pPriority")]),
365 Method(HRESULT, "SetGPUThreadPriority", [(INT, "Priority")]),
366 Method(HRESULT, "WaitForVBlank", [(UINT, "iSwapChain")]),
367 Method(HRESULT, "CheckResourceResidency", [(OutPointer(PDIRECT3DRESOURCE9), "pResourceArray"), (UINT32, "NumResources")]),
368 Method(HRESULT, "SetMaximumFrameLatency", [(UINT, "MaxLatency")]),
369 Method(HRESULT, "GetMaximumFrameLatency", [(OutPointer(UINT), "pMaxLatency")]),
370 Method(HRESULT, "CheckDeviceState", [(HWND, "hDestinationWindow")]),
371 Method(HRESULT, "CreateRenderTargetEx", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (DWORD, "MultisampleQuality"), (BOOL, "Lockable"), (OutPointer(PDIRECT3DSURFACE9), "ppSurface"), (OutPointer(HANDLE), "pSharedHandle"), (DWORD, "Usage")]),
372 Method(HRESULT, "CreateOffscreenPlainSurfaceEx", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DPOOL, "Pool"), (OutPointer(PDIRECT3DSURFACE9), "ppSurface"), (OutPointer(HANDLE), "pSharedHandle"), (DWORD, "Usage")]),
373 Method(HRESULT, "CreateDepthStencilSurfaceEx", [(UINT, "Width"), (UINT, "Height"), (D3DFORMAT, "Format"), (D3DMULTISAMPLE_TYPE, "MultiSample"), (DWORD, "MultisampleQuality"), (BOOL, "Discard"), (OutPointer(PDIRECT3DSURFACE9), "ppSurface"), (OutPointer(HANDLE), "pSharedHandle"), (DWORD, "Usage")]),
374 Method(HRESULT, "ResetEx", [(OutPointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), (OutPointer(D3DDISPLAYMODEEX), "pFullscreenDisplayMode")]),
375 Method(HRESULT, "GetDisplayModeEx", [(UINT, "iSwapChain"), (OutPointer(D3DDISPLAYMODEEX), "pMode"), (OutPointer(D3DDISPLAYROTATION), "pRotation")]),
378 IDirect3DSwapChain9Ex.methods += [
379 Method(HRESULT, "GetLastPresentCount", [(OutPointer(UINT), "pLastPresentCount")]),
380 Method(HRESULT, "GetPresentStats", [(OutPointer(D3DPRESENTSTATS), "pPresentationStatistics")]),
381 Method(HRESULT, "GetDisplayModeEx", [(OutPointer(D3DDISPLAYMODEEX), "pMode"), (OutPointer(D3DDISPLAYROTATION), "pRotation")]),
386 Function(PDIRECT3D9, "Direct3DCreate9", [(UINT, "SDKVersion")], fail='NULL'),
387 Function(HRESULT, "Direct3DCreate9Ex", [(UINT, "SDKVersion"), (OutPointer(PDIRECT3D9EX), "ppD3D")], fail='D3DERR_NOTAVAILABLE'),
390 if __name__ == '__main__':
391 print '#include <windows.h>'
392 print '#include <tchar.h>'
393 print '#include <d3d9.h>'
395 print '#include "log.hpp"'