Rule 8.2
Chapter 8, Functions and entry points Test
A vertex entry must return the position, as a bare vec4 or as a struct with a @builtin("position") field; a fragment entry returns one @location(0) value, a struct of render targets, or nothing.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
nothing can invent a position, and WGSL says so.
Derives from
Restrictions on Functions (“a vertex shader must return the position built-in output value”); surface §3.
How it is verified
Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.
Where the rule says the compiler enforces it:
src/compiler/ts/entry-io.test.ts.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
Explained in
The sections of the surface document that explain this rule, at commit 26de7be8:
See also
- Rule 8.1 Test
- Rule 8.3 Test
- Design rules
- Error codes
Source
The rule at commit 26de7be8:
docs/language-design.md:618(the design document)reqs/rules/RULE-0802.md(its traceability item)