D3D11Reflect function

Gets a pointer to a reflection interface.

Syntax

HRESULT D3D11Reflect(
  in  LPCVOID pSrcData,
  in  SIZE_T SrcDataSize,
  out ID3D11ShaderReflection ppReflector
);

Parameters

pSrcData [in]

Type: LPCVOID

A pointer to source data as compiled HLSL code.

SrcDataSize [in]

Type: SIZE_T

Length of pSrcData.

ppReflector [out]

Type: ID3D11ShaderReflection**

The address of a pointer to the ID3D11ShaderReflection interface.

Return value

Type: HRESULT

Returns one of the return codes described in the topic Direct3D 11 Return Codes.

Remarks

The inline D3D11Reflect compiler function is a wrapper for the D3DReflect compiler function. D3D11Reflect can retrieve only a ID3D11ShaderReflection interface from a shader. D3DReflect can retrieve a ID3D11ShaderReflection interface or a Direct3D 10 or Direct3D 10.1 reflection interface, for example, ID3D10ShaderReflection.

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

The following code shows how to retrieve a ID3D11ShaderReflection interface from a shader.

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

ID3D11ShaderReflection* pReflector = NULL; 
D3D11Reflect( pPixelShaderBuffer->GetBufferPointer(), pPixelShaderBuffer->GetBufferSize(), 
            &pReflector);

Requirements

Requirement Value
Header
D3DCompiler.inl
Library
D3dcompiler_47.lib
DLL
D3dcompiler_47.dll

See also

Functions