D3DReflect

Gets a pointer to a reflection interface.

Syntax

HRESULT D3DReflect(
         LPCVOID pSrcData,
         SIZE_T SrcDataSize,
         REFIID pInterface,
         void **ppReflector
)  

Parameters

pSrcData
Type: LPCVOID 

[in] A pointer to source data as compiled HLSL code.

SrcDataSize
Type: SIZE_T 

[in] Length of pSrcData.

pInterface
Type: REFIID 

[in] The reference GUID of the COM interface to use. For example, IID_ID3D11ShaderReflection.

ppReflector
Type: void **

[out] A pointer to a reflection interface.

Return value

Type: HRESULT 

Returns one of the following Direct3D 10 Return Codes.

Remarks

Shader code contains metadata that can be inspected using the reflection APIs.

The following code illustrates retrieving a ID3D11ShaderReflection Interface from a shader.

        pd3dDevice->CreatePixelShader( pPixelShaderBuffer->GetBufferPointer(),
        pPixelShaderBuffer->GetBufferSize(), g_pPSClassLinkage, &g_pPixelShader );

        ID3D11ShaderReflection* pReflector = NULL;
        D3DReflect( pPixelShaderBuffer->GetBufferPointer(), pPixelShaderBuffer->GetBufferSize(),
        IID_ID3D11ShaderReflection, (void**) &pReflector);  

Requirements

Header: Declared in d3dcompiler.h.

Library: Use d3d11.lib.