Resource
On this page

Resource

Interface in Layout

A single-binding handle: a BindingDecl for module plus a typed access node.

import type { Resource } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

interface Resource<T extends ShaderType = ShaderType> {
readonly binding: BindingDecl;
readonly node: Node<KeyOf<T>>;
}

Description

A texture, a sampler or a host-owned uniform has no fields to proxy, so this is all the handle carries. Both resource (textures, samplers, any module-owned non-struct binding) and hostUniform (a scalar, vector or matrix uniform the host supplies) return it, which is why it is generic over the resource type: node keeps the specific T (Node<'texture_2d<f32>'>, Node<'sampler'>, Node<'vec4<f32>'>), so type-specific operations (textureSample, .mul) stay type-checked at the call site.

Instance properties

bindingread only BindingDecl

The binding declaration, for module({ bindings }).

noderead only Node<KeyOf<T>>

The typed access node, keyed by the declared type T.

See also

Source

src/core/sot.ts, line 809, at commit 26de7be8

Edit this page Report a problem