Skip to content

Commit

Permalink
Stop trying to filter sint/uint formats. (#4022)
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman authored Oct 31, 2024
1 parent bfbfd9e commit 8690def
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
5 changes: 5 additions & 0 deletions src/webgpu/format_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,11 @@ export function canUseAsRenderTarget(format: GPUTextureFormat) {
return kTextureFormatInfo[format].colorRender || isDepthOrStencilTextureFormat(format);
}

export function isFilterable(format: GPUTextureFormat) {
const info = kTextureFormatInfo[format];
return info.color?.type === 'float';
}

export const kCompatModeUnsupportedStorageTextureFormats: readonly GPUTextureFormat[] = [
'rg32float',
'rg32sint',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { makeTestGroup } from '../../../../../../common/framework/test_group.js'
import {
isDepthTextureFormat,
isEncodableTextureFormat,
isFilterable,
kDepthStencilFormats,
kAllTextureFormats,
} from '../../../../../format_info.js';
Expand Down Expand Up @@ -87,6 +88,7 @@ Parameters:
.combine('format', kAllTextureFormats)
.filter(t => isFillable(t.format))
.combine('filt', ['nearest', 'linear'] as const)
.filter(t => t.filt === 'nearest' || isFilterable(t.format))
.combine('modeU', kShortAddressModes)
.combine('modeV', kShortAddressModes)
.combine('offset', [false, true] as const)
Expand Down Expand Up @@ -184,6 +186,7 @@ Parameters:
.combine('format', kAllTextureFormats)
.filter(t => isFillable(t.format))
.combine('filt', ['nearest', 'linear'] as const)
.filter(t => t.filt === 'nearest' || isFilterable(t.format))
.combine('mode', kShortAddressModes)
.beginSubcases()
.combine('C', ['i32', 'u32'] as const)
Expand Down Expand Up @@ -292,6 +295,7 @@ Parameters:
.combine('format', kAllTextureFormats)
.filter(t => isFillable(t.format))
.combine('filt', ['nearest', 'linear'] as const)
.filter(t => t.filt === 'nearest' || isFilterable(t.format))
.combine('modeU', kShortAddressModes)
.combine('modeV', kShortAddressModes)
.combine('offset', [false, true] as const)
Expand Down Expand Up @@ -398,6 +402,7 @@ Parameters:
.combine('format', kAllTextureFormats)
.filter(t => isFillable(t.format))
.combine('filt', ['nearest', 'linear'] as const)
.filter(t => t.filt === 'nearest' || isFilterable(t.format))
.combine('mode', kShortAddressModes)
.beginSubcases()
.combine('samplePoints', kCubeSamplePointMethods)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Parameters:
.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('filt', ['nearest', 'linear'] as const)
.combine('modeU', kShortAddressModes)
.combine('modeV', kShortAddressModes)
.combine('offset', [false, true] as const)
Expand All @@ -89,17 +88,7 @@ Parameters:
t.skipIfTextureFormatNotSupported(t.params.format);
})
.fn(async t => {
const {
format,
stage,
samplePoints,
A,
modeU,
modeV,
filt: minFilter,
compare,
offset,
} = t.params;
const { format, stage, samplePoints, A, modeU, modeV, compare, offset } = t.params;

const viewDimension = '2d-array';
const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension });
Expand All @@ -116,9 +105,6 @@ Parameters:
addressModeU: kShortAddressModeToAddressMode[modeU],
addressModeV: kShortAddressModeToAddressMode[modeV],
compare,
minFilter,
magFilter: minFilter,
mipmapFilter: minFilter,
};

const calls: TextureCall<vec2>[] = generateTextureBuiltinInputs2D(50, {
Expand All @@ -129,7 +115,7 @@ Parameters:
arrayIndex: { num: texture.depthOrArrayLayers, type: A },
depthRef: true,
offset,
hashInputs: [stage, format, samplePoints, A, modeU, modeV, minFilter, offset],
hashInputs: [stage, format, samplePoints, A, modeU, modeV, offset],
}).map(({ coords, arrayIndex, depthRef, offset }) => {
return {
builtin: 'textureGatherCompare',
Expand Down Expand Up @@ -189,7 +175,6 @@ Parameters:
.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('filt', ['nearest', 'linear'] as const)
.combine('mode', kShortAddressModes)
.beginSubcases()
.combine('samplePoints', kCubeSamplePointMethods)
Expand All @@ -200,7 +185,7 @@ Parameters:
t.skipIfTextureViewDimensionNotSupported('cube-array');
})
.fn(async t => {
const { format, A, stage, samplePoints, mode, filt: minFilter, compare } = t.params;
const { format, A, stage, samplePoints, mode, compare } = t.params;

const viewDimension: GPUTextureViewDimension = 'cube-array';
const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
Expand All @@ -219,9 +204,6 @@ Parameters:
addressModeV: kShortAddressModeToAddressMode[mode],
addressModeW: kShortAddressModeToAddressMode[mode],
compare,
minFilter,
magFilter: minFilter,
mipmapFilter: minFilter,
};

const calls: TextureCall<vec3>[] = generateSamplePointsCube(50, {
Expand All @@ -231,7 +213,7 @@ Parameters:
textureBuiltin: 'textureGatherCompare',
arrayIndex: { num: texture.depthOrArrayLayers / 6, type: A },
depthRef: true,
hashInputs: [stage, format, samplePoints, mode, minFilter],
hashInputs: [stage, format, samplePoints, mode],
}).map(({ coords, depthRef, arrayIndex }) => {
return {
builtin: 'textureGatherCompare',
Expand Down Expand Up @@ -296,7 +278,6 @@ Parameters:
.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('filt', ['nearest', 'linear'] as const)
.combine('mode', kShortAddressModes)
.combine('offset', [false, true] as const)
.beginSubcases()
Expand All @@ -305,7 +286,7 @@ Parameters:
.combine('compare', kCompareFunctions)
)
.fn(async t => {
const { format, C, stage, samplePoints, mode, compare, filt: minFilter, offset } = t.params;
const { format, C, stage, samplePoints, mode, compare, offset } = t.params;

const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const descriptor: GPUTextureDescriptor = {
Expand All @@ -320,9 +301,6 @@ Parameters:
addressModeU: kShortAddressModeToAddressMode[mode],
addressModeV: kShortAddressModeToAddressMode[mode],
compare,
minFilter,
magFilter: minFilter,
mipmapFilter: minFilter,
};

const calls: TextureCall<vec2>[] = generateTextureBuiltinInputs2D(50, {
Expand All @@ -332,7 +310,7 @@ Parameters:
descriptor,
offset,
depthRef: true,
hashInputs: [stage, format, C, samplePoints, mode, minFilter, compare, offset],
hashInputs: [stage, format, C, samplePoints, mode, compare, offset],
}).map(({ coords, depthRef, offset }) => {
return {
builtin: 'textureGatherCompare',
Expand Down Expand Up @@ -387,14 +365,13 @@ Parameters:
.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('filt', ['nearest', 'linear'] as const)
.combine('mode', kShortAddressModes)
.beginSubcases()
.combine('samplePoints', kCubeSamplePointMethods)
.combine('compare', kCompareFunctions)
)
.fn(async t => {
const { format, stage, samplePoints, mode, filt: minFilter, compare } = t.params;
const { format, stage, samplePoints, mode, compare } = t.params;

const viewDimension: GPUTextureViewDimension = 'cube';
const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
Expand All @@ -413,9 +390,6 @@ Parameters:
addressModeV: kShortAddressModeToAddressMode[mode],
addressModeW: kShortAddressModeToAddressMode[mode],
compare,
minFilter,
magFilter: minFilter,
mipmapFilter: minFilter,
};

const calls: TextureCall<vec3>[] = generateSamplePointsCube(50, {
Expand All @@ -424,7 +398,7 @@ Parameters:
descriptor,
depthRef: true,
textureBuiltin: 'textureGatherCompare',
hashInputs: [stage, format, samplePoints, mode, minFilter, compare],
hashInputs: [stage, format, samplePoints, mode, compare],
}).map(({ coords, depthRef }) => {
return {
builtin: 'textureGatherCompare',
Expand Down

0 comments on commit 8690def

Please sign in to comment.