UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

55 lines (54 loc) 2.73 kB
import type { WgslComparisonSamplerProps, WgslSamplerProps } from '../../data/sampler.ts'; import type { TgpuNamable } from '../../shared/meta.ts'; import type { Infer, InferGPU } from '../../shared/repr.ts'; import type { TgpuDeviceOwningSoul } from '../../shared/soul.ts'; import { $gpuValueOf, $internal, $repr, $resolve, $soul } from '../../shared/symbols.ts'; import type { LayoutMembership } from '../../tgpuBindGroupLayout.ts'; import { type WgslComparisonSampler, type WgslSampler } from '../../data/sampler.ts'; import type { SelfResolvable } from '../../types.ts'; import type { ExperimentalTgpuRoot } from '../root/rootTypes.ts'; interface SamplerInternals { readonly root?: ExperimentalTgpuRoot; readonly materialize?: (() => GPUSampler) | undefined; } export interface TgpuSamplerSoul extends TgpuDeviceOwningSoul<'sampler' | 'sampler-comparison', GPUSampler> { readonly props: WgslSamplerProps | WgslComparisonSamplerProps; } export interface TgpuSampler { readonly [$internal]: SamplerInternals; readonly resourceType: 'sampler'; readonly schema: WgslSampler; readonly [$gpuValueOf]: InferGPU<WgslSampler>; $: InferGPU<WgslSampler>; toString(): string; } export interface TgpuComparisonSampler { readonly [$internal]: SamplerInternals; readonly resourceType: 'sampler-comparison'; readonly schema: WgslComparisonSampler; readonly [$gpuValueOf]: InferGPU<WgslComparisonSampler>; $: InferGPU<WgslComparisonSampler>; toString(): string; } export interface TgpuFixedSampler extends TgpuSampler, TgpuNamable { readonly [$soul]: TgpuSamplerSoul; } export interface TgpuFixedComparisonSampler extends TgpuComparisonSampler, TgpuNamable { readonly [$soul]: TgpuSamplerSoul; } export declare function INTERNAL_createSampler(props: WgslSamplerProps, root: ExperimentalTgpuRoot): TgpuFixedSampler; export declare function INTERNAL_createComparisonSampler(props: WgslComparisonSamplerProps, root: ExperimentalTgpuRoot): TgpuFixedComparisonSampler; export declare function isSampler(resource: unknown): resource is TgpuSampler; export declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler; export declare class TgpuLaidOutSamplerImpl<T extends WgslSampler | WgslComparisonSampler> implements SelfResolvable { #private; readonly [$repr]: Infer<T>; readonly [$internal]: SamplerInternals; readonly resourceType: T extends WgslComparisonSampler ? 'sampler-comparison' : 'sampler'; readonly schema: T; [$resolve]: SelfResolvable[typeof $resolve]; $: InferGPU<WgslSampler>; readonly [$gpuValueOf]: InferGPU<WgslSampler>; constructor(schema: T, membership: LayoutMembership); } export {};