Wrapper to view various representations of texture data in other ways. E.g., can:

  • Provide a mapped buffer, containing copied texture data, and read color values.
  • Provide a function that generates color values by coordinate, and convert to ULPs-from-zero.

MAINTENANCE_TODO: Would need some refactoring to support block formats, which could be partially supported if useful.

Hierarchy

  • TexelView

Properties

bytes: PerPixelAtLevel<Uint8Array>

Generates the bytes for the texel at the given coordinates.

Generates the color for the texel at the given coordinates.

format: "bgra8unorm" | "rgba8unorm" | "rgba16float" | "r8unorm" | "r8snorm" | "r8uint" | "r8sint" | "r16uint" | "r16sint" | "r16float" | "rg8unorm" | "rg8snorm" | "rg8uint" | "rg8sint" | "r32uint" | "r32sint" | "r32float" | "rg16uint" | "rg16sint" | "rg16float" | "rgba8unorm-srgb" | "rgba8snorm" | "rgba8uint" | "rgba8sint" | "bgra8unorm-srgb" | "rgb9e5ufloat" | "rgb10a2uint" | "rgb10a2unorm" | "rg11b10ufloat" | "rg32uint" | "rg32sint" | "rg32float" | "rgba16uint" | "rgba16sint" | "rgba32uint" | "rgba32sint" | "rgba32float" | "stencil8" | "depth16unorm" | "depth32float"

The GPUTextureFormat of the TexelView.

ulpFromZero: PerPixelAtLevel<PerTexelComponent<number>>

Generates the ULPs-from-zero for the texel at the given coordinates.

Methods

  • Writes the contents of a TexelView as "linear image data", i.e. the writeTexture format.

    Parameters

    • subrectData: Uint8Array | Uint8ClampedArray
    • __namedParameters: {
          bytesPerRow: number;
          rowsPerImage: number;
          sampleCount?: number;
          subrectOrigin: GPUOrigin3D;
          subrectSize: GPUExtent3D;
      }
      • bytesPerRow: number
      • rowsPerImage: number
      • Optional sampleCount?: number
      • subrectOrigin: GPUOrigin3D
      • subrectSize: GPUExtent3D

    Returns void

  • Produces a TexelView from a generator of bytes for individual texel blocks.

    Parameters

    • format: "bgra8unorm" | "rgba8unorm" | "rgba16float" | "r8unorm" | "r8snorm" | "r8uint" | "r8sint" | "r16uint" | "r16sint" | "r16float" | "rg8unorm" | "rg8snorm" | "rg8uint" | "rg8sint" | "r32uint" | "r32sint" | "r32float" | "rg16uint" | "rg16sint" | "rg16float" | "rgba8unorm-srgb" | "rgba8snorm" | "rgba8uint" | "rgba8sint" | "bgra8unorm-srgb" | "rgb9e5ufloat" | "rgb10a2uint" | "rgb10a2unorm" | "rg11b10ufloat" | "rg32uint" | "rg32sint" | "rg32float" | "rgba16uint" | "rgba16sint" | "rgba32uint" | "rgba32sint" | "rgba32float" | "stencil8" | "depth16unorm" | "depth32float"
    • generator: PerPixelAtLevel<Uint8Array>

    Returns TexelView

  • Produces a TexelView from a generator of numeric "color" values for each texel.

    Parameters

    • format: "bgra8unorm" | "rgba8unorm" | "rgba16float" | "r8unorm" | "r8snorm" | "r8uint" | "r8sint" | "r16uint" | "r16sint" | "r16float" | "rg8unorm" | "rg8snorm" | "rg8uint" | "rg8sint" | "r32uint" | "r32sint" | "r32float" | "rg16uint" | "rg16sint" | "rg16float" | "rgba8unorm-srgb" | "rgba8snorm" | "rgba8uint" | "rgba8sint" | "bgra8unorm-srgb" | "rgb9e5ufloat" | "rgb10a2uint" | "rgb10a2unorm" | "rg11b10ufloat" | "rg32uint" | "rg32sint" | "rg32float" | "rgba16uint" | "rgba16sint" | "rgba32uint" | "rgba32sint" | "rgba32float" | "stencil8" | "depth16unorm" | "depth32float"
    • generator: PerPixelAtLevel<PerTexelComponent<number>>
    • __namedParameters: {
          clampToFormatRange?: boolean;
      } = {}
      • Optional clampToFormatRange?: boolean

    Returns TexelView

  • Produces a TexelView from "linear image data", i.e. the writeTexture format. Takes a reference to the input subrectData, so any changes to it will be visible in the TexelView.

    Parameters

    • format: "bgra8unorm" | "rgba8unorm" | "rgba16float" | "r8unorm" | "r8snorm" | "r8uint" | "r8sint" | "r16uint" | "r16sint" | "r16float" | "rg8unorm" | "rg8snorm" | "rg8uint" | "rg8sint" | "r32uint" | "r32sint" | "r32float" | "rg16uint" | "rg16sint" | "rg16float" | "rgba8unorm-srgb" | "rgba8snorm" | "rgba8uint" | "rgba8sint" | "bgra8unorm-srgb" | "rgb9e5ufloat" | "rgb10a2uint" | "rgb10a2unorm" | "rg11b10ufloat" | "rg32uint" | "rg32sint" | "rg32float" | "rgba16uint" | "rgba16sint" | "rgba32uint" | "rgba32sint" | "rgba32float" | "stencil8" | "depth16unorm" | "depth32float"
    • subrectData: Uint8Array | Uint8ClampedArray
    • __namedParameters: {
          bytesPerRow: number;
          rowsPerImage: number;
          sampleCount?: number;
          subrectOrigin: GPUOrigin3D;
          subrectSize: GPUExtent3D;
      }
      • bytesPerRow: number
      • rowsPerImage: number
      • Optional sampleCount?: number
      • subrectOrigin: GPUOrigin3D
      • subrectSize: GPUExtent3D

    Returns TexelView

Generated using TypeDoc