microsoft / microsoft/DirectXShaderCompiler
fxc.exe vs dxc.exe: "static const int" use as compile time constant
Open
Nobody has claimed this yet.
bug
fxc-disagrees
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
This code construct used to work with fxc.exe but doesn't compile with dxc.
Is this expected?
static const uint2 c2Thread= uint2(8, 8);
static const uint cThread = c2Thread.x*c2Thread.y;
groupshared float4 S1[cThread];
[numthreads(c2Thread.x, c2Thread.y, 1)]
void csMain() ....
note: inlining the numerical constants does work fine:
static const uint2 c2Thread= uint2(8, 8);
static const uint cThread = c2Thread.x*c2Thread.y;
groupshared float4 S1[64];
[numthreads(8, 8, 1)]
void csMain() ....
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the shown HLSL with both fxc.exe and dxc.exe, comparing the constant-expression and inlined forms. Trace the compiler behavior for groupshared array sizes and numthreads arguments; done means establishing whether the difference is expected and documenting or correcting the confirmed behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100