Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ Validation tests for the readonly_and_readwrite_storage_textures language featur
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { kPossibleStorageTextureFormats } from '../../../format_info.js';
import {
getRequiredFeatureForTextureFormat,
kPossibleStorageTextureFormats,
} from '../../../format_info.js';
import { ShaderValidationTest } from '../shader_validation_test.js';

export const g = makeTestGroup(ShaderValidationTest);
Expand All @@ -28,6 +31,11 @@ g.test('var_decl')
.fn(t => {
const { type, format, access } = t.params;

const requiredFeature = getRequiredFeatureForTextureFormat(format);
if (requiredFeature) {
t.skipIfDeviceDoesNotHaveFeature(requiredFeature);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm........ in theory, the correct thing to do here would be to check wgslLanguageFeatures and not the device features. Because:

  1. It's not just the new formats that should be skipped when the browser doesn't have support, it's also the existing formats that were newly-added to WGSL.
  2. We should be running this test if the browser (compiler) supports the format, even if the device doesn't.

But we didn't add a wgsl language feature! Filed gpuweb/gpuweb#5524

}

const source = `@group(0) @binding(0) var t : ${type}<${format}, ${access}>;`;
const requiresFeature = access !== 'write';
t.expectCompileResult(t.hasLanguageFeature(kFeatureName) || !requiresFeature, source);
Expand Down