Hierarchy

Constructors

Accessors

  • get adapter(): GPUAdapter
  • GPUAdapter that the device was created from.

    Returns GPUAdapter

  • get device(): GPUDevice
  • GPUDevice for the test to use.

    Returns GPUDevice

  • get isCompatibility(): boolean
  • Returns boolean

  • get mismatchedDevice(): GPUDevice
  • GPUDevice for tests requiring a second device different from the default one, e.g. for creating objects for by device_mismatch validation tests.

    Returns GPUDevice

  • get params(): unknown
  • Returns the (case+subcase) parameters for this test function invocation.

    Returns unknown

  • get queue(): GPUQueue
  • GPUQueue for the test to use. (Same as t.device.queue.)

    Returns GPUQueue

  • get sharedState(): S
  • Gets the test fixture's shared state. This object is shared between subcases within the same testcase.

    Returns S

Methods

  • Parameters

    • format: GPUTextureFormat

    Returns boolean

  • Emulate a texture to buffer copy by using a compute shader to load texture values of a subregion of a 2d texture and write to a storage buffer. For sample count == 1, the buffer contains extent[0] * extent[1] of the sample. For sample count > 1, the buffer contains extent[0] * extent[1] * (N = sampleCount) values sorted in the order of their sample index [0, sampleCount - 1]

    This can be useful when the texture to buffer copy is not available to the texture format e.g. (depth24plus), or when the texture is multisampled.

    MAINTENANCE_TODO: extend texture dimension to 1d and 3d.

    Parameters

    • type: ScalarType
    • componentCount: number
    • textureView: GPUTextureView
    • sampleCount: number = 1
    • extent_: GPUExtent3D = ...
    • origin_: GPUOrigin3D = ...

    Returns GPUBuffer

    storage buffer containing the copied value from the texture.

  • Copies an texture's mipLevel to a buffer The size of the buffer is specified by byteLength

    Parameters

    • __namedParameters: {
          mipLevel: undefined | number;
          texture: GPUTexture;
      }
      • mipLevel: undefined | number
      • texture: GPUTexture
    • resultDataLayout: {
          byteLength: number;
          bytesPerBlock: number;
          bytesPerRow: number;
          mipSize: [number, number, number];
          rowsPerImage: number;
      }
      • byteLength: number
      • bytesPerBlock: number
      • bytesPerRow: number
      • mipSize: [number, number, number]
      • rowsPerImage: number

    Returns GPUBuffer

  • Copies an entire texture's mipLevel to a buffer

    Parameters

    • texture: GPUTexture
    • mipLevel: number

    Returns GPUBuffer

  • Create a GPUBuffer and track it for cleanup at the end of the test.

    Parameters

    • descriptor: GPUBufferDescriptor

    Returns GPUBuffer

  • Returns a GPUCommandEncoder, GPUComputePassEncoder, GPURenderPassEncoder, or GPURenderBundleEncoder, and a finish method returning a GPUCommandBuffer. Allows testing methods which have the same signature across multiple encoder interfaces.

    Type Parameters

    • T extends "render pass" | "render bundle" | "compute pass" | "non-pass"

    Parameters

    • encoderType: T
    • __namedParameters: {
          attachmentInfo?: GPURenderBundleEncoderDescriptor;
          occlusionQuerySet?: GPUQuerySet;
      } = {}
      • Optional attachmentInfo?: GPURenderBundleEncoderDescriptor
      • Optional occlusionQuerySet?: GPUQuerySet

    Returns CommandBufferMaker<T>

    Example

    g.test('popDebugGroup')
    .params(u => u.combine('encoderType', kEncoderTypes))
    .fn(t => {
    const { encoder, finish } = t.createEncoder(t.params.encoderType);
    encoder.popDebugGroup();
    });

    g.test('writeTimestamp')
    .params(u => u.combine('encoderType', ['non-pass', 'compute pass', 'render pass'] as const)
    .fn(t => {
    const { encoder, finish } = t.createEncoder(t.params.encoderType);
    // Encoder type is inferred, so `writeTimestamp` can be used even though it doesn't exist
    // on GPURenderBundleEncoder.
    encoder.writeTimestamp(args);
    });
  • Create a GPUQuerySet and track it for cleanup at the end of the test.

    Parameters

    • descriptor: GPUQuerySetDescriptor

    Returns GPUQuerySet

  • Creates a 1 mip level texture with the contents of a TexelView and tracks it for destruction for the test case.

    Parameters

    • texelView: TexelView
    • desc: Omit<GPUTextureDescriptor, "format">

    Returns GPUTexture

  • Creates a mipmapped texture where each mipmap level's (i) content is from texelViews[i] and tracks it for destruction for the test case.

    Parameters

    • texelViews: TexelView[]
    • desc: Omit<GPUTextureDescriptor, "format">

    Returns GPUTexture

  • Create a GPUTexture and track it for cleanup at the end of the test.

    Parameters

    • descriptor: GPUTextureDescriptor

    Returns GPUTexture

  • Parameters

    • sourcePixels: Uint8ClampedArray
    • width: number
    • height: number
    • bytesPerPixel: number

    Returns Uint8ClampedArray

  • Parameters

    • imageCopyExternalImage: GPUCopyExternalImageSourceInfo
    • dstTextureCopyView: GPUCopyExternalImageDestInfo
    • expTexelView: TexelView
    • copySize: Required<GPUExtent3DDict>
    • texelCompareOptions: TexelCompareOptions

    Returns void

  • Parameters

    • error: Promise<undefined | Error | (undefined | Error)[]>
    • __namedParameters: {
          mode?: "fail" | "warn";
      } = {}
      • Optional mode?: "fail" | "warn"

    Returns void

  • Expect that a condition is true.

    Parameters

    • cond: boolean
    • Optional msg: string

    Returns boolean

  • Expects that the device should be lost for a particular reason at the teardown of the test.

    Parameters

    • reason: GPUDeviceLostReason

    Returns void

  • Expect a buffer to consist exclusively of rows of some repeated expected value. The size of expectedValue must be 1, 2, or any multiple of 4 bytes. Rows in the buffer are expected to be zero-padded out to bytesPerRow. minBytesPerRow is the number of bytes per row that contain actual (non-padding) data and must be an exact multiple of the byte-length of expectedValue.

    Parameters

    • buffer: GPUBuffer
    • __namedParameters: {
          bytesPerRow: number;
          expectedValue: ArrayBuffer;
          minBytesPerRow: number;
          numRows: number;
      }
      • bytesPerRow: number
      • expectedValue: ArrayBuffer
      • minBytesPerRow: number
      • numRows: number

    Returns void

  • Expect a GPUBuffer's contents to equal the values in the provided TypedArray.

    Parameters

    • src: GPUBuffer
    • expected: Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array
    • srcByteOffset: number = 0
    • __namedParameters: {
          method?: "map" | "copy";
          mode?: "fail" | "warn";
      } = {}
      • Optional method?: "map" | "copy"
      • Optional mode?: "fail" | "warn"

    Returns void

  • Expect a GPUBuffer's contents to pass the provided check.

    A library of checks can be found in webgpu/util/check_contents.

    Type Parameters

    • T extends Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array

    Parameters

    • src: GPUBuffer
    • check: ((actual) => undefined | Error)
        • (actual): undefined | Error
        • Parameters

          • actual: T

          Returns undefined | Error

    • __namedParameters: {
          method?: "map" | "copy";
          mode?: "fail" | "warn";
          srcByteOffset?: number;
          type: TypedArrayBufferViewConstructor<T>;
          typedLength: number;
      }

    Returns void

  • Expect the specified WebGPU error to be generated when running the provided function.

    Type Parameters

    • R

    Parameters

    • filter: GPUErrorFilter
    • fn: (() => R)
        • (): R
        • Returns R

    • shouldError: boolean = true

    Returns R

  • If the argument is an Error, fail (or warn). If it's undefined, no-op. If the argument is an array, apply the above behavior on each of elements.

    Parameters

    • error: undefined | Error | (undefined | Error)[]
    • __namedParameters: {
          mode?: "fail" | "warn";
          niceStack?: Error;
      } = {}
      • Optional mode?: "fail" | "warn"
      • Optional niceStack?: Error

    Returns void

  • Expect an entire GPUTexture to have a single color at the given mip level (defaults to 0). MAINTENANCE_TODO: Remove this and/or replace it with a helper in TextureTestMixin.

    Parameters

    • src: GPUTexture
    • format: GPUTextureFormat
    • __namedParameters: {
          dimension?: GPUTextureDimension;
          exp: PerTexelComponent<number>;
          layout?: LayoutOptions;
          size: [number, number, number];
          slice?: number;
      }
      • Optional dimension?: GPUTextureDimension
      • exp: PerTexelComponent<number>
      • Optional layout?: LayoutOptions
      • size: [number, number, number]
      • Optional slice?: number

    Returns void

  • Take a single pixel of a 2D texture, interpret it using a TypedArray of the expected type, and expect each value in that array to be between the corresponding "expected" values (either a[i] <= actual[i] <= b[i] or a[i] >= actual[i] => b[i]). MAINTENANCE_TODO: Remove this once there is a way to deal with undefined lerp-ed values.

    Parameters

    • src: GPUTexture
    • 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" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-unorm" | "bc4-r-snorm" | "bc5-rg-unorm" | "bc5-rg-snorm" | "bc6h-rgb-ufloat" | "bc6h-rgb-float" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "eac-r11unorm" | "eac-r11snorm" | "eac-rg11unorm" | "eac-rg11snorm" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb"
    • __namedParameters: {
          x: number;
          y: number;
      }
      • x: number
      • y: number
    • __namedParameters: {
          checkElementsBetweenFn?: ((actual, expected) => undefined | Error);
          exp: [Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array, Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array];
          generateWarningOnly?: boolean;
          layout?: LayoutOptions;
          slice?: number;
      }
      • Optional checkElementsBetweenFn?: ((actual, expected) => undefined | Error)
          • (actual, expected): undefined | Error
          • Parameters

            • actual: Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array
            • expected: readonly [Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array, Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array]

            Returns undefined | Error

      • exp: [Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array, Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array]
      • Optional generateWarningOnly?: boolean
      • Optional layout?: LayoutOptions
      • Optional slice?: number

    Returns void

  • Expects that a sparse set of pixels in the GPUTexture passes comparison against their expected colors without error.

    Type Parameters

    Parameters

    Returns void

  • Expects that comparing the subrect (defined via size) of a GPUTexture to the expected TexelView passes without error.

    Parameters

    Returns void

  • Renders the 2 given textures to an rgba8unorm texture at the size of the specified mipLevel, each time reading the contents of the result. Expects contents of both renders to match. Also expects contents described by origin and size to not be a constant value so as to make sure something interesting was actually compared.

    The point of this function is to compare compressed texture contents in compatibility mode. copyTextureToBuffer does not work for compressed textures in compatibility mode so instead, we pass 2 compressed texture to this function. Each one will be rendered to an rgba8unorm texture, the results of that rgba8unorm texture read via copyTextureToBuffer, and then results compared. This indirectly lets us compare the contents of the 2 compressed textures.

    Code calling this function would generate the textures where the actualTexture is generated calling writeTexture, copyBufferToTexture or copyTextureToTexture and expectedTexture's data is generated entirely on the CPU in such a way that its content should match whatever process was used to generate actualTexture. Often this involves calling updateLinearTextureDataSubBox

    Parameters

    • actualTexture: GPUTexture
    • expectedTexture: GPUTexture
    • mipLevel: number
    • origin: Required<GPUOrigin3DDict>
    • size: Required<GPUExtent3DDict>

    Returns void

  • Expect a validation error inside the callback.

    Tests should always do just one WebGPU call in the callback, to make sure that's what's tested.

    Parameters

    • fn: (() => void)
        • (): void
        • Returns void

    • shouldError: boolean = true

    Returns void

  • Log an error and increase the result status to "ExpectFailed".

    Parameters

    • Optional msg: string

    Returns void

  • Parameters

    • limit: "maxTextureDimension1D" | "maxTextureDimension2D" | "maxTextureDimension3D" | "maxTextureArrayLayers" | "maxBindGroups" | "maxBindGroupsPlusVertexBuffers" | "maxBindingsPerBindGroup" | "maxDynamicUniformBuffersPerPipelineLayout" | "maxDynamicStorageBuffersPerPipelineLayout" | "maxSampledTexturesPerShaderStage" | "maxSamplersPerShaderStage" | "maxStorageBuffersPerShaderStage" | "maxStorageTexturesPerShaderStage" | "maxUniformBuffersPerShaderStage" | "maxUniformBufferBindingSize" | "maxStorageBufferBindingSize" | "minUniformBufferOffsetAlignment" | "minStorageBufferOffsetAlignment" | "maxVertexBuffers" | "maxBufferSize" | "maxVertexAttributes" | "maxVertexBufferArrayStride" | "maxInterStageShaderVariables" | "maxColorAttachments" | "maxColorAttachmentBytesPerSample" | "maxComputeWorkgroupStorageSize" | "maxComputeInvocationsPerWorkgroup" | "maxComputeWorkgroupSizeX" | "maxComputeWorkgroupSizeY" | "maxComputeWorkgroupSizeZ" | "maxComputeWorkgroupsPerDimension"

    Returns 4 | 1000 | 8 | 12 | 16 | 32 | 256 | 64 | 8192 | 2048 | 24 | 65536 | 16384 | 134217728 | 268435456 | 65535

  • Returns {
        maxBindGroups: {
            class: "maximum";
            default: 4;
            maximumValue: 4;
        };
        maxBindGroupsPlusVertexBuffers: {
            class: "maximum";
            default: 24;
            maximumValue: 24;
        };
        maxBindingsPerBindGroup: {
            class: "maximum";
            default: 1000;
            maximumValue: 1000;
        };
        maxBufferSize: {
            class: "maximum";
            default: 268435456;
            maximumValue: 268435456;
        };
        maxColorAttachmentBytesPerSample: {
            class: "maximum";
            default: 32;
            maximumValue: 32;
        };
        maxColorAttachments: {
            class: "maximum";
            default: 8;
            maximumValue: 4;
        };
        maxComputeInvocationsPerWorkgroup: {
            class: "maximum";
            default: 256;
            maximumValue: 128;
        };
        maxComputeWorkgroupSizeX: {
            class: "maximum";
            default: 256;
            maximumValue: 128;
        };
        maxComputeWorkgroupSizeY: {
            class: "maximum";
            default: 256;
            maximumValue: 128;
        };
        maxComputeWorkgroupSizeZ: {
            class: "maximum";
            default: 64;
            maximumValue: 64;
        };
        maxComputeWorkgroupStorageSize: {
            class: "maximum";
            default: 16384;
            maximumValue: 16384;
        };
        maxComputeWorkgroupsPerDimension: {
            class: "maximum";
            default: 65535;
            maximumValue: 65535;
        };
        maxDynamicStorageBuffersPerPipelineLayout: {
            class: "maximum";
            default: 4;
            maximumValue: 4;
        };
        maxDynamicUniformBuffersPerPipelineLayout: {
            class: "maximum";
            default: 8;
            maximumValue: 8;
        };
        maxInterStageShaderVariables: {
            class: "maximum";
            default: 16;
            maximumValue: 15;
        };
        maxSampledTexturesPerShaderStage: {
            class: "maximum";
            default: 16;
            maximumValue: 16;
        };
        maxSamplersPerShaderStage: {
            class: "maximum";
            default: 16;
            maximumValue: 16;
        };
        maxStorageBufferBindingSize: {
            class: "maximum";
            default: 134217728;
            maximumValue: 134217728;
        };
        maxStorageBuffersPerShaderStage: {
            class: "maximum";
            default: 8;
            maximumValue: 4;
        };
        maxStorageTexturesPerShaderStage: {
            class: "maximum";
            default: 4;
            maximumValue: 4;
        };
        maxTextureArrayLayers: {
            class: "maximum";
            default: 256;
            maximumValue: 256;
        };
        maxTextureDimension1D: {
            class: "maximum";
            default: 8192;
            maximumValue: 4096;
        };
        maxTextureDimension2D: {
            class: "maximum";
            default: 8192;
            maximumValue: 4096;
        };
        maxTextureDimension3D: {
            class: "maximum";
            default: 2048;
            maximumValue: 1024;
        };
        maxUniformBufferBindingSize: {
            class: "maximum";
            default: 65536;
            maximumValue: 16384;
        };
        maxUniformBuffersPerShaderStage: {
            class: "maximum";
            default: 12;
            maximumValue: 12;
        };
        maxVertexAttributes: {
            class: "maximum";
            default: 16;
            maximumValue: 16;
        };
        maxVertexBufferArrayStride: {
            class: "maximum";
            default: 2048;
            maximumValue: 2048;
        };
        maxVertexBuffers: {
            class: "maximum";
            default: 8;
            maximumValue: 8;
        };
        minStorageBufferOffsetAlignment: {
            class: "alignment";
            default: 256;
            maximumValue: 256;
        };
        minUniformBufferOffsetAlignment: {
            class: "alignment";
            default: 256;
            maximumValue: 256;
        };
    }

    • Readonly maxBindGroups: {
          class: "maximum";
          default: 4;
          maximumValue: 4;
      }
      • class: "maximum"
      • default: 4
      • maximumValue: 4
    • Readonly maxBindGroupsPlusVertexBuffers: {
          class: "maximum";
          default: 24;
          maximumValue: 24;
      }
      • class: "maximum"
      • default: 24
      • maximumValue: 24
    • Readonly maxBindingsPerBindGroup: {
          class: "maximum";
          default: 1000;
          maximumValue: 1000;
      }
      • class: "maximum"
      • default: 1000
      • maximumValue: 1000
    • Readonly maxBufferSize: {
          class: "maximum";
          default: 268435456;
          maximumValue: 268435456;
      }
      • class: "maximum"
      • default: 268435456
      • maximumValue: 268435456
    • Readonly maxColorAttachmentBytesPerSample: {
          class: "maximum";
          default: 32;
          maximumValue: 32;
      }
      • class: "maximum"
      • default: 32
      • maximumValue: 32
    • Readonly maxColorAttachments: {
          class: "maximum";
          default: 8;
          maximumValue: 4;
      }
      • class: "maximum"
      • default: 8
      • maximumValue: 4
    • Readonly maxComputeInvocationsPerWorkgroup: {
          class: "maximum";
          default: 256;
          maximumValue: 128;
      }
      • class: "maximum"
      • default: 256
      • maximumValue: 128
    • Readonly maxComputeWorkgroupSizeX: {
          class: "maximum";
          default: 256;
          maximumValue: 128;
      }
      • class: "maximum"
      • default: 256
      • maximumValue: 128
    • Readonly maxComputeWorkgroupSizeY: {
          class: "maximum";
          default: 256;
          maximumValue: 128;
      }
      • class: "maximum"
      • default: 256
      • maximumValue: 128
    • Readonly maxComputeWorkgroupSizeZ: {
          class: "maximum";
          default: 64;
          maximumValue: 64;
      }
      • class: "maximum"
      • default: 64
      • maximumValue: 64
    • Readonly maxComputeWorkgroupStorageSize: {
          class: "maximum";
          default: 16384;
          maximumValue: 16384;
      }
      • class: "maximum"
      • default: 16384
      • maximumValue: 16384
    • Readonly maxComputeWorkgroupsPerDimension: {
          class: "maximum";
          default: 65535;
          maximumValue: 65535;
      }
      • class: "maximum"
      • default: 65535
      • maximumValue: 65535
    • Readonly maxDynamicStorageBuffersPerPipelineLayout: {
          class: "maximum";
          default: 4;
          maximumValue: 4;
      }
      • class: "maximum"
      • default: 4
      • maximumValue: 4
    • Readonly maxDynamicUniformBuffersPerPipelineLayout: {
          class: "maximum";
          default: 8;
          maximumValue: 8;
      }
      • class: "maximum"
      • default: 8
      • maximumValue: 8
    • Readonly maxInterStageShaderVariables: {
          class: "maximum";
          default: 16;
          maximumValue: 15;
      }
      • class: "maximum"
      • default: 16
      • maximumValue: 15
    • Readonly maxSampledTexturesPerShaderStage: {
          class: "maximum";
          default: 16;
          maximumValue: 16;
      }
      • class: "maximum"
      • default: 16
      • maximumValue: 16
    • Readonly maxSamplersPerShaderStage: {
          class: "maximum";
          default: 16;
          maximumValue: 16;
      }
      • class: "maximum"
      • default: 16
      • maximumValue: 16
    • Readonly maxStorageBufferBindingSize: {
          class: "maximum";
          default: 134217728;
          maximumValue: 134217728;
      }
      • class: "maximum"
      • default: 134217728
      • maximumValue: 134217728
    • Readonly maxStorageBuffersPerShaderStage: {
          class: "maximum";
          default: 8;
          maximumValue: 4;
      }
      • class: "maximum"
      • default: 8
      • maximumValue: 4
    • Readonly maxStorageTexturesPerShaderStage: {
          class: "maximum";
          default: 4;
          maximumValue: 4;
      }
      • class: "maximum"
      • default: 4
      • maximumValue: 4
    • Readonly maxTextureArrayLayers: {
          class: "maximum";
          default: 256;
          maximumValue: 256;
      }
      • class: "maximum"
      • default: 256
      • maximumValue: 256
    • Readonly maxTextureDimension1D: {
          class: "maximum";
          default: 8192;
          maximumValue: 4096;
      }
      • class: "maximum"
      • default: 8192
      • maximumValue: 4096
    • Readonly maxTextureDimension2D: {
          class: "maximum";
          default: 8192;
          maximumValue: 4096;
      }
      • class: "maximum"
      • default: 8192
      • maximumValue: 4096
    • Readonly maxTextureDimension3D: {
          class: "maximum";
          default: 2048;
          maximumValue: 1024;
      }
      • class: "maximum"
      • default: 2048
      • maximumValue: 1024
    • Readonly maxUniformBufferBindingSize: {
          class: "maximum";
          default: 65536;
          maximumValue: 16384;
      }
      • class: "maximum"
      • default: 65536
      • maximumValue: 16384
    • Readonly maxUniformBuffersPerShaderStage: {
          class: "maximum";
          default: 12;
          maximumValue: 12;
      }
      • class: "maximum"
      • default: 12
      • maximumValue: 12
    • Readonly maxVertexAttributes: {
          class: "maximum";
          default: 16;
          maximumValue: 16;
      }
      • class: "maximum"
      • default: 16
      • maximumValue: 16
    • Readonly maxVertexBufferArrayStride: {
          class: "maximum";
          default: 2048;
          maximumValue: 2048;
      }
      • class: "maximum"
      • default: 2048
      • maximumValue: 2048
    • Readonly maxVertexBuffers: {
          class: "maximum";
          default: 8;
          maximumValue: 8;
      }
      • class: "maximum"
      • default: 8
      • maximumValue: 8
    • Readonly minStorageBufferOffsetAlignment: {
          class: "alignment";
          default: 256;
          maximumValue: 256;
      }
      • class: "alignment"
      • default: 256
      • maximumValue: 256
    • Readonly minUniformBufferOffsetAlignment: {
          class: "alignment";
          default: 256;
          maximumValue: 256;
      }
      • class: "alignment"
      • default: 256
      • maximumValue: 256
  • Parameters

    • __namedParameters: {
          conversion: {
              dstColorSpace?: PredefinedColorSpace;
              dstPremultiplied: boolean;
              srcColorSpace?: PredefinedColorSpace;
              srcPremultiplied: boolean;
          };
          dstOrigin: GPUOrigin3D;
          dstSize: GPUExtent3D;
          flipSrcBeforeCopy: boolean;
          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";
          srcDoFlipYDuringCopy: boolean;
          srcOrigin: GPUOrigin2D;
          srcPixels: Uint8ClampedArray;
          srcSize: GPUExtent3D;
          subRectSize: GPUExtent3D;
      }
      • conversion: {
            dstColorSpace?: PredefinedColorSpace;
            dstPremultiplied: boolean;
            srcColorSpace?: PredefinedColorSpace;
            srcPremultiplied: boolean;
        }
        • Optional dstColorSpace?: PredefinedColorSpace
        • dstPremultiplied: boolean
        • Optional srcColorSpace?: PredefinedColorSpace
        • srcPremultiplied: boolean
      • dstOrigin: GPUOrigin3D
      • dstSize: GPUExtent3D
      • flipSrcBeforeCopy: boolean
      • 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"
      • srcDoFlipYDuringCopy: boolean
      • srcOrigin: GPUOrigin2D
      • srcPixels: Uint8ClampedArray
      • srcSize: GPUExtent3D
      • subRectSize: GPUExtent3D

    Returns TexelView

  • Gets a byte offset to a texel

    Parameters

    • textureDataLayout: Required<GPUTexelCopyBufferLayout>
    • 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" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-unorm" | "bc4-r-snorm" | "bc5-rg-unorm" | "bc5-rg-snorm" | "bc6h-rgb-ufloat" | "bc6h-rgb-float" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "eac-r11unorm" | "eac-r11snorm" | "eac-rg11unorm" | "eac-rg11snorm" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb"
    • texel: Required<GPUOrigin3DDict>
    • Optional origin: Required<GPUOrigin3DDict>

    Returns number

  • returns true iff the langFeature is supported

    Parameters

    • langFeature: "readonly_and_readwrite_storage_textures" | "packed_4x8_integer_dot_product" | "unrestricted_pointer_parameters" | "pointer_composite_access"

    Returns boolean

  • Log an info message. Use sparingly. Use debug() instead if logs are only needed with debug logging enabled.

    Parameters

    • msg: string

    Returns void

  • Parameters

    • size: Required<GPUExtent3DDict>
    • 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" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-unorm" | "bc4-r-snorm" | "bc5-rg-unorm" | "bc5-rg-snorm" | "bc6h-rgb-ufloat" | "bc6h-rgb-float" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "eac-r11unorm" | "eac-r11snorm" | "eac-rg11unorm" | "eac-rg11snorm" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb"

    Returns Generator<Required<GPUOrigin3DDict>, any, unknown>

  • Creates a buffer with the contents of some TypedArray. The buffer size will always be aligned to 4 as we set mappedAtCreation === true when creating the buffer.

    MAINTENANCE_TODO: Several call sites would be simplified if this took ArrayBuffer as well.

    Parameters

    • dataArray: Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array
    • usage: number

    Returns GPUBuffer

  • Parameters

    • limit: "maxTextureDimension1D" | "maxTextureDimension2D" | "maxTextureDimension3D" | "maxTextureArrayLayers" | "maxBindGroups" | "maxBindGroupsPlusVertexBuffers" | "maxBindingsPerBindGroup" | "maxDynamicUniformBuffersPerPipelineLayout" | "maxDynamicStorageBuffersPerPipelineLayout" | "maxSampledTexturesPerShaderStage" | "maxSamplersPerShaderStage" | "maxStorageBuffersPerShaderStage" | "maxStorageTexturesPerShaderStage" | "maxUniformBuffersPerShaderStage" | "maxUniformBufferBindingSize" | "maxStorageBufferBindingSize" | "minUniformBufferOffsetAlignment" | "minStorageBufferOffsetAlignment" | "maxVertexBuffers" | "maxBufferSize" | "maxVertexAttributes" | "maxVertexBufferArrayStride" | "maxInterStageShaderVariables" | "maxColorAttachments" | "maxColorAttachmentBytesPerSample" | "maxComputeWorkgroupStorageSize" | "maxComputeInvocationsPerWorkgroup" | "maxComputeWorkgroupSizeX" | "maxComputeWorkgroupSizeY" | "maxComputeWorkgroupSizeZ" | "maxComputeWorkgroupsPerDimension"
    • variant: ValueTestVariant

    Returns number

  • Snapshot the current contents of a range of a GPUBuffer, and return them as a TypedArray. Also provides a cleanup() function to unmap and destroy the staging buffer.

    Type Parameters

    • T extends Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float16Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array

    Parameters

    Returns Promise<{
        data: T;
        cleanup() => void;
    }>

  • Call requestDevice() and track the device for cleanup.

    Parameters

    • adapter: GPUAdapter
    • desc: undefined | GPUDeviceDescriptor = undefined

    Returns Promise<GPUDevice>

  • Expect that the provided promise rejects, with the provided exception name.

    Parameters

    Returns void

  • Expect that the provided promise resolves (fulfills).

    Parameters

    • p: Promise<unknown>
    • Optional msg: string

    Returns void

  • Expect that the provided function throws (if true or string) or not (if false). If a string is provided, expect that the throw exception has that name.

    MAINTENANCE_TODO: Change to string | false so the exception name is always checked.

    Parameters

    • expectedError: string | boolean
    • fn: (() => void)
        • (): void
        • Returns void

    • __namedParameters: ExceptionCheckOptions = {}

    Returns void

  • Throws an exception marking the subcase as skipped.

    Parameters

    • msg: string

    Returns never

  • Throws an exception marking the subcase as skipped if condition is true

    Parameters

    • cond: boolean
    • msg: string | (() => string) = ''

    Returns void

  • Parameters

    • Rest ...formats: (undefined | GPUTextureFormat)[]

    Returns void

  • Skips this test case if the langFeature is not supported.

    Parameters

    • langFeature: "readonly_and_readwrite_storage_textures" | "packed_4x8_integer_dot_product" | "unrestricted_pointer_parameters" | "pointer_composite_access"

    Returns void

  • Skips this test case if the langFeature is supported.

    Parameters

    • langFeature: "readonly_and_readwrite_storage_textures" | "packed_4x8_integer_dot_product" | "unrestricted_pointer_parameters" | "pointer_composite_access"

    Returns void

  • Skips test if any format is not supported.

    Parameters

    • Rest ...formats: (undefined | GPUTextureFormat)[]

    Returns void

  • Parameters

    • Rest ...formats: (undefined | GPUTextureFormat)[]

    Returns void

  • Parameters

    • Rest ...dimensions: (undefined | GPUTextureViewDimension)[]

    Returns void

  • Tracks an object to be cleaned up after the test finishes.

    Usually when creating buffers/textures/query sets, you can use the helpers in GPUTest instead.

    Type Parameters

    • T extends DestroyableObject | Promise<DestroyableObject>

    Parameters

    • o: T

    Returns T

  • Tracks an object, if it's destroyable, to be cleaned up after the test finishes.

    Type Parameters

    • T

    Parameters

    • o: T

    Returns T

  • Updates a Uint8Array with a cubic portion of data from another Uint8Array. Effectively it's a Uint8Array to Uint8Array copy that does the same thing as writeTexture but because the destination is a buffer you have to provide the parameters of the destination buffer similarly to how you'd provide them to copyTextureToBuffer

    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" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-unorm" | "bc4-r-snorm" | "bc5-rg-unorm" | "bc5-rg-snorm" | "bc6h-rgb-ufloat" | "bc6h-rgb-float" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "eac-r11unorm" | "eac-r11snorm" | "eac-rg11unorm" | "eac-rg11snorm" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb"
    • copySize: Required<GPUExtent3DDict>
    • copyParams: {
          dest: LinearCopyParameters;
          src: LinearCopyParameters;
      }
      • dest: LinearCopyParameters
      • src: LinearCopyParameters

    Returns void

  • Log a warning and increase the result status to "Warn".

    Parameters

    • Optional msg: string

    Returns void

Generated using TypeDoc