microsoft / microsoft/DirectXShaderCompiler

Header output option `-Fh` results in invalid default identifier for library targets

Open
#5,072 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug low-hanging-fruit
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

When compiling to a library target, such as lib_6_3, if you use the -Fh option to output the compiled shader to a header, the default identifier used for the shader bytes will be g_lib.no::entry. This is an invalid identifier, caused (I suspect) by the way it normally uses the entry name to name this variable, but for libraries, the first entry in the metadata list is a special entry for the library, with this special name that shouldn't be used for anything.

A workaround is to use the -Vn <name> option to explicitly name the variable.

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 by tracing the -Fh header-output path for library targets such as lib_6_3, then inspect how the first metadata entry is used to derive the default identifier. Reproduce the g_lib.no::entry output and verify that the generated header uses a valid identifier without -Vn overriding it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.