Skip to content

Commit

Permalink
Include depth textures in more tests (#3995)
Browse files Browse the repository at this point in the history
Depth textures were excluded originally because there
was no way to fill one via copyBufferToTexture. We added
a way to fill them later which was used for the textureLoad
tests. Now going back and enabling them for other tests.

Note that might be better to move minFilter to a case instead
of a subcase but that would break all expectations in CQs
so it seemed best to filter these in the test itself.
  • Loading branch information
greggman authored Oct 15, 2024
1 parent ae8b3ca commit c087b55
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
isSupportedViewFormatCombo,
vec1,
generateTextureBuiltinInputs1D,
skipIfNeedsFilteringAndIsUnfilterable,
} from './texture_utils.js';

const kTestableColorFormats = [...kEncodableTextureFormats, ...kCompressedTextureFormats] as const;
Expand Down Expand Up @@ -147,11 +148,12 @@ Parameters:
.combine('addressModeV', ['clamp-to-edge', 'repeat', 'mirror-repeat'] as const)
.combine('minFilter', ['nearest', 'linear'] as const)
)
.beforeAllSubcases(t =>
skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format)
)
.beforeAllSubcases(t => {
skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format);
})
.fn(async t => {
const { format, samplePoints, addressModeU, addressModeV, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -253,6 +255,7 @@ Parameters:
minFilter,
offset,
} = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
const descriptor: GPUTextureDescriptor = {
Expand Down Expand Up @@ -448,6 +451,7 @@ Parameters:
)
.fn(async t => {
const { format, samplePoints, A, addressModeU, addressModeV, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -532,6 +536,7 @@ Parameters:
})
.fn(async t => {
const { format, samplePoints, A, addressMode, minFilter } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const viewDimension: GPUTextureViewDimension = 'cube-array';
const size = chooseTextureSize({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
getTextureTypeForTextureViewDimension,
WGSLTextureSampleTest,
isSupportedViewFormatCombo,
skipIfNeedsFilteringAndIsUnfilterable,
} from './texture_utils.js';

const kTestableColorFormats = [...kEncodableTextureFormats, ...kCompressedTextureFormats] as const;
Expand Down Expand Up @@ -72,6 +73,7 @@ Parameters:
)
.fn(async t => {
const { format, samplePoints, addressModeU, addressModeV, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -173,6 +175,7 @@ Parameters:
minFilter,
offset,
} = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
const descriptor: GPUTextureDescriptor = {
Expand Down Expand Up @@ -286,6 +289,7 @@ Parameters:
)
.fn(async t => {
const { format, samplePoints, A, addressModeU, addressModeV, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -378,6 +382,7 @@ Parameters:
})
.fn(async t => {
const { format, samplePoints, A, addressMode, minFilter } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const viewDimension: GPUTextureViewDimension = 'cube-array';
const size = chooseTextureSize({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
kCubeSamplePointMethods,
kSamplePointMethods,
SamplePointMethods,
skipIfNeedsFilteringAndIsUnfilterable,
skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable,
TextureCall,
vec2,
Expand Down Expand Up @@ -73,6 +74,7 @@ Parameters:
)
.fn(async t => {
const { format, stage, samplePoints, addressModeU, addressModeV, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -185,6 +187,7 @@ Parameters:
minFilter,
offset,
} = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const size = chooseTextureSize({ minSize: 8, minBlocks: 2, format, viewDimension });
const descriptor: GPUTextureDescriptor = {
Expand Down Expand Up @@ -310,6 +313,7 @@ Parameters:
.fn(async t => {
const { format, stage, samplePoints, A, addressModeU, addressModeV, minFilter, offset } =
t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -413,6 +417,7 @@ Parameters:
})
.fn(async t => {
const { format, stage, samplePoints, A, addressMode, minFilter } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const viewDimension: GPUTextureViewDimension = 'cube-array';
const size = chooseTextureSize({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Samples a texture.

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import {
isCompressedTextureFormat,
isDepthTextureFormat,
isEncodableTextureFormat,
kCompressedTextureFormats,
Expand All @@ -27,9 +26,11 @@ import {
getDepthOrArrayLayersForViewDimension,
getTextureTypeForTextureViewDimension,
isPotentiallyFilterableAndFillable,
isSupportedViewFormatCombo,
kCubeSamplePointMethods,
kSamplePointMethods,
SamplePointMethods,
skipIfNeedsFilteringAndIsUnfilterable,
skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable,
TextureCall,
vec2,
Expand Down Expand Up @@ -82,6 +83,7 @@ Parameters:
)
.fn(async t => {
const { format, stage, samplePoints, addressModeU, addressModeV, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -186,6 +188,7 @@ Parameters:
.fn(async t => {
const { format, stage, samplePoints, A, addressModeU, addressModeV, minFilter, offset } =
t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
Expand Down Expand Up @@ -280,7 +283,7 @@ Parameters:
.combine('format', kTestableColorFormats)
.filter(t => isPotentiallyFilterableAndFillable(t.format))
.combine('viewDimension', ['3d', 'cube'] as const)
.filter(t => !isCompressedTextureFormat(t.format) || t.viewDimension === 'cube')
.filter(t => isSupportedViewFormatCombo(t.format, t.viewDimension))
.combine('offset', [false, true] as const)
.filter(t => t.viewDimension !== 'cube' || t.offset !== true)
.beginSubcases()
Expand All @@ -294,6 +297,7 @@ Parameters:
)
.fn(async t => {
const { format, viewDimension, stage, samplePoints, addressMode, minFilter, offset } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const [width, height] = chooseTextureSize({ minSize: 32, minBlocks: 2, format, viewDimension });
const depthOrArrayLayers = getDepthOrArrayLayersForViewDimension(viewDimension);
Expand Down Expand Up @@ -414,6 +418,7 @@ Parameters:
})
.fn(async t => {
const { format, stage, samplePoints, A, addressMode, minFilter } = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

const viewDimension: GPUTextureViewDimension = 'cube-array';
const size = chooseTextureSize({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export function isSupportedViewFormatCombo(
format: GPUTextureFormat,
viewDimension: GPUTextureViewDimension
) {
return !(isCompressedTextureFormat(format) && viewDimension === '3d');
return !(
(isCompressedTextureFormat(format) || isDepthTextureFormat(format)) &&
viewDimension === '3d'
);
}

/**
Expand Down Expand Up @@ -114,6 +117,19 @@ export function skipIfNeedsFilteringAndIsUnfilterableOrSelectDevice(
}
}

/**
* Skips a test if filter === 'linear' and the format is not filterable
*/
export function skipIfNeedsFilteringAndIsUnfilterable(
t: GPUTest,
filter: GPUFilterMode,
format: GPUTextureFormat
) {
if (filter === 'linear') {
t.skipIf(isDepthTextureFormat(format), 'depth textures are unfilterable');
}
}

/**
* Returns if a texture format can be filled with random data.
*/
Expand All @@ -127,9 +143,12 @@ export function isFillable(format: GPUTextureFormat) {
* Returns if a texture format can potentially be filtered and can be filled with random data.
*/
export function isPotentiallyFilterableAndFillable(format: GPUTextureFormat) {
const type = kTextureFormatInfo[format].color?.type;
const canPotentiallyFilter = type === 'float' || type === 'unfilterable-float';
return canPotentiallyFilter && isFillable(format);
const info = kTextureFormatInfo[format];
const type = info.color?.type ?? info.depth?.type;
const canPotentiallyFilter =
type === 'float' || type === 'unfilterable-float' || type === 'depth';
const result = canPotentiallyFilter && isFillable(format);
return result;
}

/**
Expand Down

0 comments on commit c087b55

Please sign in to comment.