D3DReflect function

Gets a pointer to a reflection interface.

Syntax

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

Parameters

pSrcData

Type: LPCVOID

A pointer to source data as compiled HLSL code.

SrcDataSize

Type: SIZE_T

Length of pSrcData.

pInterface

Type: REFIID

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

ppReflector

Type: void**

A pointer to a reflection interface.

Return Value

Type: HRESULT

Returns one of the Direct3D 11 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

   
Target Platform Windows
Header d3dcompiler.h
Library D3dcompiler_47.lib
DLL D3dcompiler_47.dll

See Also

Functions