microsoft / microsoft/DirectXShaderCompiler
Rewriter incorrectly removes types that are used in a member array of another struct
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
In the following example MultipleChildren being an array causes Child type to be be stripped by the rewriter when using -remove-unused-globals
// dxr -E InitArgs -remove-unused-globals test.hlsl
struct Child {
uint Test;
};
struct Parent {
Child MultipleChildren[2];
};
RWStructuredBuffer<Parent> ParentBuffer;
[numthreads(1, 1, 1)]
void InitArgs()
{
ParentBuffer[0] = (Parent)0;
}
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
Start by reproducing the issue with dxr -E InitArgs -remove-unused-globals test.hlsl using the HLSL example in the report. Trace the rewriter's handling of Child when it is referenced through Parent's member array; done means Child is retained while removing unused globals and the reproducer passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100