Conversation
Implements the WebGPU texture-compression-unaligned feature (gpuweb/gpuweb#6312), which allows creating block-compressed textures whose size is not a multiple of the texel block dimensions, i.e. textures with partial edge blocks in mip level 0. Copy validation needs no changes: it already validates against the physical (rounded-up) subresource size, which handles partial edge blocks at any mip level. The feature is supported unconditionally on the Vulkan, Metal and GLES backends. On DX12 it is exposed only when UnalignedBlockTexturesSupported is true in D3D12_FEATURE_DATA_D3D12_OPTIONS8.
198a701 to
4e936c8
Compare
|
Looking into this error: I'm adding the |
|
Looks like the GLES backend does not implement compressed texture to buffer copies. Looks like the I'll do the same in this case. |
|
The WebGL failure is to be expected, I'll correct that. The BC extensions in WebGL all have the alignment constraint, because WebGL is often implemented on top of D3D11/12, so I'll stop advertising the feature on non-native GL implementations. This is unfortunate, because in WebGL the constraint only applies to BC formats, not to ASTC/ETC, but there's no way to express that in WebGPU. |
| /// | ||
| /// This is a web and native feature. | ||
| #[name("texture-compression-unaligned")] | ||
| const TEXTURE_COMPRESSION_UNALIGNED = WEBGPU_FEATURE_TEXTURE_COMPRESSION_UNALIGNED; |
There was a problem hiding this comment.
Could you also wire this up in the browser WebGPU backend? FEATURES_MAPPING in wgpu/src/backend/webgpu.rs and in in wgpu/src/backend/webgpu/webgpu_sys/gen_GpuFeatureName.rs
Implements the WebGPU
texture-compression-unalignedfeature (gpuweb/gpuweb#6312), which allows creating block-compressed textures whose size is not a multiple of the texel block dimensions, i.e. textures with partial edge blocks in mip level 0.The feature is supported unconditionally on the Vulkan, Metal and GLES backends. On DX12 it is exposed only when UnalignedBlockTexturesSupported is true in D3D12_FEATURE_DATA_D3D12_OPTIONS8.
Copy validation needs no changes: it already validates against the physical (rounded-up) subresource size, which handles partial edge blocks at any mip level.
This feature has already landed in dawn/chromium and the implementation here mirrors it closely: https://issues.chromium.org/issues/528245806
Connections
Spec: gpuweb/gpuweb#6312
CTS: gpuweb/cts#4676
Discussion: gpuweb/gpuweb#2006
Description
It implements the
texture-compression-unalignedWebGPU feature.Testing
I've run the CTS in macOS under Metal (
cargo xtask cts --backend metal) and all tests pass. I thinktest.lstalready includes the new unaligned-compression test, but I also specifically confirmed that the tests that were added or changed in gpuweb/cts#4676 all pass:I haven't run the tests on other platforms. I'm hoping CI coverage will do that, but if not, I can look into testing on Windows.
I also added three new tests to
texture_compression_unaligned.rswhich cover some of the same ground as the CTS tests:I tested with:
cargo test -p wgpu-test --test wgpu-gpu -- texture_compression_unaligned --test-threads=1And all tests pass in Metal, MoltenVK and KosmicKrisp.
Checklist
CHANGELOG.mdentries for the user-facing effects of this change are present.wgpumay be affected behaviorally.