Skip to content

Commit

Permalink
Texture builtins: move addressMode? to case (#4010)
Browse files Browse the repository at this point in the history
addressMode is broken on many GPUs. Moving this from a subcase
to a case lets us separate out those failures.

I opted to put the parameters in minFilter, addresMode, offset
order which means for some builtins I moved minFilter from subcase
to case.

This turned into a massive change because the queryStrings got too long.
so had to change

* addressModeX -> modeX
* filter to filt
* clamp-to-edge -> c
* repeat -> r
* mirror-repeat -> m
* viewDimension -> dim
* fragment -> f
* compute -> c
* vertex -> v

Other option would be to move all the tests from
`webgpu:shader,execution,expression,call,builtin` to
`webgpu:texture` though I'm not sure that would be enough on it's own

Note: this takes `webgpu:shader,execution,expression,call,builtin,*`
from 21738 cases to 113546 cases
  • Loading branch information
greggman authored Oct 21, 2024
1 parent f45a9e0 commit 3290214
Show file tree
Hide file tree
Showing 11 changed files with 636 additions and 461 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
isEncodableTextureFormat,
kDepthStencilFormats,
} from '../../../../../format_info.js';
import { kShaderStages } from '../../../../validation/decl/util.js';

import {
checkCallResults,
Expand All @@ -34,6 +33,9 @@ import {
generateTextureBuiltinInputs2D,
kCubeSamplePointMethods,
kSamplePointMethods,
kShortAddressModes,
kShortAddressModeToAddressMode,
kShortShaderStages,
makeRandomDepthComparisonTexelGenerator,
TextureCall,
vec2,
Expand Down Expand Up @@ -68,19 +70,19 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kDepthStencilFormats)
// filter out stencil only formats
.filter(t => isDepthTextureFormat(t.format))
// MAINTENANCE_TODO: Remove when support for depth24plus, depth24plus-stencil8, and depth32float-stencil8 is added.
.filter(t => isEncodableTextureFormat(t.format))
.combine('minFilter', ['nearest', 'linear'] as const)
.combine('filt', ['nearest', 'linear'] as const)
.combine('modeU', kShortAddressModes)
.combine('modeV', kShortAddressModes)
.combine('offset', [false, true] as const)
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('addressModeU', ['clamp-to-edge', 'repeat', 'mirror-repeat'] as const)
.combine('addressModeV', ['clamp-to-edge', 'repeat', 'mirror-repeat'] as const)
.combine('compare', kCompareFunctions)
)
.beforeAllSubcases(t => {
Expand All @@ -92,9 +94,9 @@ Parameters:
stage,
samplePoints,
A,
addressModeU,
addressModeV,
minFilter,
modeU,
modeV,
filt: minFilter,
compare,
offset,
} = t.params;
Expand All @@ -111,8 +113,8 @@ Parameters:
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
});
const sampler: GPUSamplerDescriptor = {
addressModeU,
addressModeV,
addressModeU: kShortAddressModeToAddressMode[modeU],
addressModeV: kShortAddressModeToAddressMode[modeV],
compare,
minFilter,
magFilter: minFilter,
Expand All @@ -127,7 +129,7 @@ Parameters:
arrayIndex: { num: texture.depthOrArrayLayers, type: A },
depthRef: true,
offset,
hashInputs: [stage, format, samplePoints, A, addressModeU, addressModeV, minFilter, offset],
hashInputs: [stage, format, samplePoints, A, modeU, modeV, minFilter, offset],
}).map(({ coords, arrayIndex, depthRef, offset }) => {
return {
builtin: 'textureGatherCompare',
Expand Down Expand Up @@ -181,24 +183,24 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kDepthStencilFormats)
// filter out stencil only formats
.filter(t => isDepthTextureFormat(t.format))
// MAINTENANCE_TODO: Remove when support for depth24plus, depth24plus-stencil8, and depth32float-stencil8 is added.
.filter(t => isEncodableTextureFormat(t.format))
.combine('minFilter', ['nearest', 'linear'] as const)
.combine('filt', ['nearest', 'linear'] as const)
.combine('mode', kShortAddressModes)
.beginSubcases()
.combine('samplePoints', kCubeSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('addressMode', ['clamp-to-edge', 'repeat', 'mirror-repeat'] as const)
.combine('compare', kCompareFunctions)
)
.beforeAllSubcases(t => {
t.skipIfTextureViewDimensionNotSupported('cube-array');
})
.fn(async t => {
const { format, A, stage, samplePoints, addressMode, minFilter, compare } = t.params;
const { format, A, stage, samplePoints, mode, filt: minFilter, compare } = t.params;

const viewDimension: GPUTextureViewDimension = 'cube-array';
const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
Expand All @@ -213,9 +215,9 @@ Parameters:
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
});
const sampler: GPUSamplerDescriptor = {
addressModeU: addressMode,
addressModeV: addressMode,
addressModeW: addressMode,
addressModeU: kShortAddressModeToAddressMode[mode],
addressModeV: kShortAddressModeToAddressMode[mode],
addressModeW: kShortAddressModeToAddressMode[mode],
compare,
minFilter,
magFilter: minFilter,
Expand All @@ -229,7 +231,7 @@ Parameters:
textureBuiltin: 'textureGatherCompare',
arrayIndex: { num: texture.depthOrArrayLayers / 6, type: A },
depthRef: true,
hashInputs: [stage, format, samplePoints, addressMode, minFilter],
hashInputs: [stage, format, samplePoints, mode, minFilter],
}).map(({ coords, depthRef, arrayIndex }) => {
return {
builtin: 'textureGatherCompare',
Expand Down Expand Up @@ -288,22 +290,22 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kDepthStencilFormats)
// filter out stencil only formats
.filter(t => isDepthTextureFormat(t.format))
// MAINTENANCE_TODO: Remove when support for depth24plus, depth24plus-stencil8, and depth32float-stencil8 is added.
.filter(t => isEncodableTextureFormat(t.format))
.combine('minFilter', ['nearest', 'linear'] as const)
.combine('filt', ['nearest', 'linear'] as const)
.combine('mode', kShortAddressModes)
.combine('offset', [false, true] as const)
.beginSubcases()
.combine('C', ['i32', 'u32'] as const)
.combine('samplePoints', kSamplePointMethods)
.combine('addressMode', ['clamp-to-edge', 'repeat', 'mirror-repeat'] as const)
.combine('compare', kCompareFunctions)
)
.fn(async t => {
const { format, C, stage, samplePoints, addressMode, compare, minFilter, offset } = t.params;
const { format, C, stage, samplePoints, mode, compare, filt: minFilter, offset } = t.params;

const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const descriptor: GPUTextureDescriptor = {
Expand All @@ -315,8 +317,8 @@ Parameters:
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
});
const sampler: GPUSamplerDescriptor = {
addressModeU: addressMode,
addressModeV: addressMode,
addressModeU: kShortAddressModeToAddressMode[mode],
addressModeV: kShortAddressModeToAddressMode[mode],
compare,
minFilter,
magFilter: minFilter,
Expand All @@ -330,7 +332,7 @@ Parameters:
descriptor,
offset,
depthRef: true,
hashInputs: [stage, format, C, samplePoints, addressMode, minFilter, compare, offset],
hashInputs: [stage, format, C, samplePoints, mode, minFilter, compare, offset],
}).map(({ coords, depthRef, offset }) => {
return {
builtin: 'textureGatherCompare',
Expand Down Expand Up @@ -379,20 +381,20 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kDepthStencilFormats)
// filter out stencil only formats
.filter(t => isDepthTextureFormat(t.format))
// MAINTENANCE_TODO: Remove when support for depth24plus, depth24plus-stencil8, and depth32float-stencil8 is added.
.filter(t => isEncodableTextureFormat(t.format))
.combine('minFilter', ['nearest', 'linear'] as const)
.combine('filt', ['nearest', 'linear'] as const)
.combine('mode', kShortAddressModes)
.beginSubcases()
.combine('samplePoints', kCubeSamplePointMethods)
.combine('addressMode', ['clamp-to-edge', 'repeat', 'mirror-repeat'] as const)
.combine('compare', kCompareFunctions)
)
.fn(async t => {
const { format, stage, samplePoints, addressMode, minFilter, compare } = t.params;
const { format, stage, samplePoints, mode, filt: minFilter, compare } = t.params;

const viewDimension: GPUTextureViewDimension = 'cube';
const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
Expand All @@ -407,9 +409,9 @@ Parameters:
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
});
const sampler: GPUSamplerDescriptor = {
addressModeU: addressMode,
addressModeV: addressMode,
addressModeW: addressMode,
addressModeU: kShortAddressModeToAddressMode[mode],
addressModeV: kShortAddressModeToAddressMode[mode],
addressModeW: kShortAddressModeToAddressMode[mode],
compare,
minFilter,
magFilter: minFilter,
Expand All @@ -422,7 +424,7 @@ Parameters:
descriptor,
depthRef: true,
textureBuiltin: 'textureGatherCompare',
hashInputs: [stage, format, samplePoints, addressMode, minFilter, compare],
hashInputs: [stage, format, samplePoints, mode, minFilter, compare],
}).map(({ coords, depthRef }) => {
return {
builtin: 'textureGatherCompare',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
import { GPUTest } from '../../../../../gpu_test.js';
import { maxMipLevelCount, virtualMipSize } from '../../../../../util/texture/base.js';
import { TexelFormats } from '../../../../types.js';
import { kShaderStages } from '../../../../validation/decl/util.js';

import {
TextureCall,
Expand All @@ -51,6 +50,7 @@ import {
vec2,
vec3,
kSamplePointMethods,
kShortShaderStages,
generateTextureBuiltinInputs1D,
generateTextureBuiltinInputs2D,
generateTextureBuiltinInputs3D,
Expand Down Expand Up @@ -91,7 +91,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kTestableColorFormats)
.filter(t => textureDimensionAndFormatCompatible('1d', t.format))
// 1d textures can't have a height !== 1
Expand Down Expand Up @@ -178,7 +178,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kTestableColorFormats)
.filter(t => !isCompressedFloatTextureFormat(t.format))
.beginSubcases()
Expand Down Expand Up @@ -260,7 +260,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kTestableColorFormats)
.filter(t => textureDimensionAndFormatCompatible('3d', t.format))
.beginSubcases()
Expand Down Expand Up @@ -346,7 +346,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('texture_type', [
'texture_multisampled_2d',
'texture_depth_multisampled_2d',
Expand Down Expand Up @@ -441,7 +441,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kDepthStencilFormats)
// filter out stencil only formats
.filter(t => isDepthTextureFormat(t.format))
Expand Down Expand Up @@ -523,7 +523,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
.combine('C', ['i32', 'u32'] as const)
Expand Down Expand Up @@ -603,7 +603,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combine('format', kTestableColorFormats)
// MAINTENANCE_TODO: Update createTextureFromTexelViews to support stencil8 and remove this filter.
.filter(t => t.format !== 'stencil8' && !isCompressedFloatTextureFormat(t.format))
Expand Down Expand Up @@ -700,7 +700,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combineWithParams([...TexelFormats, { format: 'bgra8unorm' }] as const)
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
Expand Down Expand Up @@ -779,7 +779,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combineWithParams([...TexelFormats, { format: 'bgra8unorm' }] as const)
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
Expand Down Expand Up @@ -858,7 +858,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combineWithParams([...TexelFormats, { format: 'bgra8unorm' }] as const)
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
Expand Down Expand Up @@ -941,7 +941,7 @@ Parameters:
)
.params(u =>
u
.combine('stage', kShaderStages)
.combine('stage', kShortShaderStages)
.combineWithParams([...TexelFormats, { format: 'bgra8unorm' }] as const)
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
Expand Down
Loading

0 comments on commit 3290214

Please sign in to comment.