mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 03:41:34 +00:00
This CL does the following: * Adds a "transient attachment" bit to texture usage. This bit specifies that the created texture will be used only during this render pass. * Adds a TransientAttachments Feature that gates the usage of transient attachments. * Adds support for transient attachments on Metal, where they're used to create textures as memoryless. * Adds validation tests and an E2T test of the feature. A followup CL will add support in Vulkan. Bug: dawn:1695 Change-Id: I3c7322dd1e4bee113062aae2e0494d292ee8cbc3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129080 Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
25 lines
841 B
Markdown
25 lines
841 B
Markdown
# Transient Attachments
|
|
|
|
The `transient-attachments` feature allows creation of attachments that allow
|
|
render pass operations to stay in tile memory, avoiding VRAM traffic and
|
|
potentially avoiding VRAM allocation for the textures.
|
|
|
|
Example Usage:
|
|
```
|
|
wgpu::TextureDescriptor desc;
|
|
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
|
desc.size = {1, 1, 1};
|
|
desc.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TransientAttachment;
|
|
|
|
auto transientTexture = device.CreateTexture(&desc);
|
|
|
|
// Can now create views from the texture to serve as transient attachments, e.g.
|
|
// as color attachments in a render pipeline.
|
|
```
|
|
|
|
Notes:
|
|
- Only supported usage is wgpu::TextureUsage::RenderAttachment |
|
|
wgpu::TextureUsage::TransientAttachment
|
|
- It is not possible to load from or store to TextureViews that are used as
|
|
transient attachments
|