microsoft / microsoft/DirectXShaderCompiler
[Doc Update Request] Clarify the `discard` statement as _not_ a control flow statement
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
The discard statement is referred to on this page as a "flow control statement" which unfortunately misleads a number of newer HLSL practitioners into what the instruction does (namely, demotion to a helper lane that elides UAV writes and render target exports after the discard is encountered). As far as I am aware, discard doesn't perform any flow control at all, but some developers are lead to believe (erroneously) that the discard functions as a sort of "early return."
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 with the linked HLSL flow-control documentation page and review how it describes the discard statement. Done means the page no longer presents discard as a control-flow statement and clearly explains its demotion and output-elision behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100