📄 d3dx9shader.h
字号:
// Parameters:
// pFunction
// Pointer to the function DWORD stream
//----------------------------------------------------------------------------
DWORD WINAPI
D3DXGetShaderVersion(
CONST DWORD* pFunction);
//----------------------------------------------------------------------------
// 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
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXGetShaderInputSemantics(
CONST DWORD* pFunction,
D3DXSEMANTIC* pSemantics,
UINT* pCount);
HRESULT WINAPI
D3DXGetShaderOutputSemantics(
CONST DWORD* pFunction,
D3DXSEMANTIC* pSemantics,
UINT* pCount);
//----------------------------------------------------------------------------
// 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
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXGetShaderSamplers(
CONST DWORD* pFunction,
LPCSTR* pSamplers,
UINT* pCount);
//----------------------------------------------------------------------------
// 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.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXGetShaderConstantTable(
CONST DWORD* pFunction,
LPD3DXCONSTANTTABLE* ppConstantTable);
//----------------------------------------------------------------------------
// 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.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateTextureShader(
CONST DWORD* pFunction,
LPD3DXTEXTURESHADER* ppTextureShader);
//----------------------------------------------------------------------------
// 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.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXGatherFragmentsFromFileA(
LPCSTR pSrcFile,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs);
HRESULT WINAPI
D3DXGatherFragmentsFromFileW(
LPCWSTR pSrcFile,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs);
#ifdef UNICODE
#define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileW
#else
#define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileA
#endif
HRESULT WINAPI
D3DXGatherFragmentsFromResourceA(
HMODULE hSrcModule,
LPCSTR pSrcResource,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs);
HRESULT WINAPI
D3DXGatherFragmentsFromResourceW(
HMODULE hSrcModule,
LPCWSTR pSrcResource,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs);
#ifdef UNICODE
#define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceW
#else
#define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceA
#endif
HRESULT WINAPI
D3DXGatherFragments(
LPCSTR pSrcData,
UINT SrcDataLen,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs);
//----------------------------------------------------------------------------
// 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
//
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateFragmentLinker(
LPDIRECT3DDEVICE9 pDevice,
UINT ShaderCacheSize,
LPD3DXFRAGMENTLINKER* ppFragmentLinker);
//----------------------------------------------------------------------------
// D3DXPreprocessShader:
// ---------------------
// Runs the preprocessor on the specified shader or effect, but does
// not actually compile it. This is useful for evaluating the #includes
// and #defines in a shader and then emitting a reformatted token stream
// for debugging purposes or for generating a self-contained 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.
// ppShaderText
// Returns a buffer containing a single large string that represents
// the resulting formatted token stream
// 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.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXPreprocessShaderFromFileA(
LPCSTR pSrcFile,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPD3DXBUFFER* ppShaderText,
LPD3DXBUFFER* ppErrorMsgs);
HRESULT WINAPI
D3DXPreprocessShaderFromFileW(
LPCWSTR pSrcFile,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPD3DXBUFFER* ppShaderText,
LPD3DXBUFFER* ppErrorMsgs);
#ifdef UNICODE
#define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileW
#else
#define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileA
#endif
HRESULT WINAPI
D3DXPreprocessShaderFromResourceA(
HMODULE hSrcModule,
LPCSTR pSrcResource,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPD3DXBUFFER* ppShaderText,
LPD3DXBUFFER* ppErrorMsgs);
HRESULT WINAPI
D3DXPreprocessShaderFromResourceW(
HMODULE hSrcModule,
LPCWSTR pSrcResource,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPD3DXBUFFER* ppShaderText,
LPD3DXBUFFER* ppErrorMsgs);
#ifdef UNICODE
#define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceW
#else
#define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceA
#endif
HRESULT WINAPI
D3DXPreprocessShader(
LPCSTR pSrcData,
UINT SrcDataSize,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPD3DXBUFFER* ppShaderText,
LPD3DXBUFFER* ppErrorMsgs);
#ifdef __cplusplus
}
#endif //__cplusplus
//////////////////////////////////////////////////////////////////////////////
// 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.
//----------------------------------------------------------------------------
typedef struct _D3DXSHADER_CONSTANTTABLE
{
DWORD Size; // sizeof(D3DXSHADER_CONSTANTTABLE)
DWORD Creator; // LPCSTR offset
DWORD Version; // shader version
DWORD Constants; // number of constants
DWORD ConstantInfo; // D3DXSHADER_CONSTANTINFO[Constants] offset
DWORD Flags; // flags shader was compiled with
DWORD Target; // LPCSTR offset
} D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE;
typedef struct _D3DXSHADER_CONSTANTINFO
{
DWORD Name; // LPCSTR offset
WORD RegisterSet; // D3DXREGISTER_SET
WORD RegisterIndex; // register number
WORD RegisterCount; // number of registers
WORD Reserved; // reserved
DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset
DWORD DefaultValue; // offset of default value
} D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO;
typedef struct _D3DXSHADER_TYPEINFO
{
WORD Class; // D3DXPARAMETER_CLASS
WORD Type; // D3DXPARAMETER_TYPE
WORD Rows; // number of rows (matrices)
WORD Columns; // number of columns (vectors and matrices)
WORD Elements; // array dimension
WORD StructMembers; // number of struct members
DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset
} D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO;
typedef struct _D3DXSHADER_STRUCTMEMBERINFO
{
DWORD Name; // LPCSTR offset
DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset
} D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO;
#endif //__D3DX9SHADER_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -