microsoft / microsoft/DirectXShaderCompiler

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

Open
#6,524 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage reflection
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in dxcapi.h beside the existing DXC_PART definitions and compare the reflected part kinds with the two FOURCC values reported in the issue. Add the corresponding named definitions and verify that SF I0 and PSV0 are recognized rather than reported as unknown.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, compilers
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.