src/libANGLE/renderer/wgpu/wgpu_helpers.cpp


Log

Author Commit Date CI Message
Geoff Lang c94c37c1 2024-09-23T17:22:27 WebGPU: Skip ReadPixels if texture creation failed If texture creation failed due to an unsupported format, ReadPixels would crash calling a null conversion function. Mark this case as UNIMPLEMENTED for now. Bug: angleproject:42266974 Change-Id: Ifa34d9db3d0d14e8e382c2323b4e70d2b1a7d2a9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5889090 Reviewed-by: Liza Burakova <liza@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Liza Burakova ca2e588b 2024-09-12T14:20:33 WebGPU: Add support for depth/stencil clears This CL also adds helper methods to create webgpu depth/stencil attachments for a render pass descriptor, as well as depth/stencil attachment images. Bug: angleproject:42267012 Change-Id: Iebef99ba34db2e50f56449d0737b3dbb03b90f2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5750001 Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Liza Burakova 3e4fa128 2024-08-05T16:20:30 Store ImageHelper's queue by mip levels. This change converts ImageHelper's mSubresourceQueue to store a vector of updates for each mip level. This allows updates to be flushed per mip level. This also adds a call in the RenderTargetWgpu to flush updates such that now when a framebuffer is flushing updates to color attachments the associated render target ensures that only updates associated with its mip level are flushed. Bug: angleproject:42267012 Change-Id: I1abdbc842cf18b1bd897037bf11aeea9c6d09e14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5759469 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Geoff Lang cab7d1b6 2024-07-30T21:19:15 WebGPU: Obey buffer alignment rules WebGPU buffers require a size aligned to 4 bytes and map buffer offsets aligned to 8 bytes. Hide this requirement in The BufferHelper class by doing the apropriate offsets during buffer creation and map calls. This allows many dEQP tests to run without crashing due to WebGPU buffer creation errors. Bug: angleproject:356399840 Bug: angleproject:42267091 Change-Id: Id71c3b5db31aa712d5a88631efa4897d6205a41d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5748443 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 641bc04a 2024-07-30T21:25:44 WebGPU: Use the correct source format for ReadPixels ReadPixels was using the format of the destination buffer which works correctly for RGBA8 -> RGBA/UNSIGNED_BYTE but runs the wrong conversion functions for other formats. Bug: angleproject:356399840 Bug: angleproject:42267090 Change-Id: I7c46add3f643017f454136135afef697847a2383 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5748446 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 1953c606 2024-07-30T21:28:13 WebGPU: Fix ReadPixels from window surfaces. The intended/actual formats were not initialized in this code path and the created swap chain texture did not have the usage flags needed for copying to a buffer for ReadPixels. Bug: angleproject:356399840 Bug: angleproject:42267090 Change-Id: I8e4279eedb2b23f0d2ed690ccee086ae115969c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5748447 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Liza Burakova 4f498eaa 2024-07-24T14:31:23 WebGPU: Add more format support This CL adds a new FormatTable class that initializes webgpu texture and vertex formats. It also adds this class to the display so it can be used in the ImageHelper. This CL changes the previously hardcoded RGBA8 texture format that was initially used when creating textures to use the format passed into the methods. Bug: angleproject:344814096 Change-Id: I768b85335329116496dbf721aac54d1137aaae9f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5660397 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Geoff Lang 85e2e6a9 2024-05-08T12:31:37 WebGPU: Add Window and Pbuffer surfaces. Bug: angleproject:342213844 Change-Id: I58465bdf895b4bab63ec3c74e326c6be4827bf60 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5525974 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Liza Burakova 657c8c0a 2024-06-04T15:16:20 Add optimization to defer clear calls. This change adds a new SubresourceUpdate struct that will hold either an update for a clear call or a texture upload in an ImageHelper's update queue. It also adds logic to defer clear calls similar to Vulkan's, where clears are deferred if there is not an active render pass. Draw based clears are not yet supported, so the optimization does not handle those yet. Bug: angleproject:8582 Change-Id: I3ee010fa64745871835d53ce0ccb56e3fdd74550 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5554984 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Liza Burakova 36cd4c1f 2024-05-08T12:27:22 Adding basic readPixels. This change adds to methods in ImageHelper to read texture data. It also implements FramebufferWgpu::readPixels to get the parameters and read the texture data from an ImageHelper that's stored in mRenderTargetCache. Bug: angleproject:8653 Change-Id: I349ed8a0ae3d8d0e187c658f3402c4f8cac23eb8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5441353 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Liza Burakova 1d0ef518 2024-05-07T16:56:43 Fixing glClear tests. This CL makes a few changes to fix up the basic glClear test RGBA8Framebuffer, as well as adding a test that uploads a texture before clearing a RGBA8 framebuffer. It moves the wgpu::RenderPassDescriptor(RPD), as well as helper methods for comparing RPDs from the context to the framebuffer. The color attachments that are created in when FramebufferWgpu::clear is called are also stored in the framebuffer now as well. This CL also changes texture creation to use the RGBA8Unorm format instead of RGBA8Uint format. It also adds the wgpu viewFormats parameter to an ImageHelper. Future formats support is still TBD. Bug: angleproject:8582 Change-Id: Idfc4182eb4d6de8a771f2f91d337564ee71df010 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5503549 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Liza Burakova ead98ed9 2024-05-02T14:04:14 Implement basic texture upload. This change modifies ImageHelper's methods to upload textures to fix webgpu API calls, as well as fully implements uploading texture data via TextureWgpu::setImage for RGBA8 formats. Bug: angleproject:8457 Change-Id: I1c5be3d79ad996a709086ca7157cca6229a336ce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5398002 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang f4485224 2024-04-05T10:29:23 WebGPU: Implement glBufferData and glBufferSubData Define several usages for WebGPU buffers that map to wgpu buffer usage flags. Maintain a set of buffers by usage and a serial of the one with the most recent data. Defer creation of the buffer as long as possible to take advantage of the WebGPU mapAtCreation flag for data upload. If we ever have to unmap these buffers, staging buffers must be used to upload afterwards. Add some helpers for getting Device and Instance from a gl::Context. Bug: angleproject:8654 Change-Id: Ibb8147119af8a98738fc4d579830a02ccaa1d7c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5426813 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Liza Burakova 0add1163 2024-03-25T11:39:41 Move extent and dimension conversions to wgpu_utils. This change moves some helper methods out of the ImageHelper and wgpu_helpers and into wgpu_utils. Bug: angleproject:8457 Change-Id: I1cc641e4a48eec30519e331b6150e2432d3bc3c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5392380 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Matthew Denton 1bd82319 2024-03-22T05:00:11 Add RenderTargetWgpu Based on RenderTargetMtl without any multisampling support for now. Bug: angleproject:8582 Change-Id: I4c77e747b341f08a0dd88f507e6d805d34a01d24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5386899 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Liza Burakova 6c379733 2024-03-21T14:25:52 Add more helper methods for textures. This change adds a DisplayWgpu member variable to ContextWgpu as well as a getter for the display so other objects can access a webgpu device. This change also adds helper methods to translate GL texture information (size, dimension, mip level count, etc.) to webgpu compatible texture information. Bug: angleproject:8547 Change-Id: Ifb2c5d021b1cbb95304a732c57d3250f1731496b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5385574 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>
Liza Burakova 6eaaad7c 2024-02-27T21:24:59 Create ImageHelper. This CL adds a helper class ImageHelper, which acts as a wrapper on webgpu textures that will be used by TextureWgpu. Bug: angleproject:8547 Change-Id: Ia796534c9d3ff0dd24797cc483677cfcbedb1f8c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5317864 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org>