Skip to content

Commit

Permalink
address comments and fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 17, 2024
1 parent f548492 commit 9ab4797
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ Parameters:
t.selectDeviceOrSkipTestCase(info.feature);
})
.fn(t => {
t.skipIfNoStorageTexturesInStage(t.params.stage);

const values = testValues(t.params);
const texture = t.createTextureTracked({
size: values.size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function skipIfStorageTexturesNotSupportedInStage(t: GPUTest, stage: ShortShader
);
t.skipIf(
stage === 'v' && !(t.device.limits.maxStorageTexturesInVertexStage! > 0),
'device does not support storage textures in fragment shaders'
'device does not support storage textures in vertex shaders'
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ Parameters
.fn(t => {
const { stage, format, access_mode, view_type } = t.params;

t.skipIfNoStorageTexturesInStage(stage);

const texture = t.createTextureTracked({
format,
usage: GPUTextureUsage.STORAGE_BINDING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Returns the number of mip levels of a texture.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { MaxLimitsTestMixin } from '../../../../../gpu_test.js';
import { getTextureDimensionFromView } from '../../../../../util/texture/base.js';
import { kShaderStages } from '../../../../validation/decl/util.js';

Expand Down Expand Up @@ -38,7 +37,7 @@ const kTextureTypeToViewDimension = {
texture_depth_cube_array: 'cube-array',
} as const;

export const g = makeTestGroup(MaxLimitsTestMixin(WGSLTextureQueryTest));
export const g = makeTestGroup(WGSLTextureQueryTest);

g.test('sampled')
.specURL('https://www.w3.org/TR/WGSL/#texturenumlevels')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ Returns the number samples per texel in a multisampled texture.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { MaxLimitsTestMixin } from '../../../../../gpu_test.js';
import { kShaderStages } from '../../../../validation/decl/util.js';

import { kSampleTypeInfo, WGSLTextureQueryTest } from './texture_utils.js';

export const g = makeTestGroup(MaxLimitsTestMixin(WGSLTextureQueryTest));
export const g = makeTestGroup(WGSLTextureQueryTest);

g.test('sampled')
.specURL('https://www.w3.org/TR/WGSL/#texturenumsamples')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,25 +787,27 @@ function getWeightForMipLevel(
* Used for textureNumSamples, textureNumLevels, textureNumLayers, textureDimension
*/
export class WGSLTextureQueryTest extends GPUTest {
executeAndExpectResult(
stage: ShaderStage,
code: string,
texture: GPUTexture | GPUExternalTexture,
viewDescriptor: GPUTextureViewDescriptor | undefined,
expected: number[]
) {
const { device } = this;

skipIfNoStorageTexturesInStage(stage: ShaderStage) {
if (this.isCompatibility) {
this.skipIf(
stage === 'fragment' && !(this.device.limits.maxStorageTexturesInFragmentStage! > 0),
'device does not support storage textures in fragment shaders'
);
this.skipIf(
stage === 'vertex' && !(this.device.limits.maxStorageTexturesInVertexStage! > 0),
'device does not support storage textures in fragment shaders'
'device does not support storage textures in vertex shaders'
);
}
}

executeAndExpectResult(
stage: ShaderStage,
code: string,
texture: GPUTexture | GPUExternalTexture,
viewDescriptor: GPUTextureViewDescriptor | undefined,
expected: number[]
) {
const { device } = this;

const returnType = `vec4<u32>`;
const castWGSL = `${returnType}(getValue()${range(4 - expected.length, () => ', 0').join('')})`;
Expand Down

0 comments on commit 9ab4797

Please sign in to comment.