microsoft / microsoft/DirectXShaderCompiler
Rewriter : does not remove unused typedef statements and it lead to compile error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Hello. I'm struggling with DXR for applying to existing shader code bases.
In the below code, dxr remove PSOutput type as it does not used in entryPoint, but does not remove typedef statement.
It leads to compile error.
dxr.exe -remove-unused-functions -remove-unused-globals -E ps_main
struct VSOutput { };
struct PSOutput {};
typedef PSOutput PSPointOutput;
float4 ps_main(VSOutput psIn) { return float4(0.f, 0.f, 0.f, 1.f); }
Here is dxr output
struct VSOutput { };
typedef PSOutput PSPointOutput;
float4 ps_main(VSOutput psIn) { return float4(0.f, 0.f, 0.f, 1.f); }
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 issue with the provided shader snippet and the dxr.exe command using -remove-unused-functions, -remove-unused-globals, and -E ps_main. Trace the rewriter's unused-declaration handling, focusing on why the typedef remains after PSOutput is removed; done means the rewritten shader no longer contains the unused typedef and compiles successfully.
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
- 45/100