TS8028
프런트엔드 코드 ATTRIBUTE_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.
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
발생 조건
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. A WGSL attribute the surface writes another way (@workgroup_size, @size, @group, @binding, @id, @must_use) is named as WGSL's, with where its intent goes; @size anywhere but a field and @align anywhere but a field or a class are named as a struct field's, and @std140 anywhere but a class as not applied; and any decorator nothing reads is refused (Rule 6.7): on a declaration that takes none (a binding, an override, a const or let at any depth, an enum, an interface, a type alias, a namespace, a local function or class, a class expression or a static field), on a constructor, an overload signature, an abstract member, a mixin or an index signature, one that is not a name (@N.k), and one of the list where the place does not apply it (@location on a class, @builtin on a parameter of a function that is not an entry, which Tint refuses).
예제
"use typeshade"
@fragmntexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, 0., 1.)}빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8028 error, 3행: Unknown attribute "@fragmnt". Did you mean "@fragment"?
TS8028 error, 4행: "@location" does not apply to a parameter of a function that is not an entry: it marks an entry's input or output. Remove it.
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { return vec4(uv, 0., 1.)}이 코드가 적용하는 규칙
- 규칙 6.7 테스트
- The attribute names the compiler reads are
@vertex,@fragment,@compute,@builtin,@location,@interpolate,@invariant,@blend_src, and@diagnostic(the last four since #168, surface §53 and §54); every other WGSL attribute is either inferred by the compiler or carried as an argument (@compute([64, 1, 1])carries@workgroup_size), and a decorator outside that list must be refused. - 규칙 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, whichreflect().vertexand the manifest both report.
함께 보기
소스
커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.