TS8038
이 페이지에서

TS8038

프런트엔드 코드 F64_ENTRY_IO

에뮬레이트한 double(f64나 vec64)이 진입점의 IO 경계에 있습니다. @location 매개변수, IO 구조체의 @location 필드, 진입점의 반환값이 그렇습니다. double은 낮춘 뒤 f32 워드 두 개이고, varying은 워드를 따로 보간합니다. f32(x)로 좁히거나, 필요한 스테이지에서 double을 읽으세요. uniform과 스토리지 바인딩은 f64를 담을 수 있습니다.

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

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

예제

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

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

TS8038 error, 4행: Parameter "uv" carries vec2f64: an emulated double is a pair of f32 words, and a @location varying interpolates each word on its own, which is not the interpolation of the double. Narrow it with f32(x), or compute the double in the stage that needs it — a uniform or storage binding carries an f64 and every stage can read one.

고치는 법

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

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

이 코드가 적용하는 규칙

규칙 2.3 테스트
A value sometimes has to cross between a representation the compiler chose and one the target has: an f64 and the two f32 halves that carry it across an interface of f32.
규칙 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.

함께 보기

SD0044
f64 in an interpolated @location IO field

소스

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

이 페이지 편집 문제 보고