Skip to content

dxcapi.h is missing #defines for 2 DXC_PART_ values ('S','F','I','0' and 'P','S','V','0') #6524

Open

Description

@coopp

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 (11e1318); dxil.dll: 1.8(101.8.2403.24)
  • Host Operating System Windows 11

Activity

  1. added
    bug
    needs-triage
    on Apr 12, 2024
  2. damyanp commented on Apr 12, 2024

    @damyanp
    Member

    Cooper Partin (@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.

  3. coopp commented on Apr 12, 2024

    @coopp
    ContributorAuthor

    Updated Issue details

  4. added this to the Dormant milestone on Apr 15, 2024
  5. added
    reflection
    on Apr 15, 2024
  6. kphillisjr commented on Oct 11, 2026

    @kphillisjr

    I agree this is somewhat of a confusing bug. The biggest issue is that the dxcapi does not include notes for all DXIL parts.

    Current FourCC Values for dxcapi.h:

    #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')

    All Potential Values included in the DXIL Container:

    enum DxilFourCC {
    DFCC_Container = DXIL_FOURCC(
    'D', 'X', 'B',
    'C'), // for back-compat with tools that look for DXBC containers
    DFCC_ResourceDef = DXIL_FOURCC('R', 'D', 'E', 'F'),
    DFCC_InputSignature = DXIL_FOURCC('I', 'S', 'G', '1'),
    DFCC_OutputSignature = DXIL_FOURCC('O', 'S', 'G', '1'),
    DFCC_PatchConstantSignature = DXIL_FOURCC('P', 'S', 'G', '1'),
    DFCC_ShaderStatistics = DXIL_FOURCC('S', 'T', 'A', 'T'),
    DFCC_ShaderDebugInfoDXIL = DXIL_FOURCC('I', 'L', 'D', 'B'),
    DFCC_ShaderDebugName = DXIL_FOURCC('I', 'L', 'D', 'N'),
    DFCC_FeatureInfo = DXIL_FOURCC('S', 'F', 'I', '0'),
    DFCC_PrivateData = DXIL_FOURCC('P', 'R', 'I', 'V'),
    DFCC_RootSignature = DXIL_FOURCC('R', 'T', 'S', '0'),
    DFCC_DXIL = DXIL_FOURCC('D', 'X', 'I', 'L'),
    DFCC_PipelineStateValidation = DXIL_FOURCC('P', 'S', 'V', '0'),
    DFCC_RuntimeData = DXIL_FOURCC('R', 'D', 'A', 'T'),
    DFCC_ShaderHash = DXIL_FOURCC('H', 'A', 'S', 'H'),
    DFCC_ShaderSourceInfo = DXIL_FOURCC('S', 'R', 'C', 'I'),
    DFCC_ShaderPDBInfo = DXIL_FOURCC('P', 'D', 'B', 'I'),
    DFCC_CompilerVersion = DXIL_FOURCC('V', 'E', 'R', 'S'),
    };

    NOTE: More information that may need noting can be found at the LLVM Project website under DXContainer ( see: https://llvm.org/docs/DirectX/DXContainer.html ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triagereflection

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions