Fp64Flavor
타입, f64 에뮬레이션 분류
Which arithmetic primitives back the emulated-double (df64) helper functions that fp64Lower injects.
import type { Fp64Flavor } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
type Fp64Flavor = 'float' | 'integer';설명
Which arithmetic primitives back the emulated-double (df64) helper functions that
fp64Lower injects. Both flavours compute the same values; they differ in what a
target’s shader compiler is able to do to them.
'float': the default. Error-free transforms written in float arithmetic, protected from constant folding by a runtime guard binding,_fp64, that the host fills with1.0.'integer': thetwoSum,twoProd, division and square-root leaves are written in integer bit arithmetic; the compositions above them are shared with'float'. A fast-math pass cannot reassociate integer operations, so the hi/lo split survives on compilers that fold the float form (Apple Metal, and the ANGLE Direct3D 11 path through FXC). No guard binding is injected, because the integer bodies never read it.
Choose 'integer' when a target’s compiler folds the float primitives. The symptom is
emulated-double results degrading to f32 precision on one platform while every other target
is fine. recommendFp64Flavor picks a flavour from a device’s adapter or renderer
information.
함께 보기
소스
src/core/passes/fp64-lower.ts, 113행, 커밋 c66579bf 기준