규칙 8.3
이 페이지에서

규칙 8.3

8장, 함수와 진입점 테스트

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. The derivatives, implicit-LOD sampling, and discard may be used in the fragment stage only. Barriers and workgroup memory may be used in the compute stage only. The atomic builtins may be used in the compute and fragment stages, and must not be used in the vertex stage.

규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

근거

the stage rule is Tint’s, and the call graph is how a helper inherits it.

출처

검증 방식

테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.

컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.

  • the reachability check in src/compiler/ts/lower/function.ts (TS8099 names the builtin, the helper, and the entry) for the fragment-only builtins;
  • TS8033 for workgroup memory, and TS8034 for a barrier outside a compute entry (a barrier in a branch is Rule 8.5’s TS8052);
  • TS8099 for an atomic builtin in a @vertex entry or in a helper it reaches ("atomicAdd" is only valid in a fragment or compute shader; "vs" is a vertex entry. WGSL allows an atomic built-in in a fragment or compute stage only.), pinned by src/compiler/ts/atomics.test.ts (refuses atomicAdd in a vertex entry).

커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.

설명하는 절

커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.

적용하는 오류 코드

규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.

TS8033 MODULE_VAR
A module variable (let x: workgroup<T>, let y: T = init, §24) declared or used where its address space forbids: a const with an address-space wrapper, a workgroup variable with an initializer, a type the space cannot hold (a texture, a runtime-sized array, an atomic in a per-invocation variable), an initializer that is not a constant, or a workgroup variable reached from a vertex or fragment entry (roadmap 0.2 item 5).
TS8034 BARRIER_PLACEMENT
workgroupBarrier() / storageBarrier() somewhere a barrier cannot stand (§25): in a vertex or fragment entry, which has no workgroup; or as a value, since a barrier is a statement (roadmap 0.2 item 5).
TS8052 UNIFORMITY
A call that needs uniform control flow — textureSample and the other implicit-LOD forms, the derivatives, a barrier, or workgroupUniformLoad — reached under a condition that is not uniform across the invocations that run together (an if, a switch, a loop's condition, the left side of && or ||, the condition of a ?: WGSL writes as an if), or after a return, break or continue taken under one (§54).
TS8099 UNSUPPORTED
UNSUPPORTED (TS8099) is the one deliberate exception to "sequential": it is the catch-all for a diagnostic whose site does not yet deserve its own code, so it stays parked past the sequential range instead of at its head.

함께 보기

소스

커밋 c66579bf의 규칙 원문:

이 페이지 편집 문제 보고