'd3d9.sbp - Direct3D include file


#ifndef _INC_D3D9
#define _INC_D3D9


Const DIRECT3D_VERSION = &H0900
Const D3D_SDK_VERSION = 32

#require <directx9\d3d9types.sbp>
#require <directx9\d3d9caps.sbp>


'--------------
' DirectX9 API
'--------------

Declare Function Direct3DCreate9 Lib "d3d9.dll" (SDKVersion As DWord) As LPDIRECT3D9


'--------------------
' DirectX9 Interface
'--------------------

Interface IDirect3D9
	Inherits IUnknown
Public
	'IDirect3D9 methods
	Function ShoRegisterSoftwareDevice(pInitializeFunction As VoidPtr) As DWord
	Function GetAdapterCount() As DWord
	Function GetAdapterIdentifier(Adapter As DWord, Flags As DWord, pIdentifier As *D3DADAPTER_IDENTIFIER9) As DWord
	Function GetAdapterModeCount(Adapter As DWord, Format As D3DFORMAT) As DWord
	Function EnumAdapterModes(Adapter As DWord, Format As D3DFORMAT, Mode As DWord, pMode As *D3DDISPLAYMODE) As DWord
	Function GetAdapterDisplayMode(Adapter As DWord, pMode As *D3DDISPLAYMODE) As DWord
	Function CheckDeviceType(Adapter As DWord, DevType As D3DDEVTYPE, AdapterFormat As D3DFORMAT, BackBufferFormat As D3DFORMAT, bWindowed As Long) As DWord
	Function CheckDeviceFormat(Adapter As DWord, DeviceType As D3DDEVTYPE, AdapterFormat As D3DFORMAT, Usage As DWord, RType As D3DRESOURCETYPE, CheckFormat As D3DFORMAT) As DWord
	Function CheckDeviceMultiSampleType(Adapter As DWord, DeviceType As D3DDEVTYPE, SurfaceFormat As D3DFORMAT, Windowed As Long, MultiSampleType As D3DMULTISAMPLE_TYPE, pQualityLevels As DWordPtr) As DWord
	Function CheckDepthStencilMatch(Adapter As DWord, DeviceType As D3DDEVTYPE, AdapterFormat As D3DFORMAT, RenderTargetFormat As D3DFORMAT, DepthStencilFormat As D3DFORMAT) As DWord
	Function CheckDeviceFormatConversion(Adapter As DWord, DeviceType As D3DDEVTYPE, SourceFormat As D3DFORMAT, TargetFormat As D3DFORMAT) As DWord
	Function GetDeviceCaps(Adapter As DWord, DeviceType As D3DDEVTYPE, pCaps As *D3DCAPS9) As DWord
	Function GetAdapterMonitor(Adapter As DWord) As DWord
	Function CreateDevice(Adapter As DWord, DeviceType As D3DDEVTYPE, hFocusWindow As HWND, BehaviorFlags As DWord, pPresentationParameters As *D3DPRESENT_PARAMETERS, ppReturnedDeviceInterface As *LPDIRECT3DDEVICE9) As DWord
End Interface
TypeDef LPDIRECT3D9 = *IDirect3D9

Interface IDirect3DDevice9
	Inherits IUnknown
Public
	'IDirect3DDevice9 methods
	Function TestCooperativeLevel() As DWord
	Function GetAvailableTextureMem() As DWord
	Function EvictManagedResources() As DWord
	Function GetDirect3D(ppD3D9 As *LPDIRECT3D9) As DWord
	Function GetDeviceCaps(pCaps As *D3DCAPS9) As DWord
	Function GetDisplayMode(iSwapChain As DWord, pMode As DWordPtr) As DWord
	Function GetCreationParameters(pParameters As *D3DDEVICE_CREATION_PARAMETERS) As DWord
	Function SetCursorProperties(XHotSpot As DWord, YHotSpot As DWord,pCursorBitmap As *IDirect3DSurface9) As DWord
	Sub SetCursorPosition(X As Long, Y As Long, Flags As DWord)
	Function ShowCursor(bShow As Long) As Long
	Function CreateAdditionalSwapChain(pPresentationParameters As *D3DPRESENT_PARAMETERS, ppSwapChain As **IDirect3DSwapChain9) As DWord
	Function GetSwapChain(iSwapChain As DWord, ppSwapChain As **IDirect3DSwapChain9) As DWord
	Function GetNumberOfSwapChains() As DWord
	Function Reset(pPresentationParameters As *D3DPRESENT_PARAMETERS) As DWord
	Function Present(pSourceRect As *RECT, pDestRect As *RECT, hDestWindowOverride As DWord, pDirtyRegion As *RGNDATA) As DWord
	Function GetBackBuffer(iSwapChain As DWord, iBackBuffer As DWord, bufType As D3DBACKBUFFER_TYPE, ppBackBuffer As **IDirect3DSurface9) As DWord
	Function GetRasterStatus(iSwapChain As DWord, pRasterStatus As *D3DRASTER_STATUS) As DWord
	Function SetDialogBoxMode(bEnableDialogs As Long) As DWord
	Sub SetGammaRamp(iSwapChain As DWord, Flags As DWord, pRamp As *D3DGAMMARAMP)
	Sub GetGammaRamp(iSwapChain As DWord, pRamp As *D3DGAMMARAMP)
	Function CreateTexture(Width As DWord, Height As DWord, Levels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppTexture As **IDirect3DTexture9, pSharedHandle As DWordPtr) As DWord
	Function CreateVolumeTexture(Width As DWord, Height As DWord, Depth As DWord, Levels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppVolumeTexture As **IDirect3DVolumeTexture9, pSharedHandle As DWordPtr) As DWord
	Function CreateCubeTexture(EdgeLength As DWord, Levels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppCubeTexture As **IDirect3DCubeTexture9, pSharedHandle As DWordPtr) As DWord
	Function CreateVertexBuffer(Length As DWord, Usage As DWord, FVF As DWord, Pool As D3DPOOL, ppVertexBuffer As **IDirect3DVertexBuffer9, pSharedHandle As DWordPtr) As DWord
	Function CreateIndexBuffer(Length As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppIndexBuffer As **IDirect3DIndexBuffer9, pSharedHandle As DWordPtr) As DWord
	Function CreateRenderTarget(Width As DWord, Height As DWord, Format As D3DFORMAT, MultiSample As D3DMULTISAMPLE_TYPE, MultisampleQuality As DWord, Lockable As Long, ppSurface As **IDirect3DSurface9, pSharedHandle As DWordPtr) As DWord
	Function CreateDepthStencilSurface(Width As DWord, Height As DWord, Format As D3DFORMAT, MultiSample As D3DMULTISAMPLE_TYPE, MultisampleQuality As DWord, Discard As Long, ppSurface As **IDirect3DSurface9, pSharedHandle As DWordPtr) As DWord
	Function UpdateSurface(pSourceSurface As *IDirect3DSurface9, pSourceRect As *RECT, pDestinationSurface As *IDirect3DSurface9, pDestPoint As *POINTAPI) As DWord
	Function UpdateTexture(pSourceTexture As *IDirect3DBaseTexture9, pDestinationTexture As *IDirect3DBaseTexture9) As DWord
	Function GetRenderTargetData(pRenderTarget As *IDirect3DSurface9, pDestSurface As *IDirect3DSurface9) As DWord
	Function GetFrontBufferData(iSwapChain As DWord, pDestSurface As *IDirect3DSurface9) As DWord
	Function StretchRect(pSourceSurface As *IDirect3DSurface9, pSourceRect As *RECT, pDestSurface As *IDirect3DSurface9, pDestRect As *RECT, Filter As D3DTEXTUREFILTERTYPE) As DWord
	Function ColorFill(pSurface As *IDirect3DSurface9, pRect As *RECT,dwColor As DWord) As DWord
	Function CreateOffscreenPlainSurface(Width As DWord, Height As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppSurface As **IDirect3DSurface9, pSharedHandle As DWordPtr) As DWord
	Function SetRenderTarget(RenderTargetIndex As DWord, pRenderTarget As *IDirect3DSurface9) As DWord
	Function GetRenderTarget(RenderTargetIndex As DWord, ppRenderTarget As **IDirect3DSurface9) As DWord
	Function SetDepthStencilSurface(pNewZStencil As *IDirect3DSurface9) As DWord
	Function GetDepthStencilSurface(ppZStencilSurface As **IDirect3DSurface9) As DWord
	Function BeginScene() As DWord
	Function EndScene() As DWord
	Function Clear(Count As DWord, pRects As *D3DRECT, Flags As DWord, dwColor As DWord, Z As Single, Stencil As DWord) As DWord
	Function SetTransform(State As D3DTRANSFORMSTATETYPE, pMatrix As *D3DMATRIX) As DWord
	Function GetTransform(State As D3DTRANSFORMSTATETYPE, pMatrix As *D3DMATRIX) As DWord
	Function MultiplyTransform(State As D3DTRANSFORMSTATETYPE, pMatrix As *D3DMATRIX) As DWord
	Function SetViewport(pViewport As *D3DVIEWPORT9) As DWord
	Function GetViewport(pViewport As *D3DVIEWPORT9) As DWord
	Function SetMaterial(pMaterial As *D3DMATERIAL9) As DWord
	Function GetMaterial(pMaterial As *D3DMATERIAL9) As DWord
	Function SetLight(Index As DWord, pLight As *D3DLIGHT9) As DWord
	Function GetLight(Index As DWord, pLight As *D3DLIGHT9) As DWord
	Function LightEnable(Index As DWord, Enable As Long) As DWord
	Function GetLightEnable(Index As DWord, pEnable As DWordPtr) As DWord
	Function SetClipPlane(Index As DWord, pPlane As SinglePtr) As DWord
	Function GetClipPlane(Index As DWord, pPlane As SinglePtr) As DWord
	Function SetRenderState(State As D3DRENDERSTATETYPE, Value As DWord) As DWord
	Function GetRenderState(State As D3DRENDERSTATETYPE, pValue As DWordPtr) As DWord
	Function CreateStateBlock(BlockType As D3DSTATEBLOCKTYPE, ppSB As **IDirect3DStateBlock9) As DWord
	Function BeginStateBlock() As DWord
	Function EndStateBlock(ppSB As **IDirect3DStateBlock9) As DWord
	Function SetClipStatus(pClipStatus As *D3DCLIPSTATUS9) As DWord
	Function GetClipStatus(pClipStatus As *D3DCLIPSTATUS9) As DWord
	Function GetTexture(Stage As DWord, ppTexture As **IDirect3DBaseTexture9) As DWord
	Function SetTexture(Stage As DWord, pTexture As *IDirect3DBaseTexture9) As DWord
	Function GetTextureStageState(Stage As DWord, StateType As D3DTEXTURESTAGESTATETYPE, pValue As DWordPtr) As DWord
	Function SetTextureStageState(Stage As DWord, StateType As D3DTEXTURESTAGESTATETYPE, Value As DWord) As DWord
	Function GetSamplerState(Sampler As DWord, SamplerStateType As D3DSAMPLERSTATETYPE, pValue As DWordPtr) As DWord
	Function SetSamplerState(Sampler As DWord, SamplerStateType As D3DSAMPLERSTATETYPE, Value As DWord) As DWord
	Function ValidateDevice(pNumPasses As DWordPtr) As DWord
	Function SetPaletteEntries(PaletteNumber As DWord, pEntries As *PALETTEENTRY) As DWord
	Function GetPaletteEntries(PaletteNumber As DWord, pEntries As *PALETTEENTRY) As DWord
	Function SetCurrentTexturePalette(PaletteNumber As DWord) As DWord
	Function GetCurrentTexturePalette(pPaletteNumber As DWordPtr) As DWord
	Function SetScissorRect(pRect As *RECT) As DWord
	Function GetScissorRect(pRect As *RECT) As DWord
	Function SetSoftwareVertexProcessing(bSoftware As Long) As DWord
	Function GetSoftwareVertexProcessing() As Long
	Function SetNPatchMode(nSegments As Single) As DWord
	Function GetNPatchMode() As Single
	Function DrawPrimitive(PrimitiveType As D3DPRIMITIVETYPE, StartVertex As DWord, PrimitiveCount As DWord) As DWord
	Function DrawIndexedPrimitive(PrimitiveType As D3DPRIMITIVETYPE, BaseVertexIndex As Long, MinVertexIndex As DWord, NumVertices As DWord, startIndex As DWord, primCount As DWord) As DWord
	Function DrawPrimitiveUP(PrimitiveType As D3DPRIMITIVETYPE, PrimitiveCount As DWord, pVertexStreamZeroData As VoidPtr, VertexStreamZeroStride As DWord) As DWord
	Function DrawIndexedPrimitiveUP(PrimitiveType As D3DPRIMITIVETYPE, MinVertexIndex As DWord, NumVertices As DWord, PrimitiveCount As DWord, pIndexData As VoidPtr, IndexDataFormat As D3DFORMAT, pVertexStreamZeroData As VoidPtr, VertexStreamZeroStride As DWord) As DWord
	Function ProcessVertices(SrcStartIndex As DWord, DestIndex As DWord, VertexCount As DWord, pDestBuffer As *IDirect3DVertexBuffer9, pVertexDecl As *IDirect3DVertexDeclaration9, Flags As DWord) As DWord
	Function CreateVertexDeclaration(pVertexElements As *D3DVERTEXELEMENT9, ppDecl As **IDirect3DVertexDeclaration9) As DWord
	Function SetVertexDeclaration(pDecl As *IDirect3DVertexDeclaration9) As DWord
	Function GetVertexDeclaration(ppDecl As **IDirect3DVertexDeclaration9) As DWord
	Function SetFVF(FVF As DWord) As DWord
	Function GetFVF(pFVF As DWordPtr) As DWord
	Function CreateVertexShader(pFunction As DWordPtr, ppShader As **IDirect3DVertexShader9) As DWord
	Function SetVertexShader(pShader As *IDirect3DVertexShader9) As DWord
	Function GetVertexShader(ppShader As **IDirect3DVertexShader9) As DWord
	Function SetVertexShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
	Function GetVertexShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
	Function SetVertexShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
	Function GetVertexShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
	Function SetVertexShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
	Function GetVertexShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
	Function SetStreamSource(StreamNumber As DWord, pStreamData As *IDirect3DVertexBuffer9, OffsetInBytes As DWord, Stride As DWord) As DWord
	Function GetStreamSource(StreamNumber As DWord, ppStreamData As **IDirect3DVertexBuffer9, pOffsetInBytes As DWordPtr, pStride As DWordPtr) As DWord
	Function SetStreamSourceFreq(StreamNumber As DWord, Setting As DWord) As DWord
	Function GetStreamSourceFreq(StreamNumber As DWord, pSetting As DWordPtr) As DWord
	Function SetIndices(pIndexData As *IDirect3DIndexBuffer9) As DWord
	Function GetIndices(ppIndexData As **IDirect3DIndexBuffer9) As DWord
	Function CreatePixelShader(pFunction As DWordPtr, ppShader As **IDirect3DPixelShader9) As DWord
	Function SetPixelShader(pShader As *IDirect3DPixelShader9) As DWord
	Function GetPixelShader(ppShader As **IDirect3DPixelShader9) As DWord
	Function SetPixelShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
	Function GetPixelShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
	Function SetPixelShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
	Function GetPixelShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
	Function SetPixelShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
	Function GetPixelShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
	Function DrawRectPatch(Handle As DWord, pNumSegs As SinglePtr, pRectPatchInfo As *D3DRECTPATCH_INFO) As DWord
	Function DrawTriPatch(Handle As DWord, pNumSegs As SinglePtr, pTriPatchInfo As *D3DTRIPATCH_INFO) As DWord
	Function DeletePatch(Handle As DWord) As DWord
	Function CreateQuery(QueryType As D3DQUERYTYPE, ppQuery As **IDirect3DQuery9) As DWord
End Interface
TypeDef LPDIRECT3DDEVICE9 = *IDirect3DDevice9

Interface IDirect3DStateBlock9
	Inherits IUnknown
Public
	'IDirect3DStateBlock9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function Capture() As DWord
	Function Apply() As DWord
End Interface
TypeDef LPDIRECT3DSTATEBLOCK9 = *IDirect3DStateBlock9

Interface IDirect3DSwapChain9
	Inherits IUnknown
Public
	'IDirect3DSwapChain9 methods
	Function Present(pSourceRect As *RECT, pDestRect As *RECT, hDestWindowOverride As DWord, pDirtyRegion As *RGNDATA, dwFlags As DWord) As DWord
	Function GetFrontBufferData(pDestSurface As *IDirect3DSurface9) As DWord
	Function GetBackBuffer(iBackBuffer As DWord, bbtype As D3DBACKBUFFER_TYPE, ppBackBuffer As **IDirect3DSurface9) As DWord
	Function GetRasterStatus(pRasterStatus As *D3DRASTER_STATUS) As DWord
	Function GetDisplayMode(pMode As *D3DDISPLAYMODE) As DWord
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function GetPresentParameters(pPresentationParameters As *D3DPRESENT_PARAMETERS) As DWord
End Interface
TypeDef LPDIRECT3DSWAPCHAIN9 = *IDirect3DSwapChain9

Interface IDirect3DResource9
	Inherits IUnknown
Public
	'IDirect3DResource9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
	Function FreePrivateData(ByRef refguid As GUID) As DWord
	Function SetPriority(PriorityNew As DWord) As DWord
	Function GetPriority() As DWord
	Sub PreLoad()
	Function GetType() As D3DRESOURCETYPE
End Interface
TypeDef LPDIRECT3DRESOURCE9 = *IDirect3DResource9

Interface IDirect3DVertexDeclaration9
	Inherits IUnknown
Public
	'IDirect3DVertexDeclaration9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function GetDeclaration(pElement As *D3DVERTEXELEMENT9, pNumElements As DWordPtr) As DWord
End Interface
TypeDef LPDIRECT3DVERTEXDECLARATION9 = *IDirect3DVertexDeclaration9

Interface IDirect3DVertexShader9
	Inherits IUnknown
Public
	'IDirect3DVertexShader9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function GetFunction(pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
End Interface
TypeDef LPDIRECT3DVERTEXSHADER9 = *IDirect3DVertexShader9

Interface IDirect3DPixelShader9
	Inherits IUnknown
Public
	'IDirect3DPixelShader9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function GetFunction(pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
End Interface
TypeDef LPDIRECT3DPIXELSHADER9 = *IDirect3DPixelShader9

Interface IDirect3DBaseTexture9
	Inherits IUnknown
Public
	'IDirect3DResource9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
	Function FreePrivateData(ByRef refguid As GUID) As DWord
	Function SetPriority(PriorityNew As DWord) As DWord
	Function GetPriority() As DWord
	Sub PreLoad()
	Function GetType() As D3DRESOURCETYPE
	Function SetLOD(LODNew As DWord) As DWord
	Function GetLOD() As DWord
	Function GetLevelCount() As DWord
	Function SetAutoGenFilterType(FilterType As D3DTEXTUREFILTERTYPE) As DWord
	Function GetAutoGenFilterType() As D3DTEXTUREFILTERTYPE
	Sub GenerateMipSubLevels()
End Interface
TypeDef LPDIRECT3DBASETEXTURE9 = *IDirect3DBaseTexture9

Interface IDirect3DTexture9
	Inherits IDirect3DBaseTexture9
Public
	Function GetLevelDesc(Level As DWord, pDesc As *D3DSURFACE_DESC) As DWord
	Function GetSurfaceLevel(Level As DWord, ppSurfaceLevel As **IDirect3DSurface9) As DWord
	Function LockRect(Level As DWord, pLockedRect As *D3DLOCKED_RECT, pRect As *RECT, Flags As DWord) As DWord
	Function UnlockRect(Level As DWord) As DWord
	Function AddDirtyRect(pDirtyRect As *RECT) As DWord
End Interface
TypeDef LPDIRECT3DTEXTURE9 = *IDirect3DTexture9

Interface IDirect3DVolumeTexture9
	Inherits IDirect3DBaseTexture9
Public
	Function GetLevelDesc(Level As DWord, pDesc As *D3DSURFACE_DESC) As DWord
	Function GetVolumeLevel(Level As DWord, ppVolumeLevel As **IDirect3DVolume9) As DWord
	Function LockBox(Level As DWord, pLockedVolume As *D3DLOCKED_BOX, pBox As *D3DBOX, Flags As DWord) As DWord
	Function UnlockBox(Level As DWord) As DWord
	Function AddDirtyBox(pDirtyBox As *D3DBOX) As DWord
End Interface
TypeDef LPDIRECT3DVOLUMETEXTURE9 = *IDirect3DVolumeTexture9

Interface IDirect3DCubeTexture9
	Inherits IDirect3DBaseTexture9
End Interface
TypeDef LPDIRECT3DCUBETEXTURE9 = *IDirect3DCubeTexture9

Interface IDirect3DVertexBuffer9
	Inherits IUnknown
Public
	'IDirect3DResource9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
	Function FreePrivateData(ByRef refguid As GUID) As DWord
	Function SetPriority(PriorityNew As DWord) As DWord
	Function GetPriority() As DWord
	Sub PreLoad()
	Function GetType() As D3DRESOURCETYPE
	Function Lock(OffsetToLock As DWord, SizeToLock As DWord, ppbData As VoidPtr, Flags As DWord) As DWord
	Function Unlock() As DWord
	Function GetDesc(pDesc As *D3DVERTEXBUFFER_DESC) As DWord
End Interface
TypeDef LPDIRECT3DVERTEXBUFFER9 = *IDirect3DVertexBuffer9

Interface IDirect3DIndexBuffer9
	Inherits IUnknown
Public
	'IDirect3DResource9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
	Function FreePrivateData(ByRef refguid As GUID) As DWord
	Function SetPriority(PriorityNew As DWord) As DWord
	Function GetPriority() As DWord
	Sub PreLoad()
	Function GetType() As D3DRESOURCETYPE
	Function Lock(OffsetToLock As DWord, SizeToLock As DWord, ppbData As VoidPtr, Flags As DWord) As DWord
	Function Unlock() As DWord
	Function GetDesc(pDesc As *D3DINDEXBUFFER_DESC) As DWord
End Interface
TypeDef LPDIRECT3DINDEXBUFFER9 = *IDirect3DIndexBuffer9

Interface IDirect3DSurface9
	Inherits IUnknown
Public
	'IDirect3DResource9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
	Function FreePrivateData(ByRef refguid As GUID) As DWord
	Function SetPriority(PriorityNew As DWord) As DWord
	Function GetPriority() As DWord
	Sub PreLoad()
	Function GetType() As D3DRESOURCETYPE
	Function GetContainer(ByRef riid As GUID, ppContainer As VoidPtr) As DWord
	Function GetDesc(pDesc As *D3DSURFACE_DESC) As DWord
	Function LockRect(pLockedRect As *D3DLOCKED_RECT, pRect As *RECT, Flags As DWord) As DWord
	Function UnlockRect() As DWord
	Function GetDC(phdc As DWordPtr) As DWord
	Function ReleaseDC(hdc As DWord) As DWord
End Interface
TypeDef LPDIRECT3DSURFACE9 = *IDirect3DSurface9

Interface IDirect3DVolume9
	Inherits IUnknown
Public
	'IDirect3DVolume9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
	Function FreePrivateData(ByRef refguid As GUID) As DWord
	Function GetContainer(ByRef riid As GUID, ppContainer As DWordPtr) As DWord
	Function GetDesc(pDesc As *D3DVOLUME_DESC) As DWord
	Function LockBox(pLockedVolume As *D3DLOCKED_BOX, pBox As *D3DBOX, Flags As DWord) As DWord
	Function UnlockBox() As DWord
End Interface
TypeDef LPDIRECT3DVOLUME9 = *IDirect3DVolume9

Interface IDirect3DQuery9
	Inherits IUnknown
Public
	'IDirect3DQuery9 methods
	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Function GetType() As D3DQUERYTYPE
	Function GetDataSize() As DWord
	Function Issue(dwIssueFlags As DWord) As DWord
	Function GetData(pData As VoidPtr, dwSize As DWord, dwGetDataFlags As DWord) As DWord
End Interface
TypeDef LPDIRECT3DQUERY9 = *IDirect3DQuery9


' Flags for SetPrivateData method on all D3D9 interfaces
Const D3DSPD_IUNKNOWN = &H00000001


' Flags for IDirect3D9::CreateDevice's BehaviorFlags
Const D3DCREATE_FPU_PRESERVE                 = &H00000002
Const D3DCREATE_MULTITHREADED                = &H00000004

Const D3DCREATE_PUREDEVICE                   = &H00000010
Const D3DCREATE_SOFTWARE_VERTEXPROCESSING    = &H00000020
Const D3DCREATE_HARDWARE_VERTEXPROCESSING    = &H00000040
Const D3DCREATE_MIXED_VERTEXPROCESSING       = &H00000080
Const D3DCREATE_DISABLE_DRIVER_MANAGEMENT    = &H00000100
Const D3DCREATE_ADAPTERGROUP_DEVICE          = &H00000200
Const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX = &H00000400

Const D3DCREATE_NOWINDOWCHANGES = &H00000800


' Parameter for IDirect3D9::CreateDevice's Adapter argument
Const D3DADAPTER_DEFAULT = 0


' Flags for IDirect3D9::EnumAdapters
Const D3DENUM_WHQL_LEVEL = &H00000002


' Maximum number of back-buffers supported in DX9
Const D3DPRESENT_BACK_BUFFERS_MAX = 3


' Flags for IDirect3DDevice9::SetGammaRamp
Const D3DSGR_NO_CALIBRATION = &H00000000
Const D3DSGR_CALIBRATE      = &H00000001


' Flags for IDirect3DDevice9::SetCursorPosition
Const D3DCURSOR_IMMEDIATE_UPDATE = &H00000001


' Flags for IDirect3DSwapChain9::Present
Const D3DPRESENT_DONOTWAIT      = &H00000001
Const D3DPRESENT_LINEAR_CONTENT = &H00000002


' DirectDraw error codes
Const _FACD3D = &H876
Const MAKE_D3DHRESULT(code) = MAKE_HRESULT( 1, _FACD3D, code )
Const MAKE_D3DSTATUS(code)  = MAKE_HRESULT( 0, _FACD3D, code )

' Direct3D Errors
Const D3D_OK = S_OK
Const D3DERR_WRONGTEXTUREFORMAT            = MAKE_D3DHRESULT(2072)
Const D3DERR_UNSUPPORTEDCOLOROPERATION     = MAKE_D3DHRESULT(2073)
Const D3DERR_UNSUPPORTEDCOLORARG           = MAKE_D3DHRESULT(2074)
Const D3DERR_UNSUPPORTEDALPHAOPERATION     = MAKE_D3DHRESULT(2075)
Const D3DERR_UNSUPPORTEDALPHAARG           = MAKE_D3DHRESULT(2076)
Const D3DERR_TOOMANYOPERATIONS             = MAKE_D3DHRESULT(2077)
Const D3DERR_CONFLICTINGTEXTUREFILTER      = MAKE_D3DHRESULT(2078)
Const D3DERR_UNSUPPORTEDFACTORVALUE        = MAKE_D3DHRESULT(2079)
Const D3DERR_CONFLICTINGRENDERSTATE        = MAKE_D3DHRESULT(2081)
Const D3DERR_UNSUPPORTEDTEXTUREFILTER      = MAKE_D3DHRESULT(2082)
Const D3DERR_CONFLICTINGTEXTUREPALETTE     = MAKE_D3DHRESULT(2086)
Const D3DERR_DRIVERINTERNALERROR           = MAKE_D3DHRESULT(2087)

Const D3DERR_NOTFOUND                      = MAKE_D3DHRESULT(2150)
Const D3DERR_MOREDATA                      = MAKE_D3DHRESULT(2151)
Const D3DERR_DEVICELOST                    = MAKE_D3DHRESULT(2152)
Const D3DERR_DEVICENOTRESET                = MAKE_D3DHRESULT(2153)
Const D3DERR_NOTAVAILABLE                  = MAKE_D3DHRESULT(2154)
Const D3DERR_OUTOFVIDEOMEMORY              = MAKE_D3DHRESULT(380)
Const D3DERR_INVALIDDEVICE                 = MAKE_D3DHRESULT(2155)
Const D3DERR_INVALIDCALL                   = MAKE_D3DHRESULT(2156)
Const D3DERR_DRIVERINVALIDCALL             = MAKE_D3DHRESULT(2157)
Const D3DERR_WASSTILLDRAWING               = MAKE_D3DHRESULT(540)
Const D3DOK_NOAUTOGEN                      = MAKE_D3DSTATUS(2159)


#endif '_INC_D3D9
