규칙 6.8
6장, 선언과 리소스 테스트
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 @location inputs tightly packed in the order written, which reflect().vertex and the manifest both report.
규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
근거
a buffer the host fills from reflect() and the shader reads by its own offsets is a dynamic error nothing detects.
출처
Memory Layout (“it is a dynamic error if buffer producers and consumers do not agree on the memory layout”).
검증 방식
테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.
컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.
examples/emit-reflection-conformance.test.ts for bindings, locations, and entry points, src/core/manifest.test.ts, which holds every example’s manifest to reflect()’s slots, struct offsets and vertex layout, and the one layout engine in src/core/reflect.ts that the GLSL writer also uses, whose layout checks are the two-row matrix of Rule 4.8 and the uniform-address-space rules of surface §51 (#156): an array in a uniform is padded to a 16-byte stride and reflect() agrees; a bool, alone or in a vector, in a uniform or storage binding (a struct field, a runtime array’s element or the binding’s whole type, "U.b" is a vec3b; a uniform binding holds no bool, alone or in a vector (WGSL's host-shareable rule). Use vec3u.), a runtime-sized array in a uniform, and one that is not a struct’s last field are TS8051 LAYOUT; a field @align is TS8010 (@align on a field is not applied.) and a field @size is TS8028; pinned by src/compiler/ts/uniform-layout.test.ts.
커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.
적용하는 오류 코드
규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.
-
TS8010STRUCT_FIELD - An invalid struct field or declaration shape.
-
TS8028ATTRIBUTE_NAME - A decorator identifier outside the attribute vocabulary
"use typeshade"defines (@vertex,@fragment,@compute,@builtin,@location), e.g. a misspelled@vertx: without this, the decorated function or field just silently stops being an entry point or an I/O field. -
TS8051LAYOUT - A buffer binding's store type breaks one of WGSL's host-shareable rules (§51), which a struct hides from the type map and the backend only meets as emitted text: a
bool, alone or in a vector, in auniformorstoragebinding, as a field, a runtime array's element or the whole type (type 'bool' cannot be used in address space 'uniform' as it is non-host-shareable, and the same ofvec3<bool>), a runtime-sizedarray<T>that is not its struct's last member, or a runtime-sized array in a uniform, whose type must be constructible.
함께 보기
소스
커밋 c66579bf의 규칙 원문:
docs/language-design.md:456(설계 문서)reqs/rules/RULE-0608.md(추적 항목)