以下是 ID3D12FunctionReflection 接口的定义:
DECLARE_INTERFACE(ID3D12FunctionReflection)
{
STDMETHOD(GetDesc)(
THIS_
_Out_ D3D12_FUNCTION_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetReturnType)(
THIS) PURE;
STDMETHOD_(UINT, GetParameterCount)(
THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetParameterTypeByIndex)(
THIS_
_In_ UINT ParameterIndex) PURE;
STDMETHOD(GetParameterDesc)(
THIS_
_In_ UINT ParameterIndex,
_Out_ D3D12_PARAMETER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetParameterTypeByName)(
THIS_
_In_ LPCSTR pName) PURE;
STDMETHOD_(LPCSTR, GetParameterName)(
THIS_
_In_ UINT ParameterIndex) PURE;
STDMETHOD(GetAttributeByIndex)(
THIS_
_In_ UINT AttributeIndex,
_Out_ D3D12_ATTRIBUTE_DESC *pDesc) PURE;
STDMETHOD(GetAttributeByName)(
THIS_
_In_ LPCSTR pName,
_Out_ D3D12_ATTRIBUTE_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBuffer)(
THIS_
_In_ UINT BufferIndex) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByName)(
THIS_
_In_ LPCSTR pName) PURE;
STDMETHOD(GetResourceBindingDesc)(
THIS_
_In_ UINT ResourceIndex,
_Out_ D3D12_RESOURCE_BINDING_DESC *pDesc) PURE;
STDMETHOD(GetVariableByName)(
THIS_
_In_ LPCSTR pName,
_Out_ UINT *pIndex) PURE;
STDMETHOD_(LPCSTR, GetResourceName)(
THIS_
_In_ UINT ResourceIndex) PURE;
STDMETHOD_(LPCSTR, GetFunctionName)(
THIS) PURE;
};
这个接口提供了一系列用于获取 HLSL 着色器函数信息的方法,包括获取函数描述、返回值类型、参数数量、参数类型、参数描述、属性描述、常量缓冲区信息、资源绑定描述等等。
要使用这个接口,你通常需要通过调用其他 API 获取到着色器反射器(reflection)对象,然后通过该对象获取到 ID3D12FunctionReflection 接口。例如,可以通过 ID3D12ShaderReflection 接口的方法获取到函数反射接口。具体的使用方法可以参考 Direct3D 12 的相关文档和示例代码。
转载请注明出处:http://www.zyzy.cn/article/detail/26168/Win32 API/D3d12shader.h/ID3D12FunctionReflection