You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Retrieving reflection data for structs used in input signatures #3535
I am writing a code generator based on D3D12 shader reflection data. Given a simple vertex shader:
struct VertexIn
{
float3 mPos : POSITION;
float3 mColor : COLOR;
};
struct VertexOut; // layout unimportant to question
VertexOut VS(VertexIn vin)
{
// some math here, return a VertexOut
}
I can use ID3D12ShaderReflection::GetInputParameterDesc to get the type and semantic for each member of VertexIn, as well as the register it is mapped to. However, I would like to retrieve the names of the VertexIn members (i.e. "mPos" and "mColor") for my generated code. Is there a way to do this?
I think the SemanticName is available as part of the _D3D12_SIGNATURE_PARAMETER_DESC
typedef struct _D3D12_SIGNATURE_PARAMETER_DESC
{
LPCSTR SemanticName; // Name of the semantic
UINT SemanticIndex; // Index of the semantic
UINT Register; // Number of member variables
D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
BYTE Mask; // Mask to indicate which components of the register
// are used (combination of D3D10_COMPONENT_MASK values)
BYTE ReadWriteMask; // Mask to indicate whether a given component is
// never written (if this is an output signature) or
// always read (if this is an input signature).
// (combination of D3D_MASK_* values)
UINT Stream; // Stream index
D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
} D3D12_SIGNATURE_PARAMETER_DESC;
I do not see a way to get this information. Looks like there are ways to inspect buffers/resources etc and get their names but not the names of members on these inputs.
I've noticed that ID3D12ShaderReflectionType::GetMemberTypeName returns the member name, not the type name. While this seems like a bug to me, it is currently doing what was requested in this issue.
Activity
damyanp commentedon Apr 17, 2024
Cooper Partin (@coopp) - as you're looking in to the reflection stuff at the moment you may be able to answer whether or not this is possible.
coopp commentedon Apr 18, 2024
I think the SemanticName is available as part of the _D3D12_SIGNATURE_PARAMETER_DESC
damyanp commentedon Apr 18, 2024
The question is about obtaining the member name (eg
mPos) as opposed to the semantic name (egPOSITION).coopp commentedon Apr 18, 2024
OH! I misread the question. I'll look some more to see if that information can be retrieved.
coopp commentedon Apr 18, 2024
I do not see a way to get this information. Looks like there are ways to inspect buffers/resources etc and get their names but not the names of members on these inputs.
aclysma commentedon Sep 8, 2024
I've noticed that ID3D12ShaderReflectionType::GetMemberTypeName returns the member name, not the type name. While this seems like a bug to me, it is currently doing what was requested in this issue.