DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
dxcapi.h is missing #defines for 2 DXC_PART_ values ('S','F','I','0' and 'P','S','V','0')
Description While enumerating parts in a DXIL container using the reflection data interface, I noticed that there were some unknown values being returned. Looks like the dxcapi.h is missing them
The FOURCC values missing are: 'S','F','I','0' and 'P','S','V','0'
Steps to Reproduce
// dxapi.h header
#define DXC_FOURCC(ch0, ch1, ch2, ch3) ( \
(UINT32)(UINT8)(ch0) | (UINT32)(UINT8)(ch1) << 8 | \
(UINT32)(UINT8)(ch2) << 16 | (UINT32)(UINT8)(ch3) << 24 \
)
#define DXC_PART_PDB DXC_FOURCC('I', 'L', 'D', 'B')
#define DXC_PART_PDB_NAME DXC_FOURCC('I', 'L', 'D', 'N')
#define DXC_PART_PRIVATE_DATA DXC_FOURCC('P', 'R', 'I', 'V')
#define DXC_PART_ROOT_SIGNATURE DXC_FOURCC('R', 'T', 'S', '0')
#define DXC_PART_DXIL DXC_FOURCC('D', 'X', 'I', 'L')
#define DXC_PART_REFLECTION_DATA DXC_FOURCC('S', 'T', 'A', 'T')
#define DXC_PART_SHADER_HASH DXC_FOURCC('H', 'A', 'S', 'H')
#define DXC_PART_INPUT_SIGNATURE DXC_FOURCC('I', 'S', 'G', '1')
#define DXC_PART_OUTPUT_SIGNATURE DXC_FOURCC('O', 'S', 'G', '1')
#define DXC_PART_PATCH_CONSTANT_SIGNATURE DXC_FOURCC('P', 'S', 'G', '1')
void FourCCToString(uint32_t value)
{
uint8_t* values = reinterpret_cast<uint8_t*>(&value);
for (size_t i = 0; i < 4; ++i)
{
std::cout << "'" << values[i] << "' ";
}
std::cout << "\n";
}
const char* DxcPartKindToString(uint32_t kind)
{
switch (kind)
{
case DXC_PART_PDB:
return "DXC_PART_PDB";
case DXC_PART_PDB_NAME:
return "DXC_PART_PDB_NAME";
case DXC_PART_PRIVATE_DATA:
return "DXC_PART_PRIVATE_DATA";
case DXC_PART_ROOT_SIGNATURE:
return "DXC_PART_ROOT_SIGNATURE";
case DXC_PART_DXIL:
return "DXC_PART_DXIL";
case DXC_PART_REFLECTION_DATA:
return "DXC_PART_REFLECTION_DATA";
case DXC_PART_SHADER_HASH:
return "DXC_PART_SHADER_HASH";
case DXC_PART_INPUT_SIGNATURE:
return "DXC_PART_INPUT_SIGNATURE";
case DXC_PART_OUTPUT_SIGNATURE:
return "DXC_PART_OUTPUT_SIGNATURE";
case DXC_PART_PATCH_CONSTANT_SIGNATURE:
return "DXC_PART_PATCH_CONSTANT_SIGNATURE";
default:
FourCCToString(kind); // Print unknown kind value
return "UNKNOWN";
}
}
void PrintSupportedDXILContainerParts(IDxcContainerReflection* containerReflection)
{
uint32_t numParts = 0;
check_hresult(containerReflection->GetPartCount(&numParts));
std::cout << numParts << " total parts found in DXIL container reflection data\n";
for (uint32_t i = 0; i < numParts; ++i)
{
uint32_t partKind = 0;
check_hresult(containerReflection->GetPartKind(i, &partKind));
std::cout << DxcPartKindToString(partKind) << " found in DIXL container reflection data\n";
}
}
Example of output
8 total parts found in DXIL container reflection data
'S' 'F' 'I' '0'
UNKNOWN found in DIXL container reflection data
DXC_PART_INPUT_SIGNATURE found in DIXL container reflection data
DXC_PART_OUTPUT_SIGNATURE found in DIXL container reflection data
'P' 'S' 'V' '0'
UNKNOWN found in DIXL container reflection data
DXC_PART_REFLECTION_DATA found in DIXL container reflection data
DXC_PART_PDB_NAME found in DIXL container reflection data
DXC_PART_SHADER_HASH found in DIXL container reflection data
DXC_PART_DXIL found in DIXL container reflection data
Environment
- DXC version dxcompiler.dll: 1.8 - 1.8.2403.37 (11e1318c3); dxil.dll: 1.8(101.8.2403.24)
- Host Operating System Windows 11
@coopp - can you clarify a bit more how these steps reproduce this issue please? It's not obvious to me how FOURCC values come into play in this repro.
Updated Issue details