WebGpuTexture class final

A texture this device owns, and the views it has been asked for.

The views are cached on the texture rather than made at each use, and that is not a micro-optimisation: createView allocates an object the browser tracks, a pass opens with one per attachment and a draw binds one per sampler, so a frame that made them fresh would hand the collector a few thousand short-lived interop objects. They are also compared by identity in the bind group cache, and a fresh view every draw would make that cache answer no every time.

Constructors

WebGpuTexture({required GPUTexture texture, required WebGpuTextureDimension dimension, required bool sampleable})

Properties

dimension WebGpuTextureDimension
How a shader reads this: as a flat image or as six faces by direction.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleable bool
Whether this may be bound to a sampler at all.
final
sampledView GPUTextureView
The view a sampler reads: the whole texture, in its own dimension.
no setter
texture GPUTexture
final

Methods

attachmentView({int face = 0, int level = 0}) GPUTextureView
The view a pass attaches: one face of one level, always as a flat image.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited