' d3dx9shader.sbp


#ifndef _INC_D3DX9SHADER
#define _INC_D3DX9SHADER


TypeDef D3DXHANDLE = BytePtr


Type D3DXMACRO
	Name As BytePtr
	Definition As BytePtr
End Type

Type D3DXSEMANTIC
	Usage As DWord
	UsageIndex As DWord
End Type

Type D3DXFRAGMENT_DESC
	Name As BytePtr
	Target As DWord
End Type

Const Enum D3DXREGISTER_SET
	D3DXRS_BOOL        = 0
	D3DXRS_INT4        = 1
	D3DXRS_FLOAT4      = 2
	D3DXRS_SAMPLER     = 3
	D3DXRS_FORCE_DWORD = &H7FFFFFFF
End Enum

Const Enum D3DXPARAMETER_CLASS
	D3DXPC_SCALAR         = 0
	D3DXPC_VECTOR         = 1
	D3DXPC_MATRIX_ROWS    = 2
	D3DXPC_MATRIX_COLUMNS = 3
	D3DXPC_OBJECT         = 4
	D3DXPC_STRUCT         = 5
	D3DXPC_FORCE_DWORD    = &H7FFFFFFF
End Enum

Const Enum D3DXPARAMETER_TYPE
	D3DXPT_VOID           = 0
	D3DXPT_BOOL           = 1
	D3DXPT_INT            = 2
	D3DXPT_FLOAT          = 3
	D3DXPT_STRING         = 4
	D3DXPT_TEXTURE        = 5
	D3DXPT_TEXTURE1D      = 6
	D3DXPT_TEXTURE2D      = 7
	D3DXPT_TEXTURE3D      = 8
	D3DXPT_TEXTURECUBE    = 9
	D3DXPT_SAMPLER        = 10
	D3DXPT_SAMPLER1D      = 11
	D3DXPT_SAMPLER2D      = 12
	D3DXPT_SAMPLER3D      = 13
	D3DXPT_SAMPLERCUBE    = 14
	D3DXPT_PIXELSHADER    = 15
	D3DXPT_VERTEXSHADER   = 16
	D3DXPT_PIXELFRAGMENT  = 17
	D3DXPT_VERTEXFRAGMENT = 18
	D3DXPT_FORCE_DWORD    = &H7FFFFFFF
End Enum

Type D3DXCONSTANTTABLE_DESC
	Creator As BytePtr
	Version As DWord
	Constants As DWord
End Type

Type D3DXCONSTANT_DESC
	Name As BytePtr
	RegisterSet As D3DXREGISTER_SET
	RegisterIndex As DWord
	RegisterCount As DWord
	Class_ As D3DXPARAMETER_CLASS
	Type_ As D3DXPARAMETER_TYPE
	Rows As DWord
	Columns As DWord
	Elements As DWord
	StructMembers As DWord
	Bytes As DWord
	DefaultValue As VoidPtr
End Type


Class ID3DXConstantTable
	Inherits IUnknown
Public
	'Buffer
	Abstract Function GetBufferPointer() As VoidPtr
	Abstract Function GetBufferSize() As DWord

	'Descs
	Abstract Function GetDesc(pDesc As *D3DXCONSTANTTABLE_DESC) As DWord
	Abstract Function GetConstantDesc(hConstant As D3DXHANDLE, pConstantDesc As *D3DXCONSTANT_DESC, pCount As DWordPtr) As DWord
	Abstract Function GetSamplerIndex(hConstant As D3DXHANDLE) As DWord

	'Handle operations
	Abstract Function GetConstant(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE
	Abstract Function GetConstantByName(hConstant As D3DXHANDLE, pName As BytePtr) As D3DXHANDLE
	Abstract Function GetConstantElement(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE

	'Set Constants
	Abstract Function SetDefaults(pDevice As LPDIRECT3DDEVICE9) As DWord
	Abstract Function SetValue(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pData As VoidPtr, Bytes As DWord) As DWord
	Abstract Function SetBool(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, b As Long) As DWord
	Abstract Function SetBoolArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pb As *Long, Count As DWord) As DWord
	Abstract Function SetInt(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, n As Long) As DWord
	Abstract Function SetIntArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pn As *Long, Count As DWord) As DWord
	Abstract Function SetFloat(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, f As Single) As DWord
	Abstract Function SetFloatArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pf As SinglePtr, Count As DWord) As DWord
	Abstract Function SetVector(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4) As DWord
	Abstract Function SetVectorArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4, Count As DWord) As DWord
	Abstract Function SetMatrix(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
	Abstract Function SetMatrixArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
	Abstract Function SetMatrixPointerArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
	Abstract Function SetMatrixTranspose(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
	Abstract Function SetMatrixTransposeArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
	Abstract Function SetMatrixTransposePointerArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
End Class
TypeDef LPD3DXCONSTANTTABLE = *ID3DXConstantTable


Class ID3DXTextureShader
	Inherits IUnknown
Public
    'Gets
	Abstract Function GetFunction(ppFunction As *LPD3DXBUFFER) As DWord
	Abstract Function GetConstantBuffer(ppConstantBuffer As *LPD3DXBUFFER) As DWord

    'Descs
	Abstract Function GetDesc(pDesc As *D3DXCONSTANTTABLE_DESC) As DWord
	Abstract Function GetConstantDesc(hConstant As D3DXHANDLE, pConstantDesc As *D3DXCONSTANT_DESC, pCount As DWordPtr) As DWord

    'Handle operations
	Abstract Function GetConstant(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE
	Abstract Function GetConstantByName(hConstant As D3DXHANDLE, pName As BytePtr) As D3DXHANDLE
	Abstract Function GetConstantElement(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE

    'Set Constants
	Abstract Function SetDefaults() As DWord
	Abstract Function SetValue(hConstant As D3DXHANDLE, pData As VoidPtr, Bytes As DWord) As DWord
	Abstract Function SetBool(hConstant As D3DXHANDLE, b As Long) As DWord
	Abstract Function SetBoolArray(hConstant As D3DXHANDLE, pb As *Long, Count As DWord) As DWord
	Abstract Function SetInt(hConstant As D3DXHANDLE, n As Long) As DWord
	Abstract Function SetIntArray(hConstant As D3DXHANDLE, pn As *Long, Count As DWord) As DWord
	Abstract Function SetFloat(hConstant As D3DXHANDLE, f As Single) As DWord
	Abstract Function SetFloatArray(hConstant As D3DXHANDLE, pf As SinglePtr, Count As DWord) As DWord
	Abstract Function SetVector(hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4) As DWord
	Abstract Function SetVectorArray(hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4, Count As DWord) As DWord
	Abstract Function SetMatrix(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
	Abstract Function SetMatrixArray(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
	Abstract Function SetMatrixPointerArray(hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
	Abstract Function SetMatrixTranspose(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
	Abstract Function SetMatrixTransposeArray(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
	Abstract Function SetMatrixTransposePointerArray(hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
End Class
TypeDef LPD3DXTEXTURESHADER = *ID3DXTextureShader


Class ID3DXFragmentLinker
	Inherits IUnknown
Public
	'fragment access and information retrieval functions
	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
	Abstract Function GetNumberOfFragments() As DWord

	Abstract Function GetFragmentHandleByIndex(Index As DWord) As D3DXHANDLE
	Abstract Function GetFragmentHandleByName(Name As BytePtr) As D3DXHANDLE
	Abstract Function GetFragmentDesc(Name As D3DXHANDLE, FragDesc As *D3DXFRAGMENT_DESC) As DWord

	'add the fragments in the buffer to the linker
	Abstract Function AddFragments(Fragments As DWordPtr) As DWord

	'Create a buffer containing the fragments.  Suitable for saving to disk
	Abstract Function GetAllFragments(ppBuffer As *LPD3DXBUFFER) As DWord
	Abstract Function GetFragment(Name As D3DXHANDLE, ppBuffer As *LPD3DXBUFFER) As DWord

	Abstract Function LinkShader(pProfile As BytePtr, Flags As DWord, rgFragmentHandles As *D3DXHANDLE, cFragments As DWord, ppBuffer As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
	Abstract Function LinkVertexShader(pProfile As BytePtr, Flags As DWord, rgFragmentHandles As *D3DXHANDLE, cFragments As DWord, pVShader As *LPDIRECT3DVERTEXSHADER9, ppErrorMsgs As *LPD3DXBUFFER) As DWord
	Abstract Function LinkPixelShader(pProfile As BytePtr, Flags As DWord, rgFragmentHandles As *D3DXHANDLE, cFragments As DWord, pPShader As *LPDIRECT3DPIXELSHADER9, ppErrorMsgs As *LPD3DXBUFFER) As DWord

	Abstract Function ClearCache() As DWord
End Class
TypeDef LPD3DXFRAGMENTLINKER = *ID3DXFragmentLinker


Const Enum D3DXINCLUDE_TYPE
	D3DXINC_LOCAL  = 0
	D3DXINC_SYSTEM = 1

	D3DXINC_FORCE_DWORD = &H7FFFFFFF
End Enum

Class ID3DXInclude
	Abstract Function Open(IncludeType As D3DXINCLUDE_TYPE, pFileName As BytePtr, pParentData As VoidPtr, ppData As DWordPtr, pBytes As DWordPtr) As DWord
	Abstract Function Close(pData As VoidPtr) As DWord
End Class
TypeDef LPD3DXINCLUDE = *ID3DXInclude


'--------------------
' D3DXAssembleShader
'--------------------
Declare Function D3DXAssembleShaderFromFile Lib "dx9abm" Alias "D3DXAssembleShaderFromFile_abm" (pSrcFile As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
Declare Function D3DXAssembleShaderFromResource Lib "dx9abm" Alias "D3DXAssembleShaderFromResource_abm" (hSrcModule As HINSTANCE, pSrcResource As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
Declare Function D3DXAssembleShader Lib "dx9abm" Alias "D3DXAssembleShader_abm" (pSrcData As BytePtr, SrcDataLen As DWord, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord


'-------------------
' D3DXCompileShader
'-------------------
Declare Function D3DXCompileShaderFromFile Lib "dx9abm" Alias "D3DXCompileShaderFromFile_abm" (pSrcFile As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, pFunctionName As BytePtr, pProfile As BytePtr, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER, ppConstantTable As *LPD3DXCONSTANTTABLE) As DWord
Declare Function D3DXCompileShaderFromResource Lib "dx9abm" Alias "D3DXCompileShaderFromResource_abm" (hSrcModule As HINSTANCE, pSrcResource As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, pFunctionName As BytePtr, pProfile As BytePtr, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER, ppConstantTable As *LPD3DXCONSTANTTABLE) As DWord
Declare Function D3DXCompileShader Lib "dx9abm" Alias "D3DXCompileShader_abm" (pSrcData As BytePtr, SrcDataLen As DWord, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, pFunctionName As BytePtr, pProfile As BytePtr, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER, ppConstantTable As *LPD3DXCONSTANTTABLE) As DWord


#endif '_INC_D3DX9SHADER
