Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor api/validation/texture/* #4282

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/webgpu/api/validation/texture/bgra8unorm_storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { assert } from '../../../../common/util/util.js';
import { kTextureUsages } from '../../../capability_info.js';
import { GPUConst } from '../../../constants.js';
import { kAllCanvasTypes, createCanvas } from '../../../util/create_elements.js';
import { ValidationTest } from '../validation_test.js';
import { UniqueFeaturesAndLimitsValidationTest } from '../validation_test.js';

class BGRA8UnormStorageValidationTests extends ValidationTest {
class BGRA8UnormStorageValidationTests extends UniqueFeaturesAndLimitsValidationTest {
testCreateShaderModuleWithBGRA8UnormStorage(
shaderType: 'fragment' | 'compute',
success: boolean
Expand Down Expand Up @@ -126,7 +126,12 @@ with 'bgra8unorm-storage' enabled.
`
)
.beforeAllSubcases(t => {
t.selectDeviceOrSkipTestCase('bgra8unorm-storage');
t.selectDeviceOrSkipTestCase({
requiredFeatures: ['bgra8unorm-storage'],
requiredLimits: {
maxStorageTexturesInFragmentStage: 1,
},
});
})
.params(u =>
u
Expand Down
10 changes: 5 additions & 5 deletions src/webgpu/api/validation/texture/destroy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Destroying a texture more than once is allowed.

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { kTextureAspects } from '../../../capability_info.js';
import { kTextureFormatInfo } from '../../../format_info.js';
import { ValidationTest } from '../validation_test.js';
import { isDepthTextureFormat, isStencilTextureFormat } from '../../../format_info.js';
import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js';

export const g = makeTestGroup(ValidationTest);
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);

g.test('base')
.desc(`Test that it is valid to destroy a texture.`)
Expand Down Expand Up @@ -104,12 +104,12 @@ that was destroyed {before, after} encoding finishes.
const depthStencilAttachment: GPURenderPassDepthStencilAttachment = {
view: depthStencilTexture.createView({ aspect: depthStencilTextureAspect }),
};
if (kTextureFormatInfo[depthStencilTextureFormat].depth) {
if (isDepthTextureFormat(depthStencilTextureFormat)) {
depthStencilAttachment.depthClearValue = 0;
depthStencilAttachment.depthLoadOp = 'clear';
depthStencilAttachment.depthStoreOp = 'discard';
}
if (kTextureFormatInfo[depthStencilTextureFormat].stencil) {
if (isStencilTextureFormat(depthStencilTextureFormat)) {
depthStencilAttachment.stencilClearValue = 0;
depthStencilAttachment.stencilLoadOp = 'clear';
depthStencilAttachment.stencilStoreOp = 'discard';
Expand Down
4 changes: 2 additions & 2 deletions src/webgpu/api/validation/texture/float32_filterable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Tests for capabilities added by float32-filterable flag.

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { kTextureSampleTypes } from '../../../capability_info.js';
import { ValidationTest } from '../validation_test.js';
import { UniqueFeaturesAndLimitsValidationTest } from '../validation_test.js';

export const g = makeTestGroup(ValidationTest);
export const g = makeTestGroup(UniqueFeaturesAndLimitsValidationTest);

const kFloat32Formats: GPUTextureFormat[] = ['r32float', 'rg32float', 'rgba32float'];

Expand Down
24 changes: 7 additions & 17 deletions src/webgpu/api/validation/texture/rg11b10ufloat_renderable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Tests for capabilities added by rg11b10ufloat-renderable flag.

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { GPUConst } from '../../../constants.js';
import { ValidationTest } from '../validation_test.js';
import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js';

export const g = makeTestGroup(ValidationTest);
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);

g.test('create_texture')
.desc(
Expand All @@ -17,10 +17,8 @@ Note, the createTexture tests cover these validation cases where this feature is
`
)
.params(u => u.combine('sampleCount', [1, 4]))
.beforeAllSubcases(t => {
t.selectDeviceOrSkipTestCase('rg11b10ufloat-renderable');
})
.fn(t => {
t.skipIfDeviceDoesNotHaveFeature('rg11b10ufloat-renderable');
const { sampleCount } = t.params;
const descriptor = {
size: [1, 1, 1],
Expand All @@ -38,10 +36,8 @@ Test that it is valid to begin render pass with rg11b10ufloat texture format
iff rg11b10ufloat-renderable feature is enabled. Single sampled case.
`
)
.beforeAllSubcases(t => {
t.selectDeviceOrSkipTestCase('rg11b10ufloat-renderable');
})
.fn(t => {
t.skipIfDeviceDoesNotHaveFeature('rg11b10ufloat-renderable');
const texture = t.createTextureTracked({
size: [1, 1, 1],
format: 'rg11b10ufloat',
Expand Down Expand Up @@ -70,10 +66,8 @@ Test that it is valid to begin render pass with rg11b10ufloat texture format
iff rg11b10ufloat-renderable feature is enabled. MSAA and resolve case.
`
)
.beforeAllSubcases(t => {
t.selectDeviceOrSkipTestCase('rg11b10ufloat-renderable');
})
.fn(t => {
t.skipIfDeviceDoesNotHaveFeature('rg11b10ufloat-renderable');
const renderTexture = t.createTextureTracked({
size: [1, 1, 1],
format: 'rg11b10ufloat',
Expand Down Expand Up @@ -109,10 +103,8 @@ Test that it is valid to begin render bundle encoder with rg11b10ufloat texture
format iff rg11b10ufloat-renderable feature is enabled.
`
)
.beforeAllSubcases(t => {
t.selectDeviceOrSkipTestCase('rg11b10ufloat-renderable');
})
.fn(t => {
t.skipIfDeviceDoesNotHaveFeature('rg11b10ufloat-renderable');
t.device.createRenderBundleEncoder({
colorFormats: ['rg11b10ufloat'],
});
Expand All @@ -125,10 +117,8 @@ Test that it is valid to create render pipeline with rg11b10ufloat texture forma
in descriptor.fragment.targets iff rg11b10ufloat-renderable feature is enabled.
`
)
.beforeAllSubcases(t => {
t.selectDeviceOrSkipTestCase('rg11b10ufloat-renderable');
})
.fn(t => {
t.skipIfDeviceDoesNotHaveFeature('rg11b10ufloat-renderable');
t.device.createRenderPipeline({
layout: 'auto',
vertex: {
Expand Down