GPUDevice for the test to use.
GPUDevice for tests requiring a second device different from the default one, e.g. for creating objects for by device_mismatch validation tests.
Returns the (case+subcase) parameters for this test function invocation.
GPUQueue for the test to use. (Same as t.device.queue
.)
Gets the test fixture's shared state. This object is shared between subcases within the same testcase.
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.
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
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.
Optional
attachmentOptional
occlusiong.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);
});
Creates a 1 mip level texture with the contents of a TexelView and tracks it for destruction for the test case.
Creates a mipmapped texture where each mipmap level's (i
) content is
from texelViews[i]
and tracks it for destruction for the test case.
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
.
Expect a GPUBuffer's contents to equal the values in the provided TypedArray.
Optional
method?: "map" | "copy"Optional
mode?: "fail" | "warn"Expect a GPUBuffer's contents to pass the provided check.
A library of checks can be found in webgpu/util/check_contents.
Optional
method?: "map" | "copy"Optional
mode?: "fail" | "warn"Optional
srcIf 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.
Optional
mode?: "fail" | "warn"Optional
niceExpect 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.
Optional
dimension?: GPUTextureDimensionOptional
layout?: LayoutOptionsOptional
slice?: numberTake 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.
Optional
checkOptional
generateOptional
layout?: LayoutOptionsOptional
slice?: numberExpects that a sparse set of pixels in the GPUTexture passes comparison against their expected colors without error.
Optional
comparisonOptions: TexelCompareOptionsExpects that comparing the subrect (defined via size
) of a GPUTexture
to the expected TexelView passes without error.
Optional
comparisonOptions: TexelCompareOptionsRenders 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
Readonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
maxReadonly
minReadonly
minOptional
dstOptional
srcGets a byte offset to a texel
Optional
origin: Required<GPUOrigin3DDict>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.
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.
Optional
method?: "map" | "copy"Optional
srcExpect that the provided promise rejects, with the provided exception name.
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.
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
Static
MakeGenerated using TypeDoc
GPUAdapter that the device was created from.