Austin Eng | 0eff598 | 2021-07-27 19:59:58 +0000 | [diff] [blame] | 1 | # Dawn Internal Usages |
| 2 | |
François Beaufort | 3f689a4 | 2021-10-04 11:30:02 +0000 | [diff] [blame] | 3 | The `dawn-internal-usages` feature allows adding additional usage which affects how a texture is allocated, but does not affect frontend validation. |
Austin Eng | 0eff598 | 2021-07-27 19:59:58 +0000 | [diff] [blame] | 4 | |
| 5 | One use case for this is so that Chromium can use an internal copyTextureToTexture command to implement copies from a WebGPU texture-backed canvas to other Web platform primitives when the swapchain texture was not explicitly created with CopySrc usage in Javascript. |
| 6 | |
| 7 | ``` |
| 8 | Usage: |
| 9 | |
| 10 | wgpu::DawnTextureInternalUsageDescriptor internalDesc = {}; |
| 11 | internalDesc.internalUsage = wgpu::TextureUsage::CopySrc; |
| 12 | |
| 13 | wgpu::TextureDescriptor desc = {}; |
| 14 | // set properties of desc. |
| 15 | desc.nextInChain = &internalDesc; |
| 16 | |
| 17 | device.createTexture(&desc); |
| 18 | ``` |