Skip to content

Conversation

@joeleaver
Copy link

@joeleaver joeleaver commented Jan 21, 2026

Summary

This PR forces storage texture support for Rgba8Unorm, Rgba8Snorm, and Bgra8Unorm formats on DX12. These formats are widely supported for UAV typed store on modern GPUs, but DX12's D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE query may not report this correctly.

This is needed for GPU-accelerated 2D rendering libraries like Vello to work with transparent windows using DirectComposition on Windows.

Changes

Single change in instance.rs: Force STORAGE_BINDING support for the three common 8-bit RGBA formats after the standard capability detection.

Background

When using Vello with DirectComposition for transparent windows on Windows:

  1. DX12 backend is required (for WGPU_DX12_PRESENTATION_SYSTEM=DxgiFromVisual)
  2. Vello's compute shaders need STORAGE_BINDING on Rgba8Unorm textures
  3. Modern GPUs support this, but the DX12 format query may not report it correctly

The error without this patch:

The adapter does not support write access for storage textures of format Rgba8Unorm

Testing

  • Tested on Windows 11 with NVIDIA RTX 3070 Ti
  • Vello successfully renders to transparent DirectComposition windows
  • No validation errors from wgpu

Revision Notes

Based on @DJMcNab's feedback, I've simplified this PR to only include the instance.rs change. The other changes (to device/resource.rs and present.rs) were not necessary since Vello renders to an intermediate texture, not directly to the swapchain.

🤖 Generated with Claude Code

joeleaver added a commit to joeleaver/rinch that referenced this pull request Jan 21, 2026
Features:
- Transparent frameless windows on Windows (DX12 + DirectComposition)
- Window control functions: minimize_current_window(), toggle_maximize_current_window(), close_current_window()
- Custom TransparentWindowRenderer using intermediate texture for Vello
- WS_EX_NOREDIRECTIONBITMAP support via winit

Technical:
- Uses patched wgpu-fork for Rgba8Unorm storage texture support
- Intermediate render texture approach (swapchain doesn't support STORAGE_BINDING)
- Event-based window control with window_id tracking

Documentation:
- Updated README with transparent windows section
- Updated CLAUDE.md with technical details
- Updated windows.md guide

Requires: https://github.com/joeleaver/wgpu-fork (rinch-patch branch)
Upstream PR: gfx-rs/wgpu#8908

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@inner-daemons inner-daemons self-requested a review January 21, 2026 16:18
@inner-daemons
Copy link
Collaborator

Thanks for the AI disclaimer at the top lmao, very much appreciated

@cwfitzgerald cwfitzgerald changed the title dx12: Enable Rgba8Unorm storage textures for Vello/DirectComposition transparency dx12: Enable Rgba8Unorm storage textures for DirectComposition transparency Jan 21, 2026
@DJMcNab
Copy link
Collaborator

DJMcNab commented Jan 21, 2026

So to clarify, are you unable to get Vello's with_winit example to run on your device (with the given environment variable value)? I can see how the change in instance.rs could plausibly fix that, if, as you claim, that the underlying adapter misreports that you cannot write to any storage textures with that backend.

I'm less convinced that the other changes should have an impact here, given that you're not trying to use Vello to directly target a render target (as Vello's docs tell you not to, and indeed a scan of your code confirms isn't happening).

@inner-daemons inner-daemons removed their request for review January 21, 2026 18:46
Force STORAGE_BINDING support for Rgba8Unorm, Rgba8Snorm, and Bgra8Unorm
formats. These formats are widely supported for UAV typed store on modern
GPUs, but DX12's D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE query may not report
this correctly.

This is needed for GPU-accelerated 2D rendering libraries like Vello to work
with transparent windows using DirectComposition on Windows.

Tested on Windows 11 with NVIDIA RTX 3070 Ti - Vello successfully renders
to transparent DirectComposition windows with this patch.

See: gfx-rs#8670
@joeleaver
Copy link
Author

@DJMcNab You were right! I tested with only the instance.rs change and transparent windows work correctly. I've simplified this PR to remove the other changes (device/resource.rs and present.rs) since they weren't needed.

To answer your question: yes, I can confirm Vello's with_winit example runs on my device. The issue was specifically with transparent windows via DirectComposition, where Vello renders to an intermediate texture (as you noted from the docs). The instance.rs change enables the storage texture capability that Vello's compute shaders need.

Thanks for the review guidance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants