TS8029
이 페이지에서

TS8029

프런트엔드 코드 STRUCT_FIELD_MISSING_ATTR

compute 진입점의 사용자 정의 입력입니다. builtin<…>가 없는 매개변수나 그 구조체의 필드가 그렇습니다. WGSL의 compute 진입점에는 사용자 정의 입력이 없으므로 프런트엔드가 거부합니다. 정점이나 프래그먼트 진입점에서는 속성이 없는 값이 사용자 정의 값이고, 컴파일러가 location을 줍니다(규칙 6.6).

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

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

예제

example.shade.ts
"use typeshade"
declare const data: storage<array<f32>, "read_write">
@compute([64])
export function double(n: u32): void {
data[n] = data[n] * 2.
}

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

TS8029 error, 6행: "n" is a user-defined input of a compute entry, which has no user IO: a compute shader reads its work from resources and the builtin<…> invocation ids.

고치는 법

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

example.shade.ts
"use typeshade"
declare const data: storage<array<f32>, "read_write">
@compute([64])
export function double(id: builtin<"global_invocation_id">): void {
data[id.x] = data[id.x] * 2.
}

이 코드가 적용하는 규칙

규칙 6.6 테스트
An entry point’s inputs and outputs are explicit parameters and return values.
규칙 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.

함께 보기

소스

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

이 페이지 편집 문제 보고