microsoft / microsoft/DirectXShaderCompiler

[Doc Update Request] Clarify the `discard` statement as _not_ a control flow statement

Open
#5,546 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.