' ########################################################################################
' Microsoft Windows
' File: d3dx9shader.inc
' Contents: D3DX Shader APIs
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_d3dx9shader_PBI)
#DEFINE PBX_d3dx9shader_PBI
%EQUATE `D3DX9SHADER_INC = 1
'//---------------------------------------------------------------------------
'// D3DXTX_VERSION:
'// --------------
'// Version token used to create a procedural texture filler in effects
'// Used by D3DXFill[]TX functions
'//---------------------------------------------------------------------------
'#define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
'//----------------------------------------------------------------------------
'// D3DXSHADER flags:
'// -----------------
'// D3DXSHADER_DEBUG
'// Insert debug file/line/type/symbol information.
'//
'// D3DXSHADER_SKIPVALIDATION
'// Do not validate the generated code against known capabilities and
'// constraints. This option is only recommended when compiling shaders
'// you KNOW will work. (ie. have compiled before without this option.)
'// Shaders are always validated by D3D before they are set to the device.
'//
'// D3DXSHADER_SKIPOPTIMIZATION
'// Instructs the compiler to skip optimization steps during code generation.
'// Unless you are trying to isolate a problem in your code using this option
'// is not recommended.
'//
'// D3DXSHADER_PACKMATRIX_ROWMAJOR
'// Unless explicitly specified, matrices will be packed in row-major order
'// on input and output from the shader.
'//
'// D3DXSHADER_PACKMATRIX_COLUMNMAJOR
'// Unless explicitly specified, matrices will be packed in column-major
'// order on input and output from the shader. This is generally more
'// efficient, since it allows vector-matrix multiplication to be performed
'// using a series of dot-products.
'//
'// D3DXSHADER_PARTIALPRECISION
'// Force all computations in resulting shader to occur at partial precision.
'// This may result in faster evaluation of shaders on some hardware.
'//
'// D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT
'// Force compiler to compile against the next highest available software
'// target for vertex shaders. This flag also turns optimizations off,
'// and debugging on.
'//
'// D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT
'// Force compiler to compile against the next highest available software
'// target for pixel shaders. This flag also turns optimizations off,
'// and debugging on.
'//
'// D3DXSHADER_NO_PRESHADER
'// Disables Preshaders. Using this flag will cause the compiler to not
'// pull out static expression for evaluation on the host cpu
'//
'// D3DXSHADER_AVOID_FLOW_CONTROL
'// Hint compiler to avoid flow-control constructs where possible.
'//
'// D3DXSHADER_PREFER_FLOW_CONTROL
'// Hint compiler to prefer flow-control constructs where possible.
'//
'//----------------------------------------------------------------------------
%EQUATE `D3DXSHADER_DEBUG = &H1 ' (1 << 0)
%EQUATE `D3DXSHADER_SKIPVALIDATION = &H2 ' (1 << 1)
%EQUATE `D3DXSHADER_SKIPOPTIMIZATION = &H4 ' (1 << 2)
%EQUATE `D3DXSHADER_PACKMATRIX_ROWMAJOR = &H8 ' (1 << 3)
%EQUATE `D3DXSHADER_PACKMATRIX_COLUMNMAJOR = &H10 ' (1 << 4)
%EQUATE `D3DXSHADER_PARTIALPRECISION = &H20 ' (1 << 5)
%EQUATE `D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT = &H40 ' (1 << 6)
%EQUATE `D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT = &H80 ' (1 << 7)
%EQUATE `D3DXSHADER_NO_PRESHADER = &H100 ' (1 << 8)
%EQUATE `D3DXSHADER_AVOID_FLOW_CONTROL = &H200 ' (1 << 9)
%EQUATE `D3DXSHADER_PREFER_FLOW_CONTROL = &H400 ' (1 << 10)
%EQUATE `D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY = &H1000 ' (1 << 12)
%EQUATE `D3DXSHADER_IEEE_STRICTNESS = &H2000 ' (1 << 13)
%EQUATE `D3DXSHADER_USE_LEGACY_D3DX9_31_DLL = &H10000 ' (1 << 16)
'// optimization level flags
%EQUATE `D3DXSHADER_OPTIMIZATION_LEVEL0 = &H4000 ' (1 << 14)
%EQUATE `D3DXSHADER_OPTIMIZATION_LEVEL1 = 0
%EQUATE `D3DXSHADER_OPTIMIZATION_LEVEL2 = &HC000 ' ((1 << 14) | (1 << 15))
%EQUATE `D3DXSHADER_OPTIMIZATION_LEVEL3 = &H8000 ' (1 << 15)
'//----------------------------------------------------------------------------
'// D3DXHANDLE:
'// -----------
'// Handle values used to efficiently reference shader and effect parameters.
'// Strings can be used as handles. However, handles are not always strings.
'//----------------------------------------------------------------------------
'typedef LPCSTR D3DXHANDLE;
'typedef D3DXHANDLE *LPD3DXHANDLE;
'//----------------------------------------------------------------------------
'// D3DXMACRO:
'// ----------
'// Preprocessor macro definition. The application pass in a NULL-terminated
'// array of this structure to various D3DX APIs. This enables the application
'// to #define tokens at runtime, before the file is parsed.
'//----------------------------------------------------------------------------
' // Size = 8 bytes
TYPE D3DXMACRO DWORD
 Name AS ASCIIZ PTR
 pDefinition AS ASCIIZ PTR
END TYPE
' Must be included after D3DXMACRO because this structure is used by another include file.
#INCLUDE ONCE "Legacy/Graphics/d3dx9.inc"
'//----------------------------------------------------------------------------
'// D3DXSEMANTIC:
'//----------------------------------------------------------------------------
' // Size = 8 bytes
TYPE D3DXSEMANTIC DWORD
 Usage AS DWORD ' UINT
 UsageIndex AS DWORD ' UINT
END TYPE
'//----------------------------------------------------------------------------
'// D3DXFRAGMENT_DESC:
'//----------------------------------------------------------------------------
' // Size = 8 bytes
TYPE D3DXFRAGMENT_DESC DWORD
 Name AS ASCIIZ PTR
 Target AS DWORD
END TYPE
'//----------------------------------------------------------------------------
'// D3DXREGISTER_SET:
'//----------------------------------------------------------------------------
%EQUATE `D3DXRS_BOOL = 0
%EQUATE `D3DXRS_INT4 = 1
%EQUATE `D3DXRS_FLOAT4 = 2
%EQUATE `D3DXRS_SAMPLER = 3
' // force 32-bit size enum
%EQUATE `D3DXRS_FORCE_DWORD = &H7FFFFFFF
'//----------------------------------------------------------------------------
'// D3DXPARAMETER_CLASS:
'//----------------------------------------------------------------------------
%EQUATE `D3DXPC_SCALAR = 0
%EQUATE `D3DXPC_VECTOR = 1
%EQUATE `D3DXPC_MATRIX_ROWS = 2
%EQUATE `D3DXPC_MATRIX_COLUMNS = 3
%EQUATE `D3DXPC_OBJECT = 4
%EQUATE `D3DXPC_STRUCT = 5
' // force 32-bit size enum
%EQUATE `D3DXPC_FORCE_DWORD = &H7FFFFFFF
'//----------------------------------------------------------------------------
'// D3DXPARAMETER_TYPE:
'//----------------------------------------------------------------------------
%EQUATE `D3DXPT_VOID = 0
%EQUATE `D3DXPT_BOOL = 1
%EQUATE `D3DXPT_INT = 2
%EQUATE `D3DXPT_FLOAT = 3
%EQUATE `D3DXPT_STRING = 4
%EQUATE `D3DXPT_TEXTURE = 5
%EQUATE `D3DXPT_TEXTURE1D = 6
%EQUATE `D3DXPT_TEXTURE2D = 7
%EQUATE `D3DXPT_TEXTURE3D = 8
%EQUATE `D3DXPT_TEXTURECUBE = 9
%EQUATE `D3DXPT_SAMPLER = 10
%EQUATE `D3DXPT_SAMPLER1D = 11
%EQUATE `D3DXPT_SAMPLER2D = 12
%EQUATE `D3DXPT_SAMPLER3D = 13
%EQUATE `D3DXPT_SAMPLERCUBE = 14
%EQUATE `D3DXPT_PIXELSHADER = 15
%EQUATE `D3DXPT_VERTEXSHADER = 16
%EQUATE `D3DXPT_PIXELFRAGMENT = 17
%EQUATE `D3DXPT_VERTEXFRAGMENT = 18
' // force 32-bit size enum
%EQUATE `D3DXPT_FORCE_DWORD = &H7FFFFFFF
'//----------------------------------------------------------------------------
'// D3DXCONSTANTTABLE_DESC:
'//----------------------------------------------------------------------------
' // Size = 12 bytes
TYPE D3DXCONSTANTTABLE_DESC DWORD
 Creator AS ASCIIZ PTR ' LPCSTR // Creator string
 Version AS DWORD ' DWORD // Shader version
 Constants AS DWORD ' UINT // Number of constants
END TYPE
'//----------------------------------------------------------------------------
'// D3DXCONSTANT_DESC:
'//----------------------------------------------------------------------------
' // Size = 48 bytes
TYPE D3DXCONSTANT_DESC DWORD
 Name AS ASCIIZ PTR ' LPCSTR // Constant name
 RegisterSet AS DWORD ' D3DXREGISTER_SET // Register set
 RegisterIndex AS DWORD ' UINT // Register index
 RegisterCount AS DWORD ' UINT // Number of registers occupied
 Class AS DWORD ' D3DXPARAMETER_CLASS // Class
 Type AS DWORD ' D3DXPARAMETER_TYPE // Component type
 Rows AS DWORD ' UINT // Number of rows
 Columns AS DWORD ' UINT // Number of columns
 Elements AS DWORD ' UINT // Number of array elements
 StructMembers AS DWORD ' UINT // Number of structure member sub-parameters
 Bytes AS DWORD ' UINT // Data size, in bytes
 DefaultValue AS DWORD ' LPCVOID // Pointer to default value
END TYPE
$IID_ID3DXConstantTable = GUID$("{AB3C758F-093E-4356-B762-4DB18F1B3A01}")
$IID_ID3DXTextureShader = GUID$("{3E3D67F8-AA7A-405d-A857-BA01D4758426}")
$IID_ID3DXFragmentLinker = GUID$("{1A2C0CC2-E5B6-4ebc-9E8D-390E057811B6}")
'//----------------------------------------------------------------------------
'// ID3DXConstantTable:
'//----------------------------------------------------------------------------
INTERFACE ID3DXConstantTable $IID_ID3DXConstantTable
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetBufferPointer ( ' VTable offset = 12
 ) AS DWORD
 ' =====================================================================================
 METHOD GetBufferSize ( ' VTable offset = 16
 ) AS DWORD
 ' =====================================================================================
 METHOD GetDesc ( ' VTable offset = 20
 BYREF pDesc AS D3DXCONSTANTTABLE_DESC
 ) AS LONG
 ' =====================================================================================
 METHOD GetConstantDesc ( ' VTable offset = 24
 BYVAL hConstant AS DWORD
 , BYREF pConstantDesc AS D3DXCONSTANT_DESC
 , BYREF pCount AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetSamplerIndex ( ' VTable offset = 28
 BYVAL hConstant AS DWORD
 ) AS DWORD
 ' =====================================================================================
 METHOD GetConstant ( ' VTable offset = 32
 BYVAL hConstant AS DWORD
 , BYVAL Index AS DWORD
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD GetConstantByName ( ' VTable offset = 36
 BYVAL hConstant AS DWORD
 , BYREF pName AS ASCIIZ
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD GetConstantElement ( ' VTable offset = 40
 BYVAL hConstant AS DWORD
 , BYVAL Index AS DWORD
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD SetDefaults ( ' VTable offset = 44
 BYVAL pDevice AS IDirect3DDevice9
 ) AS LONG
 ' =====================================================================================
 METHOD SetValue ( ' VTable offset = 48
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYVAL pData AS DWORD
 , BYVAL Bytes AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetBool ( ' VTable offset = 52
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYVAL b AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetBoolArray ( ' VTable offset = 56
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pb AS LONG
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetInt ( ' VTable offset = 60
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYVAL n AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetIntArray ( ' VTable offset = 64
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pn AS LONG
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetFloat ( ' VTable offset = 68
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYVAL f AS SINGLE
 ) AS LONG
 ' =====================================================================================
 METHOD SetFloatArray ( ' VTable offset = 72
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pf AS SINGLE
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetVector ( ' VTable offset = 76
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pVector AS D3DXVECTOR4
 ) AS LONG
 ' =====================================================================================
 METHOD SetVectorArray ( ' VTable offset = 80
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pVector AS D3DXVECTOR4
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrix ( ' VTable offset = 84
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixArray ( ' VTable offset = 88
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixPointerArray ( ' VTable offset = 92
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYVAL ppMatrix AS DWORD
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixTranspose ( ' VTable offset = 96
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixTransposeArray ( ' VTable offset = 100
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixTransposePointerArray ( ' VTable offset = 104
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL hConstant AS DWORD
 , BYVAL ppMatrix AS DWORD
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'//----------------------------------------------------------------------------
'// ID3DXTextureShader:
'//----------------------------------------------------------------------------
INTERFACE ID3DXTextureShader $IID_ID3DXTextureShader
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetFunction ( ' VTable offset = 12
 BYREF ppFunction AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD GetConstantBuffer ( ' VTable offset = 16
 BYREF ppConstantBuffer AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD GetDesc ( ' VTable offset = 20
 BYREF pDesc AS D3DXCONSTANTTABLE_DESC
 ) AS LONG
 ' =====================================================================================
 METHOD GetConstantDesc ( ' VTable offset = 24
 BYVAL hConstant AS DWORD
 , BYREF pConstantDesc AS D3DXCONSTANT_DESC
 , BYREF pCount AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetConstant ( ' VTable offset = 28
 BYVAL hConstant AS DWORD
 , BYVAL Index AS DWORD
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD GetConstantByName ( ' VTable offset = 32
 BYVAL hConstant AS DWORD
 , BYREF pName AS ASCIIZ
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD GetConstantElement ( ' VTable offset = 36
 BYVAL hConstant AS DWORD
 , BYVAL Index AS DWORD
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD SetDefaults ( ' VTable offset = 40
 ) AS LONG
 ' =====================================================================================
 METHOD SetValue ( ' VTable offset = 44
 BYVAL hConstant AS DWORD
 , BYVAL pData AS DWORD
 , BYVAL Bytes AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetBool ( ' VTable offset = 48
 BYVAL hConstant AS DWORD
 , BYVAL b AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetBoolArray ( ' VTable offset = 52
 BYVAL hConstant AS DWORD
 , BYREF pb AS LONG
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetInt ( ' VTable offset = 56
 BYVAL hConstant AS DWORD
 , BYVAL n AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetIntArray ( ' VTable offset = 60
 BYVAL hConstant AS DWORD
 , BYREF pn AS LONG
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetFloat ( ' VTable offset = 64
 BYVAL hConstant AS DWORD
 , BYVAL f AS SINGLE
 ) AS LONG
 ' =====================================================================================
 METHOD SetFloatArray ( ' VTable offset = 68
 BYVAL hConstant AS DWORD
 , BYREF pf AS SINGLE
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetVector ( ' VTable offset = 72
 BYVAL hConstant AS DWORD
 , BYREF pVector AS D3DXVECTOR4
 ) AS LONG
 ' =====================================================================================
 METHOD SetVectorArray ( ' VTable offset = 76
 BYVAL hConstant AS DWORD
 , BYREF pVector AS D3DXVECTOR4
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrix ( ' VTable offset = 80
 BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixArray ( ' VTable offset = 84
 BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixPointerArray ( ' VTable offset = 88
 BYVAL hConstant AS DWORD
 , BYVAL ppMatrix AS DWORD
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixTranspose ( ' VTable offset = 92
 BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixTransposeArray ( ' VTable offset = 96
 BYVAL hConstant AS DWORD
 , BYREF pMatrix AS D3DXMATRIX
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetMatrixTransposePointerArray ( ' VTable offset = 100
 BYVAL hConstant AS DWORD
 , BYVAL ppMatrix AS DWORD
 , BYVAL Count AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'//----------------------------------------------------------------------------
'// ID3DXFragmentLinker
'//----------------------------------------------------------------------------
INTERFACE ID3DXFragmentLinker $IID_ID3DXFragmentLinker
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetDevice ( ' VTable offset = 12
 BYREF ppDevice AS IDirect3DDevice9
 ) AS LONG
 ' =====================================================================================
 METHOD GetNumberOfFragments ( ' VTable offset = 16
 ) AS DWORD ' UINT
 ' =====================================================================================
 METHOD GetFragmentHandleByIndex ( ' VTable offset = 20
 BYVAL Index AS DWORD
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD GetFragmentHandleByName ( ' VTable offset = 24
 BYREF Name AS ASCIIZ
 ) AS DWORD ' D3DXHANDLE
 ' =====================================================================================
 METHOD GetFragmentDesc ( ' VTable offset = 28
 BYVAL Name AS DWORD
 , BYREF FragDesc AS D3DXFRAGMENT_DESC
 ) AS LONG
 ' =====================================================================================
 METHOD AddFragments ( ' VTable offset = 32
 BYREF Fragments AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetAllFragments ( ' VTable offset = 36
 BYREF ppBuffer AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD GetFragment ( ' VTable offset = 40
 BYVAL Name AS DWORD
 , BYREF ppBuffer AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD LinkShader ( ' VTable offset = 44
 BYREF pProfile AS ASCIIZ
 , BYVAL Flags AS DWORD
 , BYREF rgFragmentHandles AS DWORD
 , BYVAL cFragments AS DWORD
 , BYREF ppBuffer AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD LinkVertexShader ( ' VTable offset = 48
 BYREF pProfile AS ASCIIZ
 , BYVAL Flags AS DWORD
 , BYREF rgFragmentHandles AS DWORD
 , BYVAL cFragments AS DWORD
 , BYREF pVShader AS IDirect3DVertexShader9
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD LinkPixelShader ( ' VTable offset = 52
 BYREF pProfile AS ASCIIZ
 , BYVAL Flags AS DWORD
 , BYREF rgFragmentHandles AS DWORD
 , BYVAL cFragments AS DWORD
 , BYREF pPShader AS IDirect3DPixelShader9
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD ClearCache ( ' VTable offset = 56
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'//----------------------------------------------------------------------------
'// D3DXINCLUDE_TYPE:
'//----------------------------------------------------------------------------
%EQUATE `D3DXINC_LOCAL = 0
%EQUATE `D3DXINC_SYSTEM = 1
' // force 32-bit size enum
%EQUATE `D3DXINC_FORCE_DWORD = &H7FFFFFFF
'//----------------------------------------------------------------------------
'// ID3DXInclude:
'// -------------
'// This interface is intended to be implemented by the application, and can
'// be used by various D3DX APIs. This enables application-specific handling
'// of #include directives in source files.
'//
'// Open()
'// Opens an include file. If successful, it should fill in ppData and
'// pBytes. The data pointer returned must remain valid until Close is
'// subsequently called.
'// Close()
'// Closes an include file. If Open was successful, Close is guaranteed
'// to be called before the API using this interface returns.
'//----------------------------------------------------------------------------
'DECLARE_INTERFACE(ID3DXInclude)
' STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
' STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
'};
'//////////////////////////////////////////////////////////////////////////////
'// APIs //////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//----------------------------------------------------------------------------
'// D3DXAssembleShader:
'// -------------------
'// Assembles a shader.
'//
'// Parameters:
'// pSrcFile
'// Source file name
'// hSrcModule
'// Module handle. if NULL, current module will be used
'// pSrcResource
'// Resource name in module
'// pSrcData
'// Pointer to source code
'// SrcDataLen
'// Size of source code, in bytes
'// pDefines
'// Optional NULL-terminated array of preprocessor macro definitions.
'// pInclude
'// Optional interface pointer to use for handling #include directives.
'// If this parameter is NULL, #includes will be honored when assembling
'// from file, and will error when assembling from resource or memory.
'// Flags
'// See D3DXSHADER_xxx flags
'// ppShader
'// Returns a buffer containing the created shader. This buffer contains
'// the assembled shader code, as well as any embedded debug info.
'// ppErrorMsgs
'// Returns a buffer containing a listing of errors and warnings that were
'// encountered during assembly. If you are running in a debugger,
'// these are the same messages you will see in your debug output.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXAssembleShaderFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXAssembleShaderFromFileA" (_
 BYREF pSrcFile AS ASCIIZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
DECLARE FUNCTION D3DXAssembleShaderFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXAssembleShaderFromFileW" (_
 BYREF pSrcFile AS WSTRINGZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXAssembleShaderFromFile = D3DXAssembleShaderFromFileW
#ELSE
 MACRO D3DXAssembleShaderFromFile = D3DXAssembleShaderFromFileA
#ENDIF
DECLARE FUNCTION D3DXAssembleShaderFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXAssembleShaderFromResourceA" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
DECLARE FUNCTION D3DXAssembleShaderFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXAssembleShaderFromResourceW" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXAssembleShaderFromResource = D3DXAssembleShaderFromResourceW
#ELSE
 MACRO D3DXAssembleShaderFromResource = D3DXAssembleShaderFromResourceA
#ENDIF
DECLARE FUNCTION D3DXAssembleShader IMPORT $D3DX_DLLNAME ALIAS "D3DXAssembleShader" (_
 BYREF pSrcData AS ASCIIZ
 , BYVAL SrcDataLen AS DWORD
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXCompileShader:
'// ------------------
'// Compiles a shader.
'//
'// Parameters:
'// pSrcFile
'// Source file name.
'// hSrcModule
'// Module handle. if NULL, current module will be used.
'// pSrcResource
'// Resource name in module.
'// pSrcData
'// Pointer to source code.
'// SrcDataLen
'// Size of source code, in bytes.
'// pDefines
'// Optional NULL-terminated array of preprocessor macro definitions.
'// pInclude
'// Optional interface pointer to use for handling #include directives.
'// If this parameter is NULL, #includes will be honored when compiling
'// from file, and will error when compiling from resource or memory.
'// pFunctionName
'// Name of the entrypoint function where execution should begin.
'// pProfile
'// Instruction set to be used when generating code. Currently supported
'// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1",
'// "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0"
'// Flags
'// See D3DXSHADER_xxx flags.
'// ppShader
'// Returns a buffer containing the created shader. This buffer contains
'// the compiled shader code, as well as any embedded debug and symbol
'// table info. (See D3DXGetShaderConstantTable)
'// ppErrorMsgs
'// Returns a buffer containing a listing of errors and warnings that were
'// encountered during the compile. If you are running in a debugger,
'// these are the same messages you will see in your debug output.
'// ppConstantTable
'// Returns a ID3DXConstantTable object which can be used to set
'// shader constants to the device. Alternatively, an application can
'// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
'// the shader.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXCompileShaderFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXCompileShaderFromFileA" (_
 BYREF pSrcFile AS ASCIIZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYREF pFunctionName AS ASCIIZ
 , BYREF pProfile AS ASCIIZ
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 , BYREF ppConstantTable AS ID3DXConstantTable
 ) AS LONG
DECLARE FUNCTION D3DXCompileShaderFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXCompileShaderFromFileW" (_
 BYREF pSrcFile AS WSTRINGZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYREF pFunctionName AS WSTRINGZ
 , BYREF pProfile AS WSTRINGZ
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 , BYREF ppConstantTable AS ID3DXConstantTable
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCompileShaderFromFile = D3DXCompileShaderFromFileW
#ELSE
 MACRO D3DXCompileShaderFromFile = D3DXCompileShaderFromFileA
#ENDIF
DECLARE FUNCTION D3DXCompileShaderFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXCompileShaderFromResourceA" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYREF pFunctionName AS ASCIIZ
 , BYREF pProfile AS ASCIIZ
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 , BYREF ppConstantTable AS ID3DXConstantTable
 ) AS LONG
DECLARE FUNCTION D3DXCompileShaderFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXCompileShaderFromResourceW" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYREF pFunctionName AS WSTRINGZ
 , BYREF pProfile AS WSTRINGZ
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 , BYREF ppConstantTable AS ID3DXConstantTable
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXCompileShaderFromResource = D3DXCompileShaderFromResourceW
#ELSE
 MACRO D3DXCompileShaderFromResource = D3DXCompileShaderFromResourceA
#ENDIF
DECLARE FUNCTION D3DXCompileShader IMPORT $D3DX_DLLNAME ALIAS "D3DXCompileShader" (_
 BYREF pSrcData AS ASCIIZ
 , BYVAL SrcDataLen AS DWORD
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYREF pFunctionName AS ASCIIZ
 , BYREF pProfile AS ASCIIZ
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 , BYREF ppConstantTable AS ID3DXConstantTable
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXDisassembleShader:
'// ----------------------
'// Takes a binary shader, and returns a buffer containing text assembly.
'//
'// Parameters:
'// pShader
'// Pointer to the shader byte code.
'// ShaderSizeInBytes
'// Size of the shader byte code in bytes.
'// EnableColorCode
'// Emit HTML tags for color coding the output?
'// pComments
'// Pointer to a comment string to include at the top of the shader.
'// ppDisassembly
'// Returns a buffer containing the disassembled shader.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXDisassembleShader IMPORT $D3DX_DLLNAME ALIAS "D3DXDisassembleShader" (_
 BYVAL pShader AS DWORD
 , BYVAL EnableColorCode AS LONG
 , BYREF pComments AS ASCIIZ
 , BYREF ppDisassembly AS ID3DXBuffer
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile:
'// -----------------------------------------------------
'// Returns the name of the HLSL profile best suited to a given device.
'//
'// Parameters:
'// pDevice
'// Pointer to the device in question
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetPixelShaderProfile IMPORT $D3DX_DLLNAME ALIAS "D3DXGetPixelShaderProfile" (_
 BYVAL pDevice AS IDirect3DDevice9
 ) AS DWORD
DECLARE FUNCTION D3DXGetVertexShaderProfile IMPORT $D3DX_DLLNAME ALIAS "D3DXGetVertexShaderProfile" (_
 BYVAL pDevice AS IDirect3DDevice9
 ) AS DWORD
'//----------------------------------------------------------------------------
'// D3DXFindShaderComment:
'// ----------------------
'// Searches through a shader for a particular comment, denoted by a FourCC in
'// the first DWORD of the comment. If the comment is not found, and no other
'// error has occurred, S_FALSE is returned.
'//
'// Parameters:
'// pFunction
'// Pointer to the function DWORD stream
'// FourCC
'// FourCC used to identify the desired comment block.
'// ppData
'// Returns a pointer to the comment data (not including comment token
'// and FourCC). Can be NULL.
'// pSizeInBytes
'// Returns the size of the comment data in bytes. Can be NULL.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXFindShaderComment IMPORT $D3DX_DLLNAME ALIAS "D3DXFindShaderComment" (_
 BYVAL pFunction AS DWORD
 , BYVAL FourCC AS DWORD
 , BYREF ppData AS ANY
 , BYREF pSizeInBytes AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXGetShaderSize:
'// ------------------
'// Returns the size of the shader byte-code, in bytes.
'//
'// Parameters:
'// pFunction
'// Pointer to the function DWORD stream
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetShaderSize IMPORT $D3DX_DLLNAME ALIAS "D3DXGetShaderSize" (_
 BYVAL pFunction AS DWORD
 ) AS DWORD ' UINT
'//----------------------------------------------------------------------------
'// D3DXGetShaderVersion:
'// -----------------------
'// Returns the shader version of a given shader. Returns zero if the shader
'// function is NULL.
'//
'// Parameters:
'// pFunction
'// Pointer to the function DWORD stream
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetShaderVersion IMPORT $D3DX_DLLNAME ALIAS "D3DXGetShaderVersion" (_
 BYVAL pFunction AS DWORD
 ) AS DWORD
'//----------------------------------------------------------------------------
'// D3DXGetShaderSemantics:
'// -----------------------
'// Gets semantics for all input elements referenced inside a given shader.
'//
'// Parameters:
'// pFunction
'// Pointer to the function DWORD stream
'// pSemantics
'// Pointer to an array of D3DXSEMANTIC structures. The function will
'// fill this array with the semantics for each input element referenced
'// inside the shader. This array is assumed to contain at least
'// MAXD3DDECLLENGTH elements.
'// pCount
'// Returns the number of elements referenced by the shader
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetShaderInputSemantics IMPORT $D3DX_DLLNAME ALIAS "D3DXGetShaderInputSemantics" (_
 BYVAL pFunction AS DWORD
 , BYREF pSemantics AS D3DXSEMANTIC
 , BYREF pCount AS DWORD
 ) AS LONG
DECLARE FUNCTION D3DXGetShaderOutputSemantics IMPORT $D3DX_DLLNAME ALIAS "D3DXGetShaderOutputSemantics" (_
 BYVAL pFunction AS DWORD
 , BYREF pSemantics AS D3DXSEMANTIC
 , BYREF pCount AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXGetShaderSamplers:
'// ----------------------
'// Gets semantics for all input elements referenced inside a given shader.
'//
'// pFunction
'// Pointer to the function DWORD stream
'// pSamplers
'// Pointer to an array of LPCSTRs. The function will fill this array
'// with pointers to the sampler names contained within pFunction, for
'// each sampler referenced inside the shader. This array is assumed to
'// contain at least 16 elements.
'// pCount
'// Returns the number of samplers referenced by the shader
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetShaderSamplers IMPORT $D3DX_DLLNAME ALIAS "D3DXGetShaderSamplers" (_
 BYVAL pFunction AS DWORD
 , BYREF pSamplers AS ASCIIZ
 , BYREF pCount AS DWORD
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXGetShaderConstantTable:
'// ---------------------------
'// Gets shader constant table embedded inside shader. A constant table is
'// generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in
'// the body of the shader.
'//
'// Parameters:
'// pFunction
'// Pointer to the function DWORD stream
'// ppConstantTable
'// Returns a ID3DXConstantTable object which can be used to set
'// shader constants to the device. Alternatively, an application can
'// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
'// the shader.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGetShaderConstantTable IMPORT $D3DX_DLLNAME ALIAS "D3DXGetShaderConstantTable" (_
 BYVAL pFunction AS DWORD
 , BYREF ppConstantTable AS ID3DXConstantTable
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXCreateTextureShader:
'// ------------------------
'// Creates a texture shader object, given the compiled shader.
'//
'// Parameters
'// pFunction
'// Pointer to the function DWORD stream
'// ppTextureShader
'// Returns a ID3DXTextureShader object which can be used to procedurally
'// fill the contents of a texture using the D3DXFillTextureTX functions.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXCreateTextureShader IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateTextureShader" (_
 BYVAL pFunction AS DWORD
 , BYREF ppTextureShader AS ID3DXTextureShader
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXGatherFragments:
'// -------------------
'// Assembles shader fragments into a buffer to be passed to a fragment linker.
'// will generate shader fragments for all fragments in the file
'//
'// Parameters:
'// pSrcFile
'// Source file name
'// hSrcModule
'// Module handle. if NULL, current module will be used
'// pSrcResource
'// Resource name in module
'// pSrcData
'// Pointer to source code
'// SrcDataLen
'// Size of source code, in bytes
'// pDefines
'// Optional NULL-terminated array of preprocessor macro definitions.
'// pInclude
'// Optional interface pointer to use for handling #include directives.
'// If this parameter is NULL, #includes will be honored when assembling
'// from file, and will error when assembling from resource or memory.
'// Flags
'// See D3DXSHADER_xxx flags
'// ppShader
'// Returns a buffer containing the created shader fragments. This buffer contains
'// the assembled shader code, as well as any embedded debug info.
'// ppErrorMsgs
'// Returns a buffer containing a listing of errors and warnings that were
'// encountered during assembly. If you are running in a debugger,
'// these are the same messages you will see in your debug output.
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXGatherFragmentsFromFileA IMPORT $D3DX_DLLNAME ALIAS "D3DXGatherFragmentsFromFileA" (_
 BYREF pSrcFile AS ASCIIZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
DECLARE FUNCTION D3DXGatherFragmentsFromFileW IMPORT $D3DX_DLLNAME ALIAS "D3DXGatherFragmentsFromFileW" (_
 BYREF pSrcFile AS WSTRINGZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXGatherFragmentsFromFile = D3DXGatherFragmentsFromFileW
#ELSE
 MACRO D3DXGatherFragmentsFromFile = D3DXGatherFragmentsFromFileA
#ENDIF
DECLARE FUNCTION D3DXGatherFragmentsFromResourceA IMPORT $D3DX_DLLNAME ALIAS "D3DXGatherFragmentsFromResourceA" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS ASCIIZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
DECLARE FUNCTION D3DXGatherFragmentsFromResourceW IMPORT $D3DX_DLLNAME ALIAS "D3DXGatherFragmentsFromResourceW" (_
 BYVAL hSrcModule AS DWORD
 , BYREF pSrcResource AS WSTRINGZ
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO D3DXGatherFragmentsFromResource = D3DXGatherFragmentsFromResourceW
#ELSE
 MACRO D3DXGatherFragmentsFromResource = D3DXGatherFragmentsFromResourceA
#ENDIF
DECLARE FUNCTION D3DXGatherFragments IMPORT $D3DX_DLLNAME ALIAS "D3DXGatherFragments" (_
 BYREF pSrcData AS ASCIIZ
 , BYVAL SrcDataLen AS DWORD
 , BYREF pDefines AS D3DXMACRO
 , BYVAL pInclude AS IUnknown
 , BYVAL Flags AS DWORD
 , BYREF ppShader AS ID3DXBuffer
 , BYREF ppErrorMsgs AS ID3DXBuffer
 ) AS LONG
'//----------------------------------------------------------------------------
'// D3DXCreateFragmentLinker:
'// -------------------------
'// Creates a fragment linker with a given cache size. The interface returned
'// can be used to link together shader fragments. (both HLSL & ASM fragements)
'//
'// Parameters:
'// pDevice
'// Pointer to the device on which to create the shaders
'// ShaderCacheSize
'// Size of the shader cache
'// ppFragmentLinker
'// pointer to a memory location to put the created interface pointer
'//
'//----------------------------------------------------------------------------
DECLARE FUNCTION D3DXCreateFragmentLinker IMPORT $D3DX_DLLNAME ALIAS "D3DXCreateFragmentLinker" (_
 BYVAL pDevice AS IDirect3DDevice9
 , BYVAL ShaderCacheSize AS DWORD
 , BYREF ppFragmentLinker AS ID3DXFragmentLinker
 ) AS LONG
'//////////////////////////////////////////////////////////////////////////////
'// Shader comment block layouts //////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//----------------------------------------------------------------------------
'// D3DXSHADER_CONSTANTTABLE:
'// -------------------------
'// Shader constant information; included as an CTAB comment block inside
'// shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct.
'// Entries in the table are sorted by Name in ascending order.
'//----------------------------------------------------------------------------
' // Size = 28 bytes
TYPE D3DXSHADER_CONSTANTTABLE DWORD
 Size AS DWORD ' DWORD // sizeof(D3DXSHADER_CONSTANTTABLE)
 Creator AS DWORD ' DWORD // LPCSTR offset
 Version AS DWORD ' DWORD // shader version
 Constants AS DWORD ' DWORD // number of constants
 ConstantInfo AS DWORD ' DWORD // D3DXSHADER_CONSTANTINFO[Constants] offset
 Flags AS DWORD ' DWORD // flags shader was compiled with
 Target AS DWORD ' DWORD // LPCSTR offset
END TYPE
' // Size = 20 bytes
TYPE D3DXSHADER_CONSTANTINFO WORD
 Name AS DWORD ' DWORD // LPCSTR offset
 RegisterSet AS WORD ' WORD // D3DXREGISTER_SET
 RegisterIndex AS WORD ' WORD // register number
 RegisterCount AS WORD ' WORD // number of registers
 Reserved AS WORD ' WORD // reserved
 TypeInfo AS DWORD ' DWORD // D3DXSHADER_TYPEINFO offset
 DefaultValue AS DWORD ' DWORD // offset of default value
END TYPE
' // Size = 16 bytes
TYPE D3DXSHADER_TYPEINFO WORD
 Class AS WORD ' WORD // D3DXPARAMETER_CLASS
 Type AS WORD ' WORD // D3DXPARAMETER_TYPE
 Rows AS WORD ' WORD // number of rows (matrices)
 Columns AS WORD ' WORD // number of columns (vectors and matrices)
 Elements AS WORD ' WORD // array dimension
 StructMembers AS WORD ' WORD // number of struct members
 StructMemberInfo AS DWORD ' DWORD // D3DXSHADER_STRUCTMEMBERINFO[Members] offset
END TYPE
' // Size = 8 bytes
TYPE D3DXSHADER_STRUCTMEMBERINFO DWORD
 Name AS DWORD ' DWORD // LPCSTR offset
 TypeInfo AS DWORD ' DWORD // D3DXSHADER_TYPEINFO offset
END TYPE
#ENDIF
