What is guaranteed
137 rules
The compiler's traceability tree records how each design rule is held at commit af54ddad5: a test checks it, only the code that carries it out names it, nothing checks it yet, or review holds it. Below, the 137 rules under those four headings, each with its first sentence and the files that verify it at the pin.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Checked by a test Test
128 rules. A test, a gate script or a CI workflow names each one, and the compiler's traceability check fails when a listed file stops naming its rule.
- Rule 1.1
-
A
"use typeshade"program must mean what this document defines.Verified by
scripts/compile-gate.ts:172 - Rule 1.3
-
The CPU oracle is the reference evaluation of the meaning this document defines (Rule 1.1): ECMAScript’s result for a form borrowed from ECMAScript, with the arithmetic of the WGSL types the program uses, WGSL’s result for a form borrowed from WGSL, the recorded result where a rule gives another, and, where WGSL leaves room (§11), one of the permitted answers.
Verified by
src/core/oracle-backend-parity.test.ts:1src/core/passes/determinism.test.ts:10 - Rule 1.4
-
Where ECMAScript has a form that carries the GPU meaning, the surface must borrow TypeScript’s spelling; a WGSL spelling is borrowed only where no ECMAScript spelling carries the meaning, and the borrowing must keep every WGSL capability reachable (Rule 11.14).
Verified by
src/compiler/ts/diagnostic-removed.test.ts:1src/core/coverage/wgsl.ts:9src/core/spec-conformance/capability-coverage.test.ts:45 - Rule 1.7
-
Every form the surface takes beyond TypeScript must be one the language service can give TypeScript’s checker so that the checker serves the editor (Rule 12.7): projected to valid TypeScript, or kept as a form TypeScript parses, whose grammar report the language service drops and whose content it checks with the compiler’s own check of that form (a stage attribute, Rule 8.1, or
@workgroup_size, Rule 8.22).Verified by
src/compiler/ts/decorated-form.test.ts:1src/language-service/new-entry-forms.test.ts:1 - Rule 1.8
-
A construct of the language is written in the language’s own syntax: the directive, a type of the surface, or an attribute
@nameor@name(…)on the declaration it marks.Verified by
src/compiler/ts/stage-call.test.ts:1src/compiler/ts/stage-call.ts:1 - Rule 2.1
-
Every author-facing name must come from exactly one of three sources:
Verified by
src/compiler/ts/class-methods.test.ts:1src/compiler/ts/host-names.test.ts:1src/compiler/ts/matrix-f-aliases.test.ts:1src/compiler/ts/new-expression.test.ts:111src/compiler/ts/reference-parameters.test.ts:1src/core/spec-conformance/surface-names.test.ts:144src/language-service/ambient-parity-math-object.test.ts:1src/language-service/ambient-parity.test.ts:1src/language-service/diagnostics-brand-tags.test.ts:2src/language-service/diagnostics-glsl-hlsl-names.test.ts:2src/language-service/diagnostics-module-variables.test.ts:2src/language-service/diagnostics-one-mistake.test.ts:2src/language-service/diagnostics-vector-arithmetic.test.ts:2src/language-service/diagnostics.test.ts:2 - Rule 2.2
-
A compiler-internal name (§2.1) must not be authorable.
Verified by
src/compiler/ts/math-alias.ts:1src/compiler/ts/swizzle-random.test.ts:1src/core/spec-conformance/surface-names.test.ts:50 - Rule 2.3
-
A value sometimes has to cross between a representation the compiler chose and one the target has: an
f64and the twof32halves that carry it across an interface off32.Verified by
src/compiler/ts/f64-types.test.ts:1src/compiler/ts/lower/function.ts:1 - Rule 2.4
-
An ECMAScript name that has a WGSL meaning must lower to that meaning, and an ECMAScript name that has no WGSL meaning is still an ECMAScript name, whatever the backend expands it to.
Verified by
src/compiler/ts/cbrt.test.ts:1src/core/spec-conformance/surface-names.test.ts:52 - Rule 3.1
-
A shader file must begin with the directive
"use typeshade"as its first statement.Verified by
src/compiler/ts/compile.contract.test.ts:1src/compiler/ts/directive-placement.test.ts:1 - Rule 3.2
-
A local variable, parameter, module constant or module variable may use any identifier TypeScript permits.
Verified by
examples/emit-goldens.test.ts:20src/compiler/ts/declared-builtin-names.test.ts:1src/compiler/ts/function-shadowing.test.ts:1src/compiler/ts/link.test.ts:2src/compiler/ts/link.ts:1src/compiler/ts/reserved-names.test.ts:1src/core/backends/glsl-spelling.test.ts:6src/core/backends/wgsl-spelling.test.ts:5src/core/passes/predeclared-names.ts:3src/core/passes/rename-predeclared.test.ts:4src/core/passes/rename-predeclared.ts:40src/core/passes/spell-names.ts:2src/core/passes/variable-names.ts:2src/core/spelling-plan.ts:14 - Rule 3.3
-
A declaration named by a WGSL keyword or reserved word must receive a fresh WGSL spelling, with every reference rewritten, whatever its kind (Proposal 0070).
Verified by
src/compiler/ts/kernel-param-names.test.ts:1src/compiler/ts/reserved-names.test.ts:1src/core/backends/glsl-spelling.test.ts:6src/core/backends/wgsl-spelling.test.ts:5src/core/passes/spell-names.ts:2src/core/passes/variable-names.ts:2src/core/reserved-words.ts:11src/core/spelling-plan.ts:14 - Rule 3.4
-
A local variable, parameter, module constant or module variable that collides with a GLSL ES 3.00 identifier restriction must be renamed consistently by the GLSL writer; helper function renaming retains its existing behavior.
Verified by
src/compiler/ts/kernel-param-names.test.ts:2src/compiler/ts/reserved-names.test.ts:1src/core/backends/glsl-sanitize.ts:22src/core/backends/glsl-spelling.test.ts:6src/core/glsl-name-written.test.ts:1src/core/passes/variable-names.ts:2src/core/spelling-plan.ts:14 - Rule 3.5
-
A name the compiler generates (the mangler, the type aliaser) must not be a keyword or reserved word of either target.
Verified by
examples/reserved-word-safety.test.ts:23src/core/backends/glsl-entry-wrapper-name.test.ts:17 - Rule 3.6
-
A type name an author writes is spelled as its source spells it: lowercase where WGSL declares it, as ECMAScript spells it where ECMAScript declares it (
Map,Set,boolean), and capitalized where TypeShade declares it.Verified by
src/core/spec-conformance/surface-names.test.ts:52 - Rule 3.8
-
A shader module that host code imports is named
*.shade.ts, and a host import of a.tsfile that begins with the directive under any other name must be refused with the rename.Verified by
src/vite.test.ts:1src/vite.ts:21 - Rule 3.9
-
A shader file may import what another shader file exports, by a relative specifier or, from a package, by the package’s name; the file a compile starts from and every shader file it imports, directly or through another, are one program, which emits one module, and each file keeps the scope TypeScript gives it.
Verified by
scripts/user-journey.ts:24src/compiler/ts/link-overloads.test.ts:1src/compiler/ts/link.test.ts:1src/compiler/ts/link.ts:1src/compiler/ts/pure-alias-host.test.ts:1src/compiler/ts/pure-alias.test.ts:1src/compiler/ts/specifier.test.ts:1src/compiler/ts/specifier.ts:1src/language-service/check.test.ts:237src/language-service/program-refusal-location-owner-middle.test.ts:1src/language-service/program-refusal-location-owner-repeats.test.ts:1src/language-service/program-refusal-location-stays-entry.test.ts:1src/language-service/program-refusal-location-stays-named.test.ts:1src/language-service/program-refusal-location-struct-cli.test.ts:1src/language-service/program-refusal-location.test.ts:1src/vite.test.ts:2 - Rule 4.1
-
Every type an author writes must be a type borrowed from WGSL under a TypeScript spelling, a member of the
f64family (Rule 4.4), a key type, or a type ECMAScript defines that the compiler represents (Rule 1.5).Verified by
src/compiler/ts/key-types.test.ts:1src/compiler/ts/key-types.ts:1src/compiler/ts/type-map.ts:1src/core/spec-conformance/surface-names.test.ts:52 - Rule 4.2
-
A type alias is another name for its target.
Verified by
src/compiler/ts/type-alias.test.ts:1src/compiler/ts/type-map/shapes.test.ts:1src/compiler/ts/type-structs.test.ts:1 - Rule 4.3
-
A brand must be erased:
f32 & { readonly [m]: 'm' }and{ readonly __brand: 'm' }are the carrier type, and the brand must reach no emitted text.Verified by
examples/shade-examples.test.ts:26 - Rule 4.4
-
The
f64family (f64,vec2f64,vec3f64,vec4f64, the short spellingsvec2d,vec3d, andvec4dand, by type argument,mat2<f64>,mat3<f64>, andmat4<f64>) is the one numeric type family TypeShade adds that WGSL does not have.Verified by
src/core/passes/fp64-lower.test.ts:3 - Rule 4.5
-
A TypeScript type the compiler cannot represent on a target must be refused in one sentence naming the reason and what to write instead; the list is surface §28 and is not repeated here.
Verified by
src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1 - Rule 4.6
-
booleanwritten as a type must meanbool, andnumberwritten as a type must mean that the type is inferred from its uses (OD-7); where no use decides, the type must bef32.Verified by
src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1src/compiler/ts/number-types.test.ts:1 - Rule 4.7
-
f16and thehspellings must not be authorable until the roadmap’s After 1.0 row is picked up; thef16capability may be declared through the EDSL and nothing an author writes uses it.Verified by
src/core/backends/capability-reachability.test.ts:1 - Rule 4.8
-
Every
matCxRwithCandRin 2, 3, 4 must be a type, and a square one must also answer tomatN.Verified by
examples/shade-examples.test.ts:26src/compiler/ts/bare-uniform-glsl.test.ts:1src/compiler/ts/bindings.ts:592src/compiler/ts/matrices.test.ts:1src/compiler/ts/type-map.ts:1src/compiler/ts/type-map/scalar-names.ts:1src/compiler/ts/uniform-layout.test.ts:333src/core/reflect.test.ts:1src/core/reflect.ts:1src/core/std140.ts:7 - Rule 5.1
-
An integer-written literal must take the integer type the position around it declares.
Verified by
src/compiler/ts/abstract-const.test.ts:1src/compiler/ts/abstract-const.ts:1src/compiler/ts/int-lit-coerce.test.ts:1src/compiler/ts/int-lit-context.test.ts:1src/compiler/ts/int-lit-range.test.ts:1src/compiler/ts/list-by-uses.test.ts:1src/compiler/ts/lit-coerce.ts:1src/compiler/ts/local-numeric-inference.test.ts:1src/compiler/ts/local-numeric-inference.ts:1src/compiler/ts/lower/expression-array/list-uses.ts:1src/compiler/ts/module-let-list.test.ts:1src/compiler/ts/use-inference-module.test.ts:1src/compiler/ts/use-inference.test.ts:1src/compiler/ts/use-inference.ts:1 - Rule 5.2
-
A written number beside a typed peer in an arithmetic operator or a builtin call must take the peer’s kind; a written number beside an
f64or anf64vector must become anf64literal carrying the full double.Verified by
src/compiler/ts/abstract-const.test.ts:1src/compiler/ts/abstract-const.ts:1src/compiler/ts/f64-types.test.ts:1src/compiler/ts/int-lit-coerce.test.ts:1src/compiler/ts/int-lit-context.test.ts:1src/compiler/ts/int-lit-range.test.ts:1src/compiler/ts/numeric.ts:1 - Rule 5.3
-
There is no implicit conversion between concrete types; an
i32beside au32, or an integer beside a float, must be refused with the cast to write.Verified by
src/compiler/ts/local-numeric-inference.test.ts:1src/compiler/ts/numeric.test.ts:1src/compiler/ts/numeric.ts:1src/compiler/ts/scalar-cast-type.test.ts:1 - Rule 5.4
-
A literal must fit the type it takes;
-1in au32position and2147483648in ani32position are refused as written.Verified by
src/compiler/ts/field-initializer-range.test.ts:1src/compiler/ts/int-lit-context.test.ts:1src/compiler/ts/local-numeric-inference.test.ts:1 - Rule 5.5
-
A single float-written literal valued as a whole number may take a declared integer type in a declaration only; a return, an argument, and a field must not take that carve-out.
Verified by
src/compiler/ts/int-lit-context.test.ts:1 - Rule 6.1
-
A resource must be written
declare const x: uniform<T>,declare const x: storage<T>,declare const x: storage<T, "read_write">, ordeclare const x: <texture or sampler type>.Verified by
examples/binding-declared.test.ts:29src/compiler/ts/bindings.ts:1src/compiler/ts/host-face.ts:5src/compiler/ts/host-resource.ts:1src/compiler/ts/readonly-ts-arrays.test.ts:1src/compiler/ts/unsized-ts-arrays.test.ts:1src/runtime/exported-binding.test.ts:79src/runtime/resource-call.test.ts:10src/runtime/resource.ts:610src/runtime/unsized-storage.test.ts:1 - Rule 6.2
-
A storage binding’s access mode is inferred from what the program does: a binding that some entry writes, by assignment, a mutating method, an atomic builtin, or a write through a function or a reference parameter, is
var<storage, read_write>, and every other storage binding isvar<storage, read>.Verified by
src/compiler/ts/bindings.ts:1src/compiler/ts/context.ts:1src/compiler/ts/declare-bind.test.ts:1src/compiler/ts/lower/atomics.ts:1src/compiler/ts/lower/readonly-promise.ts:1src/compiler/ts/member-assign-emit.test.ts:1src/compiler/ts/member-assign-places.test.ts:1src/compiler/ts/member-assign.test.ts:1src/compiler/ts/remedy-lines.test.ts:1src/compiler/ts/storage-access-paths.test.ts:1src/compiler/ts/storage-access.test.ts:1src/compiler/ts/storage-access.ts:1src/language-service/ambient-matrix-index.test.ts:1src/language-service/ambient-storage-access.test.ts:1src/language-service/ambient-texture-lowering.test.ts:1src/language-service/ambient-texture-refusals.test.ts:1src/language-service/ambient-vector-math.test.ts:1src/language-service/ambient.test.ts:1 - Rule 6.3
-
A top-level
constis a module constant: a scalar must fold to one value carried at double precision for the oracle and at the target’s precision for emit, and a vector, array, or struct must carry a constant-foldable expression every backend evaluates.Verified by
src/compiler/ts/math-binding.test.ts:1src/compiler/ts/math-binding.ts:1src/compiler/ts/module-const-f64.test.ts:1src/compiler/ts/module-const.test.ts:1src/compiler/ts/module-const.ts:1 - Rule 6.4
-
A pipeline-overridable constant must be written
const x: override<T> = defaultordeclare const x: override<T>.Verified by
examples/override-constants.test.ts:9 - Rule 6.5
-
A top-level
letis a module variable in the per-invocation (private) address space; workgroup memory must be writtenlet x: workgroup<T>; a module variable must take nodeclare.Verified by
src/compiler/ts/module-vars-atomic.test.ts:1src/compiler/ts/module-vars.test.ts:1 - Rule 6.6
-
An entry point’s inputs and outputs are explicit parameters and return values.
Verified by
src/cli/migrate.test.ts:8src/cli/migrate.ts:3src/compiler/ts/attribute-types.test.ts:1src/compiler/ts/attribute-types.ts:1src/compiler/ts/builtin-type-form.test.ts:1src/compiler/ts/builtin-type-form.ts:1src/compiler/ts/builtin-values.test.ts:1src/compiler/ts/decorated-form.test.ts:1src/compiler/ts/entry-locations.test.ts:1src/compiler/ts/entry-locations.ts:1src/compiler/ts/io-attribute-arguments.test.ts:1src/compiler/ts/io-name-cascades.test.ts:1src/compiler/ts/stage3.test.ts:1src/compiler/ts/type-map.ts:1src/language-service/entry-location-hover-imports-programs.test.ts:1src/language-service/entry-location-hover-imports-refusals.test.ts:1src/language-service/entry-location-hover-imports.test.ts:1src/language-service/entry-location-hover-places.test.ts:1src/language-service/entry-location-hover.test.ts:1src/language-service/hover.ts:1src/language-service/new-entry-forms.test.ts:1 - Rule 6.7
-
The attribute names the compiler reads are
vertex,fragment,compute,workgroup_size,builtin,location,interpolate,invariantandblend_src(the last three since #168, surface §53).Verified by
src/compiler/ts/attribute-types.test.ts:1src/compiler/ts/attribute-types.ts:1src/compiler/ts/decorated-form.test.ts:1src/compiler/ts/decorated-form.ts:2src/compiler/ts/diagnostic-removed.test.ts:1src/compiler/ts/io-attribute-arguments.test.ts:1src/compiler/ts/kernel-workgroup.test.ts:2src/compiler/ts/numerics-removed.test.ts:1src/compiler/ts/stage-call.test.ts:1src/compiler/ts/stage-call.ts:1src/compiler/ts/stage3.test.ts:1src/core/spec-conformance/surface-names.test.ts:52src/language-service/new-entry-forms.test.ts:1src/language-service/service-output-and-cache.test.ts:1src/language-service/service.test.ts:1 - Rule 6.8
-
The byte layout the emitted module assumes for a resource and the layout
reflect()reports must agree byte for byte, under WGSL’s uniform and storage layout rules, and so must the layout the manifest carries (Rule 11.10); a vertex entry’s vertex buffer is one layout, its@locationinputs tightly packed in the order written and numbered in that order where nolocation<n, T>states the number (Rule 6.6), whichreflect().vertexand the manifest both report.Verified by
examples/emit-reflection-conformance.test.ts:31src/compiler/ts/bare-uniform-glsl.test.ts:1src/compiler/ts/entry-locations.test.ts:1src/compiler/ts/entry-locations.ts:1src/compiler/ts/uniform-layout-matrix.test.ts:1src/compiler/ts/uniform-layout-padded.test.ts:1src/compiler/ts/uniform-layout-refused.test.ts:1src/compiler/ts/uniform-layout.test.ts:1src/core/manifest.test.ts:6src/core/reflect.ts:1 - Rule 6.9
-
A struct must be the members written in it, in one of four spellings (
class,interface, atypeover an object literal, an object type literal written where a type stands).Verified by
examples/shade-examples.test.ts:26src/compiler/ts/class-syntax.test.ts:1755src/compiler/ts/inheritance-methods.test.ts:1src/compiler/ts/inheritance-refusals.test.ts:1src/compiler/ts/inheritance.test.ts:1src/compiler/ts/type-structs.test.ts:1 - Rule 6.10
-
A local
constbinds its name once and leaves what it holds as writable as TypeScript does.Verified by
examples/shade-examples.test.ts:26src/compiler/ts/class-methods.test.ts:1src/compiler/ts/class-syntax.test.ts:1550src/compiler/ts/lower/second-name.ts:1src/compiler/ts/member-assign.test.ts:1src/compiler/ts/object-reference-removed-forms.test.ts:1src/compiler/ts/object-reference-reviews.test.ts:1src/compiler/ts/object-reference-unread.test.ts:1src/compiler/ts/object-reference.test.ts:1src/compiler/ts/reference-parameters.test.ts:1src/compiler/ts/second-name-copies.test.ts:1src/compiler/ts/second-name.test.ts:1 - Rule 6.11
-
The compiler adds one binding an author did not write for a
consolecall, and only when a compile asks for GPU recording (compile(src, { console: 'gpu' })):_console, aread_writestorage buffer ofstruct _Console { cursor: atomic<u32>, dropped: atomic<u32>, words: array<u32> }, at group 0, the first binding past the module’s own group-0 bindings, the slot the_fp64guard takes by the same rule (the guard, when there is one, comes one past it).Verified by
src/core/passes/console-buffer.test.ts:9src/core/passes/console-buffer.ts:1 - Rule 7.1
-
An operator, a swizzle, an index, and a call must mean what WGSL’s typing table gives them.
Verified by
src/compiler/ts/lower/operator-kinds.ts:1src/compiler/ts/operators-statements.test.ts:1src/compiler/ts/swizzle-assign.test.ts:1src/core/oracle-backend-parity.test.ts:1src/language-service/service-output-and-cache.test.ts:1src/language-service/service.test.ts:1 - Rule 7.2
-
Where TypeShade lowers a TypeScript form to a WGSL form, the mapping must be a rule with a recorded divergence; the mappings today are:
Verified by
examples/emit-goldens.test.ts:20examples/loop-examples.test.ts:1src/compiler/ts/attribute-types.test.ts:1src/compiler/ts/swizzle-assign.test.ts:1src/core/kernel-tree.test.ts:1src/core/passes/scatter-f32.test.ts:1src/core/passes/select-composite.test.ts:1 - Rule 7.3
-
An empty
switchcase directly above a case with a body is one clause with several selectors (case 0: case 1:is WGSL’scase 0, 1:); an empty case with no case below it or directly abovedefault:, and an emptydefault:with a case after it, must be refused; a case body must not fall through into the body of a case below it.Verified by
src/compiler/ts/fallthrough.ts:1src/compiler/ts/operators-statements.test.ts:156src/compiler/ts/switch-array.test.ts:1 - Rule 7.4
-
A shift amount the compiler can fold must be in 0 to 31; a divisor the compiler can prove to be zero must be refused where the division is lowered.
Verified by
src/compiler/ts/loop-bound.ts:4src/compiler/ts/lower/expression.ts:1src/compiler/ts/lower/statement.ts:1src/compiler/ts/module-const.ts:1src/compiler/ts/shift-amount.test.ts:1src/compiler/ts/zero-divisor.test.ts:1 - Rule 7.5
-
A
forloop means what it means in TypeScript: its initializer runs once, its condition (truewhen it has none) is tested before each trip, and its update runs after each trip and at eachcontinue(change 0136).Verified by
examples/shade-examples.test.ts:26src/compiler/ts/counter-cast.test.ts:1src/compiler/ts/loop-bound.ts:3src/compiler/ts/loop-shapes.test.ts:1src/compiler/ts/lower/control.ts:10src/compiler/ts/open-for.test.ts:1src/compiler/ts/runtime-loop-bound.test.ts:1 - Rule 7.6
-
A read of a local before it is assigned on every path must be refused (
TS8075), by TypeScript’s rule for its TS2454; an argument is a read, as TypeScript reads it, and no call assigns the caller’s local (change 0142); every target starts a local declared with no initializer at the zero of its type.Verified by
src/compiler/ts/attribute-types.test.ts:1src/compiler/ts/definite-assignment.test.ts:1src/compiler/ts/definite.ts:77src/compiler/ts/host-kernel-out.test.ts:3src/core/backends/glsl/backend.ts:1 - Rule 7.7
-
discardmust be written as a bare statement, the identifier alone (discard), and may stand in a fragment entry and in a helper no vertex or compute entry can reach.Verified by
src/compiler/ts/builtins.test.ts:1src/compiler/ts/unknown-names.test.ts:3 - Rule 7.8
-
The refusals of surface §28 (a union of two GPU types, a string type, an absent literal outside the positions of Rule 7.10, a mixed tuple, a rest tuple,
symbol, an intersection of carriers,instanceof,in) must apply to expressions as they do to types, each in one sentence.Verified by
src/compiler/ts/console.test.ts:60src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1src/compiler/ts/key-types.test.ts:2 - Rule 7.9
-
An expression must be evaluated left to right, as TypeScript and WGSL both evaluate it, and a call that writes (its object, a module variable, a storage binding, an atomic location) inside a larger expression must take effect in that order on every target.
Verified by
examples/shade-examples.test.ts:26src/compiler/ts/reference-parameters.test.ts:1src/compiler/ts/sequence-select.test.ts:1src/compiler/ts/sequence.test.ts:1src/compiler/ts/sequence.ts:1 - Rule 7.10
-
T | undefinedandT | nullare optional values.Verified by
examples/shade-examples.test.ts:26src/compiler/ts/lower/expression.ts:1src/compiler/ts/lower/function.ts:2449src/compiler/ts/lower/optional-values.ts:16src/compiler/ts/lower/param-defaults.ts:1src/compiler/ts/lower/statement.ts:1src/compiler/ts/narrowing.ts:1src/compiler/ts/object-reference/written.ts:1src/compiler/ts/optional-values-loose-null.test.ts:1src/compiler/ts/optional-values.test.ts:1src/compiler/ts/optional.ts:1src/compiler/ts/source-file.ts:1src/compiler/ts/type-map.ts:612src/language-service/ambient-parity-math-object.test.ts:1src/language-service/ambient-parity.test.ts:1src/language-service/diagnostics.ts:1src/language-service/diagnostics/same-mistake.ts:1src/language-service/hover.ts:1 - Rule 8.1
-
An entry point is a function declaration at the top of the file or of a namespace, exported or not, with exactly one stage attribute written before the declaration:
@vertex export function vs(…),@fragment …, or@compute([x, y?, z?]) ….Verified by
src/compiler/ts/class-syntax-example.test.ts:1src/compiler/ts/class-syntax.test.ts:1src/compiler/ts/source-file.ts:2src/compiler/ts/stage-call.test.ts:1src/compiler/ts/stage-call.ts:1src/compiler/ts/stage3.test.ts:1src/language-service/new-entry-forms.test.ts:1 - Rule 8.2
-
A vertex entry must return the position, as a bare
vec4or as a struct with abuiltin<"position">field; a fragment entry returns one value at location 0, a struct of render targets, or nothing.Verified by
src/compiler/ts/attribute-types.test.ts:1src/compiler/ts/builtin-type-diagnostic.test.ts:1src/compiler/ts/entry-io.test.ts:1src/compiler/ts/entry-locations.test.ts:1src/compiler/ts/io-attribute-arguments.test.ts:1 - Rule 8.3
-
A builtin WGSL confines by stage may be used in an entry of a permitted stage, and in a helper that no entry of an excluded stage can reach.
Verified by
src/compiler/ts/atomics.test.ts:1src/compiler/ts/compute-stage-reachability.test.ts:1src/compiler/ts/lower/function.ts:1src/compiler/ts/stage-restrictions.ts:1 - Rule 8.4
-
A function must not take part in a call cycle, directly or through other functions; the check reads the calls a body writes, and the calls a method call, an accessor and
newlower to, before any optimisation, so a call in a branch the optimizer would drop is a cycle too.Verified by
src/compiler/ts/class-syntax.test.ts:1798src/compiler/ts/default-args.test.ts:1src/compiler/ts/namespace.test.ts:1src/compiler/ts/recursion.test.ts:1 - Rule 8.5
-
A collective operation (a derivative, an implicit-LOD texture sample, a barrier) must be in uniform control flow.
Verified by
src/compiler/ts/barriers.test.ts:1src/compiler/ts/diagnostic-removed.test.ts:1src/compiler/ts/uniformity-helper-floor.test.ts:1src/core/passes/derivative-rewrite.test.ts:7src/core/passes/derivative-rewrite.ts:3src/core/passes/uniformity.test.ts:23 - Rule 8.6
-
An entry point must not be called from another function, and neither may a kernel function (Rule 8.22).
Verified by
src/compiler/ts/kernel-loops.test.ts:3src/compiler/ts/operators-statements.test.ts:1 - Rule 8.7
-
@computecarries the workgroup size as an array literal of one to three positive whole-number literals, integer module constants oru32override names,x,yandz, a missingyorzbeing 1, and the default is 64; every default extent reaches reflection and the manifest, and each override name reaches WGSL’s@workgroup_size.Verified by
src/compiler/ts/stage3.test.ts:1 - Rule 8.8
-
An object has the identity a JavaScript object has (change 0142).
Verified by
src/compiler/ts/lower/function.ts:2307src/compiler/ts/lower/pending-shares.ts:1src/compiler/ts/lower/second-name.ts:1src/compiler/ts/mutable-parameters.test.ts:1src/compiler/ts/new-object.ts:1src/compiler/ts/object-reference-removed-forms.test.ts:1src/compiler/ts/object-reference-reviews.test.ts:1src/compiler/ts/object-reference-unread.test.ts:1src/compiler/ts/object-reference.test.ts:1src/compiler/ts/object-reference.ts:1src/compiler/ts/object-reference/written.ts:1src/compiler/ts/object-share.ts:1src/compiler/ts/overloads.test.ts:1src/compiler/ts/reference-parameters.test.ts:1src/compiler/ts/second-name-copies.test.ts:1src/compiler/ts/second-name.test.ts:1src/compiler/ts/tint-invalid.test.ts:1src/compiler/ts/written-types.ts:1 - Rule 8.9
-
Method dispatch must be static, and a generic function or class must be compiled once per set of type arguments the program uses (Rule 3.9).
Verified by
examples/shade-examples.test.ts:26src/compiler/ts/class-syntax-example.test.ts:2src/compiler/ts/class-syntax.test.ts:2src/compiler/ts/class-upcasts.test.ts:1src/compiler/ts/class-upcasts.ts:1src/compiler/ts/fieldless-classes.test.ts:1src/compiler/ts/link.test.ts:3src/core/passes/empty-struct.test.ts:1src/core/passes/empty-struct.ts:1 - Rule 8.10
-
A method that writes its object (assigns to
thisor to a field, a component or an element of it, applies++or--to one, hands one to a parameter that its function writes (Rule 8.25), or calls such a method or reads such a getter onthis, on a field, a component or an element of it whatever class that field is, or throughsuper) must take the object by reference, and may return a value like any other method; a base’s body that a class calls throughsuperand that writes its object takes it by reference too, and so does the copy of a method that takes a function (Rule 8.18) when a function handed over writes the variable the call is on.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/class-methods.test.ts:1src/compiler/ts/class-syntax.test.ts:1215src/compiler/ts/higher-order.test.ts:502src/compiler/ts/inout-params.test.ts:1src/compiler/ts/reference-parameters.test.ts:1src/compiler/ts/reference-reads.test.ts:1 - Rule 8.11
-
A
getorsetaccessor is a function of the module,Owner_get_xorOwner_set_x, which takes its object as a method does (Rules 8.10 and 8.28); a read ofo.xmust call the getter, and an assignment, a compound assignment,++and--must call the setter with the new value, the compound forms reading the old one through the getter.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/class-syntax.test.ts:79src/compiler/ts/reference-reads.test.ts:1 - Rule 8.12
-
A private name
#xmust be emitted without its#: a field as the struct memberx, a method asOwner_x, an accessor asOwner_get_xandOwner_set_x, a static field asOwner_x.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/class-syntax.test.ts:300 - Rule 8.13
-
A static field must be a module constant
Owner_xwhen nothing in the program writes it, and a module variable in the per-invocation space (Rule 6.5) when something does; areadonlystatic is never written.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/class-methods.test.ts:1src/compiler/ts/class-syntax.test.ts:419src/compiler/ts/link.test.ts:4 - Rule 8.14
-
A constructor’s parameter property (
constructor(public x: f32), orprivate,protectedorreadonlyin place ofpublic) is a field of its class, at the constructor’s place among the members, which the constructor assigns from the parameter before the field initializers run.Verified by
src/compiler/ts/abstract-super.test.ts:1src/compiler/ts/class-syntax.test.ts:463src/compiler/ts/use-inference-module.test.ts:2 - Rule 8.15
-
A member declared
privatemay be named only inside the body of the class that declares it, and one declaredprotectedonly inside the bodies of that class and of the classes that extend it, on an object of the naming body’s own class or of one that extends it; a name either rule does not allow must be refused with the remedy.Verified by
src/compiler/ts/class-syntax.test.ts:1143 - Rule 8.16
-
An instance field that holds an arrow function or a function expression is a method of its class under the field’s name: the function’s parameters, return type and body are the method’s, an expression body is the value it returns, and
thisin it is the object, as it is in TypeScript.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/class-methods.test.ts:1src/compiler/ts/class-syntax.test.ts:1627 - Rule 8.17
-
A local function (a
constthat holds an arrow function or a function expression, or afunctiondeclaration, written inside a function’s body) is a function of the module named after the body that declares it (surface §14), and it may read and write the variables of the functions around it, as a TypeScript closure does.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/closures.test.ts:41src/compiler/ts/mutable-parameters.test.ts:1src/compiler/ts/reference-parameters.test.ts:1 - Rule 8.18
-
A function whose parameter has a function type, written out (
f: (x: f32) => f32) or through a type alias of one, takes a function: a function declared at the top of the file or of a namespace, a method, a static method, a constructor, a field that holds a function (Rule 8.16) and a local function (Rule 8.17).Verified by
examples/shade-examples.test.ts:27src/compiler/ts/array-constructors.test.ts:1src/compiler/ts/array-methods.test.ts:1src/compiler/ts/higher-order.test.ts:50src/compiler/ts/lower/expression-misc.ts:111src/compiler/ts/lower/function-args.ts:1src/compiler/ts/lower/function-types.ts:75src/compiler/ts/optional-values.test.ts:1 - Rule 8.19
-
A function that writes no return type returns what its body does, as TypeScript infers it: a function of the file or of a namespace, a local function (Rule 8.17), each instance of a generic function (Rule 8.9) and of a function that takes a function (Rule 8.18), a method, a getter and a field that holds a function (Rule 8.16) take the type of their first
returnwith a value, thereturns after it are typed against that type as against a written one, and one with no suchreturnreturns nothing.Verified by
examples/shade-examples.test.ts:27src/compiler/ts/entry-results.test.ts:1src/compiler/ts/lower/caller-decided.ts:1src/compiler/ts/optional-values.test.ts:1src/compiler/ts/return-inference.test.ts:61src/compiler/ts/use-inference-module.test.ts:3 - Rule 8.20
-
A function a host file can call through an import of its module is an exported function that is not an entry point, is not generic, takes no function, has a host value (Rule 8.21) for each parameter and for its result, and reaches, through the calls of its body, no binding, no workgroup variable and no builtin that a host call does not run yet (a derivative or a barrier: not supported yet on the CPU tier of a host call, Rule 8.24, Rule 11.7; an atomic and an implicit-LOD texture sample reach a binding or a workgroup variable, which the first two clauses already exclude).
Verified by
src/compiler/ts/host-class.test.ts:1src/compiler/ts/host-face-cpu-tier.test.ts:1src/compiler/ts/host-face-default-param.test.ts:1src/compiler/ts/host-face.test.ts:1src/compiler/ts/host-face.ts:81 - Rule 8.21
-
A host call passes and returns host values: an
f32,f64,i32oru32is anumber, aboolaboolean, a vector a tuple of its components,readonlyin the host view as an argument and as a result (change 0116, decision D1), a matrix a flat column-major array of its components, anarray<T, N>an array ofNhost values ofT, a struct an object of its fields, an instance of its exported class among them (change 0109), anenummember its number, and a value of a key type (Rule 4.1), as a parameter or a result, one of its members as a string, which the call refuses when it is none of them, and aRecordover a key type, as a parameter or a result, an object with one property for each member, which the call refuses when one is missing or another is there (change 0081); in a binding and in an array with no size, a key is its id, a number, and aRecordthe array of its values in id order.Verified by
src/compiler/ts/fieldless-classes.test.ts:1src/compiler/ts/host-class.test.ts:2src/compiler/ts/host-draw.test.ts:2src/compiler/ts/host-entry.test.ts:2src/compiler/ts/host-face-cpu-tier.test.ts:2src/compiler/ts/host-face-default-param.test.ts:2src/compiler/ts/host-face.test.ts:2src/compiler/ts/host-face.ts:82src/compiler/ts/host-kernel-grown.test.ts:1src/compiler/ts/host-kernel-made-elements.test.ts:1src/compiler/ts/host-kernel-made-resource.test.ts:1src/compiler/ts/host-kernel-made-shared.test.ts:1src/compiler/ts/host-kernel-made-waiting.test.ts:1src/compiler/ts/host-kernel-made.test.ts:1src/compiler/ts/host-kernel-push.test.ts:1src/compiler/ts/host-kernel.test.ts:1src/compiler/ts/host-private-class.test.ts:1src/compiler/ts/host-private-names.test.ts:1src/compiler/ts/host-private-shader.test.ts:1src/compiler/ts/kernel-project.test.ts:1src/compiler/ts/key-types.test.ts:4src/compiler/ts/optional-values.test.ts:1src/compiler/ts/typed-bindings.test.ts:1src/core/host-defaults.ts:1src/core/host-entry.ts:1src/core/host-input-projection.ts:1src/core/host-kernel-made/on-resource.ts:1src/core/host-key.ts:1src/core/host-private-key.test.ts:1src/core/host-values.ts:1src/core/passes/empty-struct.test.ts:1src/runtime/buffer-kinds.test.ts:1src/runtime/buffer-scalar.test.ts:1src/runtime/exported-binding.test.ts:255src/runtime/host-types.test.ts:1src/runtime/host-types.ts:4src/runtime/region.ts:4src/runtime/resource-call.test.ts:10src/runtime/resource.test.ts:1src/runtime/resource.ts:650src/runtime/unsized-storage.test.ts:1 - Rule 8.22
-
A kernel function is an exported function that is not an entry point, a function declaration, and takes at least one array with no size (
array<T>) or one 2D storage texture (texture_storage_2d<F, A>, change 0077), or returns an array with no size that its body makes (Rule 8.23, change 0114, S5); a sampled texture alone does not make one, so an exported helper that reads one stays a helper an entry calls; its candidate loops are theforandfor…ofstatements at the top level of its body, and no other loop is ever a candidate.Verified by
examples/loop-examples.test.ts:2scripts/gpu-differential.ts:1src/compiler/ts/host-face.ts:5src/compiler/ts/host-kernel-collections.test.ts:1src/compiler/ts/host-kernel-finish.test.ts:1src/compiler/ts/host-kernel-growing-open.test.ts:1src/compiler/ts/host-kernel-growing.test.ts:1src/compiler/ts/host-kernel-made.test.ts:2src/compiler/ts/host-kernel-methods.test.ts:1src/compiler/ts/host-kernel-push.test.ts:1src/compiler/ts/host-kernel-range.test.ts:1src/compiler/ts/host-kernel-texture.test.ts:1src/compiler/ts/host-kernel.test.ts:2src/compiler/ts/kernel-corpus.test.ts:1src/compiler/ts/kernel-loops-guards.test.ts:1src/compiler/ts/kernel-loops.test.ts:1src/compiler/ts/kernel-loops.ts:1src/compiler/ts/kernel-scatter.test.ts:1src/compiler/ts/kernel-workgroup.test.ts:1src/compiler/ts/key-types.test.ts:3src/compiler/ts/lower/array-methods.ts:38src/compiler/ts/lower/collections.ts:1src/compiler/ts/lower/expression-call.ts:1src/compiler/ts/lower/function.ts:2521src/compiler/ts/lower/kernel-methods.ts:1src/compiler/ts/made-array-refusals.test.ts:1src/compiler/ts/stage3.test.ts:1src/compiler/ts/static-read-wording.test.ts:1src/compiler/ts/type-map.ts:1129src/core/fuse-entry.test.ts:1src/core/fuse-entry.ts:1src/core/host-kernel.ts:1359src/core/kernel-tree.test.ts:1src/core/kernel-tree.ts:1src/core/kernel-workgroup.ts:1src/core/passes/access.ts:40src/core/passes/determinism.test.ts:220src/core/passes/kernel-lower.ts:23src/core/passes/kernel-stores.ts:1src/core/passes/parallel-loop.test.ts:1src/core/passes/parallel-loop.ts:2src/core/passes/scatter-f32.test.ts:1src/core/testing/random-kernel-differential.test.ts:4src/language-service/new-entry-forms.test.ts:1src/runtime/buffer-scalar.test.ts:2 - Rule 8.23
-
A kernel function’s parameter of an array with no size is the caller’s array (change 0142): the body reads its elements and its
.length, writes its elements in place, and cannot assign it whole (TS8018).Verified by
scripts/gpu-differential.ts:1scripts/kernel-length-cases.ts:2src/compiler/ts/codes.ts:1src/compiler/ts/grown-array-refusals.test.ts:1src/compiler/ts/grown-length-index-words.test.ts:1src/compiler/ts/host-face.ts:5src/compiler/ts/host-face/made.ts:1src/compiler/ts/host-kernel-collections.test.ts:2src/compiler/ts/host-kernel-counted-reads.test.ts:1src/compiler/ts/host-kernel-counted.test.ts:1src/compiler/ts/host-kernel-gl-length.test.ts:1src/compiler/ts/host-kernel-growing-open.test.ts:2src/compiler/ts/host-kernel-growing-retired.test.ts:1src/compiler/ts/host-kernel-growing-route.test.ts:1src/compiler/ts/host-kernel-growing-run.test.ts:1src/compiler/ts/host-kernel-growing.test.ts:2src/compiler/ts/host-kernel-grown-capacity.test.ts:1src/compiler/ts/host-kernel-grown-elements.test.ts:1src/compiler/ts/host-kernel-grown-length.test.ts:1src/compiler/ts/host-kernel-grown-nest-refusals.test.ts:1src/compiler/ts/host-kernel-grown-nest.test.ts:1src/compiler/ts/host-kernel-grown.test.ts:2src/compiler/ts/host-kernel-made-elements.test.ts:2src/compiler/ts/host-kernel-made-gl.test.ts:1src/compiler/ts/host-kernel-made-resource.test.ts:2src/compiler/ts/host-kernel-made-shared.test.ts:2src/compiler/ts/host-kernel-made-waiting.test.ts:2src/compiler/ts/host-kernel-made.test.ts:3src/compiler/ts/host-kernel-out.test.ts:1src/compiler/ts/host-kernel-push.test.ts:1src/compiler/ts/host-kernel-texture.test.ts:2src/compiler/ts/host-kernel.test.ts:3src/compiler/ts/kernel-loops.test.ts:2src/compiler/ts/kernel-project.test.ts:2src/compiler/ts/key-types.test.ts:3src/compiler/ts/lower/collections.ts:2src/compiler/ts/lower/function.ts:2363src/compiler/ts/lower/kernel-push.ts:1src/compiler/ts/lower/made-array/bounds.ts:1src/compiler/ts/lower/made-array/candidate.ts:1src/compiler/ts/lower/made-array/capacity.ts:1src/compiler/ts/lower/made-array/grown.ts:1src/compiler/ts/lower/made-array/identity.ts:1src/compiler/ts/lower/made-array/length.ts:1src/compiler/ts/lower/made-array/lower.ts:1src/compiler/ts/lower/made-array/nest.ts:1src/compiler/ts/lower/made-array/readable.ts:1src/compiler/ts/lower/made-array/route.ts:1src/compiler/ts/lower/made-array/settle.ts:1src/compiler/ts/lower/made-array/written.ts:1src/compiler/ts/made-array-refusals.test.ts:2src/core/cpu-runtime.ts:1src/core/host-arity.ts:1src/core/host-kernel-counted.test.ts:1src/core/host-kernel-made.ts:1src/core/host-kernel-made/capacity.ts:1src/core/host-kernel-made/counted.ts:1src/core/host-kernel-made/growing.ts:1src/core/host-kernel-made/making.ts:1src/core/host-kernel-made/on-resource.ts:2src/core/host-kernel.ts:132src/core/ir/kernels.ts:1src/core/passes/countable.test.ts:1src/core/passes/countable.ts:1src/core/passes/kernel-lower.ts:62src/core/passes/kernel-project.ts:1src/core/push-count.ts:1src/core/pushed-index.ts:1src/runtime/device.test.ts:12src/runtime/resource-call.test.ts:10 - Rule 8.24
-
An exported
@computeentry is called from host code asentry(bindings, workgroups).Verified by
scripts/compute-case.ts:1scripts/entry-calls.ts:1scripts/user-journey.ts:334src/compiler/ts/host-draw-bindings.test.ts:1src/compiler/ts/host-draw.test.ts:1src/compiler/ts/host-entry.test.ts:1src/compiler/ts/host-face.ts:5src/compiler/ts/host-override-calls.test.ts:1src/compiler/ts/tiled-matmul.test.ts:1src/core/console-print.test.ts:4src/core/console-print.ts:1src/core/host-compute.ts:1src/core/host-entry.ts:2src/fuse.test.ts:22src/runtime/host/draw.ts:132src/runtime/resource-call.test.ts:10src/vite.test.ts:3src/vite.ts:13 - Rule 8.25
-
An object parameter that its function writes is the caller’s object, and the call passes the variable itself, unmarked: reading the parameter reads that object, and assigning to a field or an element of it writes it, for the call (change 0142).
Verified by
examples/shade-examples.test.ts:28src/cli/migrate.ts:3src/compiler/ts/attribute-types.test.ts:1src/compiler/ts/attribute-types.ts:1src/compiler/ts/decorated-form.ts:1src/compiler/ts/definite-assignment.test.ts:1src/compiler/ts/host-face.test.ts:163src/compiler/ts/host-kernel-out.test.ts:2src/compiler/ts/lower/references.ts:1src/compiler/ts/object-reference-removed-forms.test.ts:1src/compiler/ts/object-reference-reviews.test.ts:1src/compiler/ts/object-reference-unread.test.ts:1src/compiler/ts/object-reference.test.ts:1src/compiler/ts/object-reference.ts:1src/compiler/ts/object-reference/written.ts:1src/compiler/ts/object-share.ts:1src/compiler/ts/reference-parameters.test.ts:1src/compiler/ts/reference-reads.test.ts:1src/core/cpu-codegen.ts:207src/core/debug/interp.ts:145src/core/oracle.ts:216src/language-service/diagnostics.ts:1 - Rule 8.28
-
A call must not copy a struct or a fixed-size array that its callee only reads when the argument is a place: a
letlocal, a module variable, an element or a field of a binding, a reference the caller holds (a parameter it writes through or reads in place), or a field or an element of one of those.Verified by
src/compiler/ts/local-places.test.ts:1src/compiler/ts/lower/second-name.ts:1src/compiler/ts/reference-reads.test.ts:1src/core/backends/glsl-global-places.ts:9src/core/backends/wgsl-let-places.ts:1src/core/backends/wgsl-ptr.ts:25src/core/backends/wgsl-return-into.ts:1src/core/passes/local-places.ts:1 - Rule 8.29
-
A class is its struct and its functions.
Verified by
scripts/class-arm.ts:1src/compiler/ts/abstract-super.test.ts:1src/compiler/ts/kernel-loops.test.ts:4src/core/fuse-plan.test.ts:12 - Rule 9.1
-
Every builtin id the compiler can emit must be classified as portable (
PORTABLE_INTRINSICS) or as a row of theINTRINSICSregistry; an unclassified id must not reach a backend.Verified by
src/core/intrinsic-coverage.test.ts:1 - Rule 9.2
-
A builtin’s signature must be WGSL’s, checked at the call.
Verified by
src/compiler/ts/array-minmax-types.test.ts:1src/compiler/ts/lower/math-args.ts:1src/core/spec-conformance/surface-names.test.ts:50 - Rule 9.3
-
A WGSL builtin GLSL ES 3.00 has no spelling for must be behind a capability, and the GLSL emit must fail closed on it.
Verified by
src/core/backends/capability-reachability.test.ts:1src/core/passes/required-caps.ts:10 - Rule 9.4
-
A
Mathmember must lower to the WGSL builtin of the same meaning, and so must its free-function spelling where WGSL has a builtin of that name (sqrt,max; Rule 9.9 removedpow); aMathmember with no WGSL builtin must be expanded into WGSL arithmetic, stays an ECMAScript name and has no free spelling;Math.fround(x)isf32(x).Verified by
src/compiler/ts/math-binding.test.ts:1src/compiler/ts/math-binding.ts:1src/compiler/ts/math-expand.test.ts:1src/compiler/ts/math-scalar.test.ts:1src/core/spec-conformance/surface-names.test.ts:236 - Rule 9.5
-
A function the file declares or imports (Rule 3.9) must win over every builtin function of its name, whether a WGSL built-in function, the free spelling of a
Mathmember (Rule 9.4) or a TypeShade extension that is a function (§9.3), as a module-scope declaration hides a predeclared function in WGSL and as TypeScript’s lookup finds the file’s own name before a global: a call of the name reaches the declaration in the constant folder, on the CPU, on WebGPU and on WebGL2, and a function handed by its name to a fold, to an array method or to a function that takes one follows the call.Verified by
scripts/compile-gate.ts:55src/compiler/ts/builtins.test.ts:1src/compiler/ts/closures.test.ts:638src/compiler/ts/declared-builtin-names.test.ts:1src/compiler/ts/higher-order.test.ts:1015src/compiler/ts/link.test.ts:5src/compiler/ts/lower/constructors.ts:1src/compiler/ts/math-binding.test.ts:1src/compiler/ts/math-binding.ts:1src/core/backends/glsl-spelling.test.ts:6src/core/backends/wgsl-spelling.test.ts:5src/core/passes/predeclared-names.ts:3src/core/passes/rename-predeclared.test.ts:2src/core/passes/rename-predeclared.ts:3src/core/passes/spell-names.ts:2src/core/reserved-words.ts:94src/core/spec-conformance/predeclared-names.test.ts:11 - Rule 9.6
-
The author-facing names of source (c) must be exactly the rows below; the table is shrink-only, and a name may join it only by Rule 13.6.
Verified by
src/core/spec-conformance/surface-names.test.ts:522 - Rule 9.7
-
A name must be added to the table in this order and in no other: the rationale is written into this section (and into Rule 4.4’s family for an
f64type), the row is added toTYPESHADE_EXTENSIONSwith the same reason, the surface document gains or extends a§, andCHANGELOG.mdgains an entry under[Unreleased].Verified by
src/core/spec-conformance/surface-names.test.ts:752 - Rule 9.8
-
A row, a declaration, a signature, an overload, or a member must never be added for a compiler-internal name (§2.1), under its own id, under an allowed id, or under a new spelling that denotes the same thing.
Verified by
src/core/spec-conformance/surface-names.test.ts:514 - Rule 9.9
-
A WGSL built-in function, an overload of one, or a §9.3 name must not be authorable when an ECMAScript spelling the compiler supports carries every case it accepts with the same meaning (Rule 1.4).
Verified by
src/compiler/ts/removed-names.test.ts:1src/core/spec-conformance/surface-names.test.ts:235 - Rule 10.1
-
A
"use typeshade"file must not spell a WGSLenableorrequiresstatement.Verified by
src/compiler/ts/builtin-values.test.ts:1 - Rule 10.2
-
The compiler must derive
requiredFeaturesfrom the module and must report them throughreflect(), with every implied capability included.Verified by
src/core/backends/extension-profile.test.ts:1src/core/host-entry.ts:390src/core/passes/required-caps.test.ts:1src/runtime/device.test.ts:1530 - Rule 10.3
-
A GLSL ES 3.00 emit that lacks a capability’s row must fail closed with the target sentence, which opens
backend 'glsl-es300' cannot emit this moduleand endsmissing capabilities: <ids>; on a module with a render entry that is aTS8015warning that leaveswgslin place, and on a compute-only module it is silence,glslbeingundefined.Verified by
src/compiler/ts/compile.contract.test.ts:1src/compiler/ts/texture-multiple-samplers.test.ts:1src/core/backends/glsl-compute.test.ts:8src/core/backends/glsl.test.ts:1src/core/passes/required-caps.test.ts:1src/language-service/check.test.ts:1 - Rule 10.4
-
Every capability must have a witness: a module shape an author can write that uses the feature; a declarable capability with no witness is recorded as such and never advertised as usable.
Verified by
src/core/backends/capability-reachability.test.ts:1 - Rule 10.5
-
A GLSL lowering of a WGSL-only feature (the family #130 to #139: 1d, multisampled, depth read both ways, gather, cube array, storage texture, read-write storage, atomics, and barriers) is deferred by the maintainer, and must not be written until the deferral is lifted.
Verified by
src/core/backends/capability-reachability.test.ts:1 - Rule 11.1
-
There must be one IR, and the WGSL writer, the GLSL ES 3.00 writer, and the CPU oracle must consume it over one shared tree walk; a new emit feature must go into the shared walk, or the oracle and the GLSL writer drift.
Verified by
examples/glsl-stages-parity.test.ts:20src/core/oracle-backend-parity.test.ts:1 - Rule 11.2
-
A divergence between targets, or between a target and the oracle, must be measured on Tint and on a WebGL2 driver before it is kept, and recorded where the emit is decided: a comment on the
INTRINSICSrow with the measured text, and a row of the determinism report (surface §38) where the results may differ.Verified by
src/core/passes/determinism.test.ts:10 - Rule 11.3
-
Every registered example must compile on Tint and, where the module has a GLSL row for each capability it needs, on a WebGL2 driver; an example that is WGSL-only says so with
renderable: falseand a stated reason.Verified by
scripts/compile-gate.ts:172 - Rule 11.4
-
An emit golden is a reviewed artifact: a change to
examples/__emit-goldens__/must be read as a diff and must not be re-baked as a rubber stamp.Verified by
examples/emit-goldens.test.ts:20examples/shade-examples.test.ts:28 - Rule 11.6
-
The public API surface (
src/__api__/surface.md) is generated and must not be edited by hand; an exported name or type may change only with a re-bake.Verified by
src/api-surface.test.ts:63 - Rule 11.7
-
The CPU tier, which runs a host call of a module’s function and, where there is no GPU tier, the invocations of an entry a host calls and the pixels of a fragment entry a host draws (Rule 8.24), is the oracle’s generated code (
generateModuleJs) atf32precision, written into the module the bundler reads as module code, with nonew Function, over the op library alone,typeshade/runtime/internal.Verified by
src/compiler/ts/host-draw.test.ts:3src/compiler/ts/host-entry.test.ts:3src/compiler/ts/host-face-cpu-tier.test.ts:3src/compiler/ts/host-face.test.ts:3src/compiler/ts/host-face.ts:83src/compiler/ts/host-kernel-texture.test.ts:3src/core/cpu-codegen-runtime.ts:9src/core/cpu-texture.test.ts:1src/core/cpu-texture.ts:1src/runtime/host/runtime.ts:1 - Rule 11.8
-
A kernel function’s call (Rule 8.21) runs on the first tier of its owner’s policy that can run it (change 0085).
Verified by
journeys/_host-import/src/device-capabilities.ts:2scripts/compile-gate.ts:18scripts/gpu-differential.ts:1scripts/kernel-length-cases.ts:2scripts/resource-call-arm.ts:184src/compiler/ts/host-class.test.ts:3src/compiler/ts/host-content-access.ts:1src/compiler/ts/host-draw.test.ts:296src/compiler/ts/host-entry.test.ts:163src/compiler/ts/host-face.ts:549src/compiler/ts/host-failed-input.test.ts:1src/compiler/ts/host-kernel-finish.test.ts:2src/compiler/ts/host-kernel-gl-length.test.ts:1src/compiler/ts/host-kernel-made-gl.test.ts:2src/compiler/ts/host-kernel-push.test.ts:1src/compiler/ts/host-kernel-range.test.ts:2src/compiler/ts/host-kernel-texture.test.ts:4src/compiler/ts/host-kernel.test.ts:410src/compiler/ts/host-override-calls.test.ts:1src/core/deprecation.ts:7src/core/device-info.test.ts:1src/core/host-compute.ts:1src/core/host-entry.test.ts:1src/core/host-entry.ts:12src/core/host-failure.ts:1src/core/host-kernel-gl.ts:1src/core/host-kernel.ts:427src/core/host-resident-check.test.ts:9src/core/passes/kernel-lower.ts:62src/core/resident.ts:2src/core/submission.test.ts:7src/fuse.test.ts:22src/runtime/buffer-kinds.test.ts:2src/runtime/buffer-scalar.test.ts:3src/runtime/chunk.test.ts:11src/runtime/chunk.ts:1src/runtime/default-device.ts:3src/runtime/device-capabilities.test.ts:1src/runtime/device-options-types.test.ts:2src/runtime/device.test.ts:12src/runtime/exported-binding.test.ts:297src/runtime/host/draw.ts:1src/runtime/info.test.ts:1src/runtime/resource-call.test.ts:10src/runtime/resource-device.test.ts:12src/runtime/resource.test.ts:1src/runtime/resource.ts:1119src/runtime/runtime.test.ts:8 - Rule 11.9
-
A
consolecall computes nothing a shader reads: its arguments must be evaluated once, in order, on every target, and the call then delivers an event,{ method, args, span, invocation }.Verified by
src/compiler/ts/console-variants.test.ts:1src/compiler/ts/console.test.ts:8src/core/passes/console-buffer.test.ts:9src/core/passes/console-buffer.ts:1src/debug/console.test.ts:8src/runtime/console-variants.test.ts:1src/vite-console-variants.test.ts:1 - Rule 11.10
-
A compiled program’s manifest, what
packModule()returns and what the default export of a module’s host import is, must be one JSON object that carries its schema (schema, 3) and the package version that wrote it (compiler); each binding, struct, field, override, entry and vertex or varying name the host uses with its authored name and its emitted name (emitted, the WGSL spelling; a binding and an override also carryemittedGlsl, the GLSL spelling, which equalsemittedwhere the two agree, changes 0070 and 0151); each binding with its group and slot, its resource inreflect()’s vocabulary, the stages that reach it, and a buffer’s byte layout with every offset, size and stride under the rule of its space (Rule 6.8), the_fp64guard the emit adds among them; each entry with its stage, its default workgroup size and optional axis override names, its inputs and outputs with their locations, builtins and interpolation, the bindings it reaches and which it writes, a vertex entry’s vertex buffer, and its line; the overrides and the WebGPU features; withconsole, the recorded variant, its WGSL, its log table and its bindings; withir, the program as portable IR and the package version that wrote it, which emitted again gives every other field byte for byte; and what the WebGL2 tier uses, each full-screen fragment entry’s GLSL ES 3.00 program, block names and texture-sampler pairs, and each storage array’s data texture.Verified by
scripts/sampler-pair-cases.ts:3src/compiler/ts/bare-uniform-glsl.test.ts:1src/compiler/ts/console-variants.test.ts:1src/compiler/ts/host-face.ts:5src/compiler/ts/host-glsl-name.test.ts:1src/compiler/ts/pack.ts:21src/compiler/ts/texture-multiple-samplers.test.ts:1src/core/emit.ts:797src/core/emitted-record.test.ts:1src/core/glsl-name-written.test.ts:2src/core/ir/portable.test.ts:1src/core/manifest-gl-names.test.ts:6src/core/manifest.test.ts:1src/core/manifest.ts:575src/core/passes/texture-pairs.test.ts:2src/core/passes/texture-pairs.ts:1src/core/reflect.ts:1src/runtime/console-variants.test.ts:1src/runtime/gl-draw.test.ts:252src/runtime/gl-names.test.ts:6src/vite-console-variants.test.ts:1src/vite.test.ts:202 - Rule 11.11
-
The program runtime,
typeshade/runtime, loads a manifest (Rule 11.10) and runs its entries on WebGPU, on the host’s device or on one it requests with the features and the limits the programs need and the limitscreateRuntime({ limits })names (change 0051), and reports the device’s limits asrt.limits, or on WebGL2, on the host’s context or on one it makes, in the ordercreateRuntime({ prefer })gives and reports asrt.tier(change 0054); on WebGL2 it runs a compute entry as the pass program the manifest carries (gl.computes) and never builds one, refuses an entry with none with aTypeErrorthat gives the reason, and draws with the vertex and fragment programs the manifest carries (gl.vertices,gl.draws), keeping WebGPU’s conventions: a texture’s row 0 is the top row a pass draws, a fragment’spositionand a stored depth are WebGPU’s, and a pass into the canvas is turned over onto the screen, and each WebGL2 pass sets its viewport, depth range and blend constant at its start and gives the host’s back at its end; it refuses with aTypeErrorwhat the tier does not support yet (a multisampled, layered or 3D texture, a storage texture in a draw (a compute entry’s storage texture runs as its pass program, Rule 10.5 and Rule 11.8), targets that blend or mask apart, a depth range other than 0 to 1 under a fragment that writesfrag_depth, a depth bias on a format other thandepth24plus,depth32floatanddepth24plus-stencil8, a non-zero depth-bias clamp when the context lacksEXT_polygon_offset_clamp, a texture bound from the depth attachment of the pass that draws), a fallback for each of these being later work (OD-11), and what only WebGPU has, with no fallback meant (aGPUCommandEncoder, a pass’sGPURenderPassEncoder); its module closure must hold no file ofsrc/compiler/and no package, and its bundle must stay within the size budgetscripts/bundle-budget.jsonrecords.Verified by
journeys/_harness.mjs:19scripts/build-info.test.ts:1scripts/bundle-boundary.ts:2scripts/entry-calls-page.ts:11scripts/sampler-pair-cases.ts:3src/bundle-split.test.ts:1src/compiler/ts/console-variants.test.ts:1src/compiler/ts/host-override-calls.test.ts:1src/compiler/ts/typed-bindings.test.ts:2src/core/device-info.test.ts:1src/core/manifest.ts:788src/journeys-boundary.test.ts:6src/runtime/console-variants.test.ts:1src/runtime/device.test.ts:12src/runtime/gl-draw.test.ts:252src/runtime/gl-draw.ts:3src/runtime/gl.ts:3src/runtime/info.test.ts:1src/runtime/limits-layout.test.ts:7src/runtime/limits.test.ts:1src/runtime/limits.ts:1src/runtime/program.ts:1src/runtime/render-state-parity.test.ts:10src/runtime/render-state-types.test.ts:6src/runtime/resources.ts:1src/runtime/runtime.test.ts:1src/runtime/runtime.ts:1 - Rule 11.12
-
An integer division, remainder and shift, and a float’s conversion to an integer, must give WGSL’s answer on GLSL ES 3.00 for every input WGSL settles: the GLSL writer spells each through a helper that settles the inputs GLSL ES 3.00 leaves undefined, and uses the bare operator only where the operands cannot reach one.
Verified by
scripts/gpu-differential.ts:36src/core/backends/glsl-int-answers.test.ts:1src/core/backends/glsl-int.ts:1 - Rule 11.13
-
A fuse scope,
fuse(body)fromtypeshade/fuse(change 0058), runs the kernel calls (Rule 8.21) its body makes as one plan, and must give every array they write, and every result, the bits the same calls give run apart (Rule 11.8).Verified by
src/bundle-split.test.ts:1src/compiler/ts/host-failed-input.test.ts:2src/compiler/ts/host-kernel-push.test.ts:214src/compiler/ts/host-kernel-texture.test.ts:5src/compiler/ts/host-override-calls.test.ts:1src/compiler/ts/kernel-workgroup.test.ts:3src/core/fuse-entry.test.ts:21src/core/fuse-entry.ts:1src/core/fuse-group.test.ts:9src/core/fuse-group.ts:1src/core/fuse-loading.test.ts:1src/core/fuse-plan.ts:1src/core/fuse-record.ts:1src/core/fuse-report.test.ts:6src/core/fuse-report.ts:1src/core/host-compute.ts:1src/core/host-entry.test.ts:1src/core/host-failure.ts:2src/core/host-kernel.ts:1483src/fuse.test.ts:22src/fuse.ts:1src/random-chain.test.ts:28src/runtime/device.test.ts:12 - Rule 11.14
-
Every capability of WebGPU and of WebGL2, as the sources of Appendix C enumerate them, must have exactly one status per target in the coverage table:
typed,raw,refused,planned,gaporn/a.Verified by
src/core/spec-conformance/capability-coverage.test.ts:46 - Rule 11.15
-
A test must fail when a member of a source has no row, and when a row names a member that no source has.
Verified by
src/core/spec-conformance/capability-coverage.test.ts:43 - Rule 11.16
-
A capability that only WebGL2 has must enter the surface only as a row of §9.3 (an author-facing name) or as a capability of §10 (a host feature a module declares or derives); it must not become a language construct, a built-in value or a type by another route.
Verified by
src/core/spec-conformance/capability-coverage.test.ts:48 - Rule 11.17
-
A
rawrow must name one documented escape hatch, and the escape hatches are exactly these:Frame.encoder,RenderPass.raw,Texture.texture,Sampler.sampler,Runtime.device,createRuntime({ device }), a hostGPUBuffer,GPUTexture,GPUTextureView,GPUSampler,WebGLBuffer,WebGLTextureorWebGLSamplerpassed as a binding, a target or a geometry buffer,RenderPipeline.draw(pass, …)andComputePipeline.dispatch(target, …)into the host’s own encoders, andRuntime.submit(…encoders).Verified by
src/api-surface.test.ts:64src/core/device-info.test.ts:1src/runtime/info.test.ts:1src/core/spec-conformance/capability-coverage.test.ts:12 - Rule 11.18
-
A
typedrow must name the test that verifies the capability on each target where it istyped; the test must read both halves where the capability is a language spelling (Rule 12.7).Verified by
src/core/spec-conformance/capability-coverage.test.ts:50 - Rule 11.19
-
The package root exports no IR builder.
Verified by
src/api-surface.test.ts:65src/index.ts:5 - Rule 11.20
-
A common module is a shader package the compiler repository publishes under a
typeshade/<name>subpath:typeshade/algorithmsandtypeshade/random(change 0072).Verified by
scripts/bake-common-modules.ts:91scripts/bundle-boundary.ts:70scripts/gpu-differential.ts:2962src/api-surface.test.ts:113src/common-modules.test.ts:1src/api-doc-coverage.test.ts:302 - Rule 11.21
-
On the CPU oracle and on GLSL ES 3.00, a subgroup is one invocation:
subgroup_sizeis 1,subgroup_invocation_idis 0,subgroup_idislocal_invocation_indexandnum_subgroupsis the workgroup’s invocation count; each subgroup built-in function must give the value it gives a subgroup of one lane (surface §77’s table).Verified by
src/compiler/ts/subgroups.test.ts:1src/core/cpu-runtime.ts:2src/core/debug/dispatch.ts:58src/core/passes/determinism.ts:95src/core/passes/subgroups-one-lane.ts:1 - Rule 11.22
-
No source construct opts a function into a floating-point rewrite; change 0131 removed the
numericscontract of change 0107.Verified by
src/compiler/ts/numerics-removed.test.ts:1src/core/passes/opt/algebraic.test.ts:1src/core/passes/opt/algebraic.ts:1 - Rule 11.23
-
A compiled program may carry more than one WGSL text of a compute entry (a variant).
Verified by
src/core/host-entry.ts:388src/core/host-kernel.ts:477src/core/subgroup-probe.test.ts:1src/core/subgroup-probe.ts:1src/runtime/device.test.ts:1529src/runtime/device.ts:77 - Rule 11.27
-
A function of an emitted module must hold no constant expression that its target refuses to evaluate, or evaluates to another value than the operation has at run time: the pass that settles constant expressions binds an operand of such an operation to a
let, and the operation is evaluated when the shader runs.Verified by
scripts/compile-gate.ts:134src/compiler/ts/const-bind-forms.test.ts:1src/compiler/ts/const-bind-refusals.test.ts:1src/core/backends/glsl-const-bind.test.ts:1src/core/passes/const-bind-emit.test.ts:1src/core/passes/const-bind.test.ts:1src/core/passes/const-bind.ts:1src/core/passes/const-expr.ts:1src/core/passes/opt/const-fold.ts:1 - Rule 12.1
-
A diagnostic must name the offending thing and the remedy in at most two sentences: the first states the mistake, and the second, when there is one, states the remedy or the reason.
Verified by
src/compiler/ts/array-minmax-types.test.ts:1src/compiler/ts/foreign-names.test.ts:1src/compiler/ts/foreign-names.ts:1src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1src/compiler/ts/io-name-cascades.test.ts:1src/compiler/ts/static-read-wording.test.ts:2src/compiler/ts/unknown-names.test.ts:1src/compiler/ts/unknown-names.ts:1src/language-service/editor-parity.test.ts:2 - Rule 12.3
-
Severity must follow the target’s role: a program WGSL refuses must be an error; a shortfall of GLSL ES 3.00 on a module with a render entry must be a warning that leaves
wgslin place; a compute-only module’s GLSL shortfall must be no diagnostic at all.Verified by
src/compiler/ts/compile.contract.test.ts:1src/compiler/ts/reserved-names.test.ts:1src/compiler/ts/texture-multiple-samplers.test.ts:1src/language-service/compiled-output-diagnostics.test.ts:1 - Rule 12.4
-
One mistake reads as one diagnostic; a refusal must not be followed by further diagnostics about the same mistake.
Verified by
src/compiler/ts/abstract-super.test.ts:1src/compiler/ts/array-minmax-types.test.ts:1src/compiler/ts/builtin-type-diagnostic.test.ts:1src/compiler/ts/class-member-diagnostics.test.ts:1src/compiler/ts/compute-stage-reachability.test.ts:1src/compiler/ts/generic-classes.test.ts:1src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1src/compiler/ts/host-names.test.ts:1src/compiler/ts/io-attribute-arguments.test.ts:1src/compiler/ts/io-name-cascades.test.ts:1src/compiler/ts/module-vars-atomic.test.ts:1src/compiler/ts/refused-names.ts:1src/compiler/ts/stage-call.test.ts:1src/compiler/ts/super-constructor-diagnostics.test.ts:1src/compiler/ts/switch-validation.test.ts:1src/language-service/diagnostics-brand-tags.test.ts:1src/language-service/diagnostics-glsl-hlsl-names.test.ts:1src/language-service/diagnostics-module-variables.test.ts:1src/language-service/diagnostics-one-mistake.test.ts:1src/language-service/diagnostics-vector-arithmetic.test.ts:1src/language-service/diagnostics.test.ts:1src/language-service/diagnostics.ts:1src/language-service/generic-arity-diagnostics.test.ts:1src/language-service/loop-control-diagnostics.test.ts:1src/language-service/module-variable-diagnostics.test.ts:1 - Rule 12.5
-
The message text is part of the contract: a test that pins a refusal must assert the code and the text, and a change to the text is a change to the surface.
Verified by
src/compiler/ts/abstract-super.test.ts:1src/compiler/ts/class-member-diagnostics.test.ts:1src/compiler/ts/field-initializer-range.test.ts:1src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1src/compiler/ts/io-name-cascades.test.ts:1src/compiler/ts/local-call-diagnostic-names.test.ts:1src/compiler/ts/pow-remedies.test.ts:1src/compiler/ts/switch-validation.test.ts:1src/language-service/compiled-output-diagnostics.test.ts:1src/language-service/generic-arity-diagnostics.test.ts:1src/language-service/loop-control-diagnostics.test.ts:1src/language-service/module-variable-diagnostics.test.ts:1 - Rule 12.6
-
A requirement the front end can check must be checked at the front end, in the author’s words, and not left to Tint or a driver.
Verified by
src/compiler/ts/array-minmax-types.test.ts:1src/compiler/ts/clamp-bounds.test.ts:1src/compiler/ts/compute-stage-reachability.test.ts:1src/compiler/ts/const-call-domain.test.ts:1src/compiler/ts/f32-const-range.test.ts:1src/compiler/ts/honest-refusals-tuples.test.ts:1src/compiler/ts/honest-refusals.test.ts:1src/compiler/ts/index-bound.test.ts:1src/compiler/ts/io-attribute-arguments.test.ts:1src/compiler/ts/loop-shapes.test.ts:1src/compiler/ts/lower/runtime-array.ts:1src/compiler/ts/module-vars-atomic.test.ts:1src/compiler/ts/runtime-array-values.test.ts:1src/compiler/ts/struct-cycle.test.ts:1src/compiler/ts/switch-validation.test.ts:1src/compiler/ts/unknown-names.test.ts:2 - Rule 12.7
-
The language service and the compiler must name one vocabulary: the ambient library’s declarations are derived from the compiler’s own tables and never retyped, a builtin’s overloads from Tint’s
core.defthrough the TypeShade overlay, and a program the compiler accepts must draw no error in the editor or intshc check.Verified by
src/compiler/ts/abstract-super.test.ts:1src/compiler/ts/array-minmax-types.test.ts:1src/compiler/ts/builtin-type-diagnostic.test.ts:1src/compiler/ts/class-member-diagnostics.test.ts:1src/compiler/ts/compute-stage-reachability.test.ts:1src/compiler/ts/definite-assignment.test.ts:1src/compiler/ts/diagnostic-removed.test.ts:1src/compiler/ts/doc-snippets.test.ts:1src/compiler/ts/field-initializer-range.test.ts:1src/compiler/ts/host-failed-input.test.ts:3src/compiler/ts/host-kernel-gl-length.test.ts:1src/compiler/ts/index-bound.test.ts:1src/compiler/ts/io-attribute-arguments.test.ts:1src/compiler/ts/io-name-cascades.test.ts:1src/compiler/ts/local-call-diagnostic-names.test.ts:1src/compiler/ts/local-places.test.ts:1src/compiler/ts/module-vars-atomic.test.ts:1src/compiler/ts/number-types.test.ts:1src/compiler/ts/numerics-removed.test.ts:1src/compiler/ts/object-reference-removed-forms.test.ts:1src/compiler/ts/object-reference-reviews.test.ts:1src/compiler/ts/object-reference-unread.test.ts:1src/compiler/ts/object-reference.test.ts:1src/compiler/ts/optional-values-loose-null.test.ts:1src/compiler/ts/optional-values.test.ts:1src/compiler/ts/reference-parameters-editor.test.ts:1src/compiler/ts/reference-parameters.test.ts:1src/compiler/ts/reference-reads.test.ts:1src/compiler/ts/second-name-copies.test.ts:1src/compiler/ts/second-name.test.ts:1src/compiler/ts/super-constructor-diagnostics.test.ts:2src/compiler/ts/switch-validation.test.ts:1src/compiler/ts/texture-multiple-samplers.test.ts:1src/compiler/ts/type-spelling.test.ts:1src/core/spec-conformance/coredef-overloads.test.ts:1src/core/spec-conformance/surface-names.test.ts:52src/language-service/abstract-const-hover.test.ts:1src/language-service/ambient-matrix-index.test.ts:1src/language-service/ambient-parity-math-object.test.ts:1src/language-service/ambient-parity.test.ts:1src/language-service/ambient-storage-access.test.ts:1src/language-service/ambient-texture-lowering.test.ts:1src/language-service/ambient-texture-refusals.test.ts:1src/language-service/ambient-vector-math.test.ts:1src/language-service/ambient.test.ts:1src/language-service/compiled-output-diagnostics.test.ts:1src/language-service/diagnostics-brand-tags.test.ts:2src/language-service/diagnostics-glsl-hlsl-names.test.ts:2src/language-service/diagnostics-module-variables.test.ts:2src/language-service/diagnostics-one-mistake.test.ts:2src/language-service/diagnostics-vector-arithmetic.test.ts:2src/language-service/diagnostics.test.ts:2src/language-service/diagnostics.ts:1src/language-service/diagnostics/same-mistake.ts:1src/language-service/editor-parity.test.ts:1src/language-service/expression-parity.test.ts:1src/language-service/generic-arity-diagnostics.test.ts:1src/language-service/hover-array-length.test.ts:1src/language-service/hover-docs-domains.test.ts:1src/language-service/hover.test.ts:1src/language-service/imported-symbol-hover-declarations.test.ts:1src/language-service/imported-symbol-hover-names.test.ts:1src/language-service/imported-symbol-hover-other-documents.test.ts:1src/language-service/imported-symbol-hover-reviews.test.ts:1src/language-service/imported-symbol-hover-structs.test.ts:1src/language-service/imported-symbol-hover.test.ts:1src/language-service/loop-control-diagnostics.test.ts:1src/language-service/module-variable-diagnostics.test.ts:1src/language-service/projection-returns-and-arrays.test.ts:1src/language-service/projection.test.ts:1src/language-service/projection.ts:1src/language-service/projection/vector-type-arguments.test.ts:1 - Rule 13.3
-
A design that a target might refuse must be measured on Tint, on a WebGL2 driver, or on a device before it is kept, and the measured text must be recorded in the plan and in the code comment.
Verified by
scripts/compile-gate.ts:85scripts/kernel-length-cases.ts:2scripts/sampler-pair-cases.ts:3src/compiler/ts/host-kernel-gl-length.test.ts:1 - Rule 13.4
-
Every change must pass the mechanical gates:
bun run build;bun run test, withsurface-names.test.ts,intrinsic-coverage.test.ts,capability-reachability.test.ts,determinism.test.ts,api-surface.test.ts,emit-reflection-conformance.test.ts, and the emit goldens among them;bun run gate:compile; the docs snippet testsrc/compiler/ts/doc-snippets.test.ts, which compiles every snippet of the surface document.Verified by
.github/workflows/ci.yml:3 - Rule 13.6
-
A new author-facing name must be added only by its source: a WGSL name by citing the specification section that declares it, and an ECMAScript name by citing the section of ECMA-262, or the declaration of TypeScript’s standard library, that defines it.
Verified by
src/core/spec-conformance/surface-names.test.ts:52 - Rule 13.7
-
The extension table must shrink when WGSL grows a builtin or a type a row was standing in for, or when a spelling is withdrawn; the row must be deleted, the surface document must say so, and the CHANGELOG must record it.
Verified by
src/core/spec-conformance/surface-names.test.ts:52 - Rule 13.8
-
Every change to the surface must carry a CHANGELOG entry under
[Unreleased]in the house style (a bold lead naming the feature and the § or roadmap item, then what an author can now write, what each target emits, what is refused and how, and what was measured) and a surface§whose snippets compile.Verified by
src/compiler/ts/doc-snippets.test.ts:1 - Rule 13.9
-
An official release must follow Semantic Versioning 2.0.0, and before
1.0.0the minor is the breaking position: a breaking change must ship only in a new0.N.0, and a0.N.Pmust only fix and add.Verified by
src/changelog.test.ts:1 - Rule 13.10
-
A change that keeps a program compiling and makes it compute something other than what an official release (Rule 13.9) computed for it must ship in two steps, and the second must come no earlier than the next breaking release after the first step’s official release was published (the next minor before
1.0.0, the next major after it).Verified by
src/compiler/ts/deprecation-window.test.ts:1
Implementation only, no test yet Code only
2 rules. The implementation names each one in an Implements: tag, and no test checks it yet: each is a gap for a test to close. A guide page that names one of these rules says so beside the name.
- Rule 1.2
-
GLSL ES 3.00 is a target of the compiler; it must not be the definition of a construct.
Implemented in
src/core/passes/required-caps.ts:10 - Rule 11.5
-
Where WGSL fixes a result and GLSL ES 3.00 does not, the oracle must follow WGSL; where a GLSL spelling answers differently on an input WGSL settles, the determinism report must list the operation as
target.Implemented in
src/core/passes/determinism.ts:1
Not yet enforced Not enforced
No rule is held this way at the pin.
Held by review Review
7 rules. Each one says review holds it, and no file checks it.
- Rule 1.5
-
The representation of a form ECMAScript defines is the compiler’s: a value on the stack, a binding, or memory the compiler owns, and it may change between versions while every observable answer stays the one Rule 1.1 defines.
- Rule 1.6
-
TypeShade code is compute code: it computes results from data, may run in parallel, and gives the same answer on every target.
- Rule 3.7
-
A new surface section must take the next free
§number indocs/use-typeshade-surface.mdas the current tree makes it, and a new diagnostic must take the next freeTS80xxcode insrc/compiler/ts/codes.ts. - Rule 12.2
-
A code must be
TS8followed by a sequential number in the order codes were added, or a number from a block handed to a parallel branch (Rule 3.7), whose unused numbers stay a gap. - Rule 13.1
-
An issue or pull request that changes what an author can write must cite the rule of this document it rests on.
- Rule 13.2
-
A change the rules do not cover must change the rules first: the rule is written or amended in this document, in the same pull request, before the surface moves.
- Rule 13.5
-
A hot-spot file must be edited only after reading what the branch already did to it, and a claim of a
§number, aTS80xxcode, or anINTRINSICSrow must be made in the issue before the branch is opened.