TS8028
이 페이지에서

TS8028

프런트엔드 코드 ATTRIBUTE_NAME

이 표면이 읽지 않는 데코레이터나 진입점 형태입니다. 속성 어휘(@vertex, @fragment, @compute, @builtin, @location) 밖의 식별자(@vertx 같은 오타), 표면이 다른 방식으로 쓰거나 빌려 오지 않는 WGSL 속성(직접 쓴 @diagnostic(…) 같은 것), vertex(f)처럼 호출로 쓴 스테이지, export default처럼 규칙 8.1이 거부하는 형태로 쓴 진입점, 데코레이터를 받지 않는 선언이나 자리에 붙은 데코레이터가 그렇습니다(규칙 6.7). 이 코드가 없으면 데코레이터를 붙인 함수나 필드가 아무 말 없이 진입점이나 IO 필드가 아니게 됩니다.

레지스트리에는 이 상수에 대한 문서 주석이 없습니다. 그래서 위 설명은 컴파일러가 이 코드와 함께 내는 메시지를 보고 이 사이트가 쓴 것입니다.

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

예제

example.shade.ts
"use typeshade"
export const main = fragment(function main(uv: location<0, vec2>): vec4 {
return vec4(uv, 0., 1.)
});

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

TS8028 error, 3행: a stage is an attribute on the function declaration: write "@fragment export function main(…)", or run "tshc migrate" (change 0130)

고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

example.shade.ts
"use typeshade"
@fragment
export function main(uv: location<0, vec2>): vec4 {
return vec4(uv, 0., 1.)
}

이 코드가 적용하는 규칙

규칙 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).
규칙 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 @name or @name(…) on the declaration it marks.
규칙 6.6 테스트
An entry point’s inputs and outputs are explicit parameters and return values.
규칙 6.7 테스트
The attribute names the compiler reads are vertex, fragment, compute, workgroup_size, builtin, location, interpolate, invariant and blend_src (the last three since #168, surface §53).
규칙 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 @location inputs tightly packed in the order written and numbered in that order where no location<n, T> states the number (Rule 6.6), which reflect().vertex and the manifest both report.
규칙 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?]) ….
규칙 8.5 테스트
A collective operation (a derivative, an implicit-LOD texture sample, a barrier) must be in uniform control flow.
규칙 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 the for and for…of statements at the top level of its body, and no other loop is ever a candidate.
규칙 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).

함께 보기

소스

커밋 af54ddad5에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

이 페이지 편집 문제 보고