2
\$\begingroup\$

I am attempting to write a code generator that builds C++ structs/classes from D3D12 reflection data built using DXC. Given a simple vertex shader signature:

struct Light
{
    float3 Color;
    float3 Dir;
};

struct cbPerPass : register(b0)
{
    float4x4 gWorldProjTransform;
    Light gGlobaLight;
};

struct VertexIn
{
    float3 Pos      : POSITION;
    float4 Color    : COLOR;
};

struct VertexOut;  // unimportant for the question

VertexOut VS(VertexIn vin) { // do calculations here }

I can retrieve the input parameters via ID3D12ShaderReflection::GetInputParameterDesc(), but this only reports the mapping of VertexIn members to shader registers and any attached semantics. I can get the layout of cbPerPass through ID3D12ShaderReflection::GetConstantBufferByIndex() and the layout of Light through the ID3D12ShaderReflectionType interface.

However, what I would like to retrieve is the layout of the VertexIn struct. Is there a way to do this?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.