Resident
이 페이지에서

Resident

인터페이스, 런타임 분류

A value that stays on the device across calls, made by resident: one buffer of both layers.

import type { Resident } from 'typeshade'
import type { Resident } from 'typeshade/runtime'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

interface Resident<T = ResidentValue> {
read(): Promise<T>;
write(value: T): void;
destroy(): void;
readonly [residentBrand]: T;
}

설명

Pass it where a kernel function takes an array, as an entry’s storage array with no size (surface §67), or as any buffer binding of a program runtime’s draw or dispatch (surface §69): the first use on WebGPU uploads it, the uses after bind it as it is, and nothing is read back until Resident.read. A call whose written arrays are all resident, and that returns nothing, only queues.

인스턴스 메서드

read (): Promise<T>

Wait for every kernel call made before this one, and return a new array holding what the handle holds.

write (value: T): void

Replace what the handle holds with value, after every call made before this one; with none waiting, at once. The next use uploads it.

destroy (): void

Release the device buffer, after every call made before this one. A use after it throws.

함께 보기

소스

src/core/resident.ts, 46행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고