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

Fix bgra8unorm storage handling #4046

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
2 changes: 1 addition & 1 deletion src/webgpu/api/operation/storage_texture/read_only.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ g.test('basic')
t.selectDeviceOrSkipTestCase('bgra8unorm-storage');
}
if (t.isCompatibility) {
t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format);
t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format, t.device);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not possible because no device has been selected yet.
npm run typecheck will catch this and other issues. I also strongly recommend using VSCode or otherwise having working TypeScript integration so you will see this in your IDE/editor.

Please run the full tests npm test and ensure the test is running as expected in a real browser before sending for review (you can open the PR as a "draft" if needed). In this case npm start to start a server and then open http://localhost:8080/standalone/?compatibility=1&q=webgpu:api,operation,storage_texture,read_only:basic:format=%22bgra8unorm%22;* because you need to test with compatibility=1.

There's no really good general solution to this right now (#3848), but since there is already special logic here to check for bgra8unorm-storage, I think you can simply skip this check when the format is bgra8unorm.

Copy link
Contributor

Choose a reason for hiding this comment

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

I get that the PR is incorrect but it's also not clear what problem it's trying to solve with regards to #3847. The code at line 580 should have already skipped the test if bgra8unorm-storage is not supported.

Copy link
Collaborator

Choose a reason for hiding this comment

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

IIUC the problem is the opposite: if the format is bgra8unorm, then we enable bgra8unorm-storage... but then skipIfTextureFormatNotUsableAsStorageTexture skips the test anyway, because the capability tables say it won't work.

}
})
.fn(t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ g.test('basic')
.unless(p => p.textureDimension === '1d' && p.depthOrArrayLayers > 1)
)
.beforeAllSubcases(t => {
t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format);
t.skipIfTextureFormatNotUsableAsStorageTexture(t.params.format, t.device);
})
.fn(t => {
const { format, shaderStage, textureDimension, depthOrArrayLayers } = t.params;
Expand Down
6 changes: 6 additions & 0 deletions src/webgpu/api/validation/texture/bgra8unorm_storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class BGRA8UnormStorageValidationTests extends ValidationTest {
});
}, !success);
}

skipIfTextureFormatNotUsableAsStorageTexture(format: GPUTextureFormat, device: GPUDevice): void {
if (format === 'bgra8unorm' && !device.features.has('bgra8unorm-storage')) {
this.skip('bgra8unorm-storage feature is not supported');
}
}
}

export const g = makeTestGroup(BGRA8UnormStorageValidationTests);
Expand Down
Loading