src/libANGLE/PixelLocalStorage.cpp


Log

Author Commit Date CI Message
Chris Dalton cc841237 2024-11-29T13:45:50 Accept framebuffer modifications while PLS is active The only way for a WebGL implementation to know if PLS is actually active is to call glGetIntegerv(PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE) (because glBeginPixelLocalStorageANGLE() can fail). So the original behavior of not allowing glBindFramebuffer() et. al. while PLS was active created a state scenario that was expensive for the browser to track. Instead, just allow glBindFramebuffer() et. al., and implicitly disable PLS if they are called while it's active. Bug: angleproject:40096838 Change-Id: Ibd303f9f9950fb5b7f1add2d41882e4379c51e62 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6060301 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 7070a9e9 2024-11-20T00:21:16 Remove draw buffer validation clauses from PLS It was cumbersome to implement all this validation browser side for WebGL. Rather than making it an error to update blend and color mask on reserved PLS draw buffers, glBeginPixelLocalStorageANGLE() can just implicitly disable blend, and enable the color mask on overridden draw buffers. Later calls to enable blend or change the color mask on overridden planes are silently ignored until glEndPixelLocalStorageANGLE(). Bug: angleproject:40096838 Change-Id: Ic7e1c5113e7d3fad3b80d0178075df646540d743 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6045421 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Chris Dalton 966739ac 2024-09-19T23:49:06 Drop PLS support for EXT_shader_pixel_local_storage Supporting this backend drastically increased the complexity of the codebase, with little return. We don't support memoryless attachments on the web anyway, and since this extension requires us to literally draw the load/store operations, input attachments on Vulkan perform better. Once this implemention is completely removed, we will delete the PLS allow list, which isn't required for the other PLS implementations. Bug: angleproject:7279 Change-Id: Ibb036d36cbd33467e7a94398ce171cda7349e4f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5874412 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 5857e0d6 2024-01-22T00:00:00 Metal: Adjust raster order groups AMD workaround condition Ensured that the raster order groups AMD workaround is used not only when there is no attachment on slot 0 but also when an existing attachment on slot 0 is disabled. Bug: angleproject:8263 Change-Id: I62352eb5d6fb1cce4b6a4723d41862c6c213b9d8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5230638 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Alexey Knyazev 42d75c7e 2024-01-17T00:00:00 Metal: Fix raster order group AMD workaround The AMD-specific raster order group workaround relied on disabled framebuffer attachments being implemented via all-disabled color masks. Metal backend no longer includes disabled framebuffer attachments in render pass descriptors. Updated the workaround to keep the placeholder attachment enabled and to set its color mask explicitly. Fixed: angleproject:8263 Change-Id: I815ceede84e6ea89eefc10c445768d9d569d0d82 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5208110 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Igor Nazarov 959ccb96 2023-08-02T13:40:16 Add EGL_BAD_ACCESS validation into ValidateMakeCurrent Current code does not generate EGL_BAD_ACCESS in `eglMakeCurrent()` according to the specification: - If context is current to some other thread, or if either draw or read are bound to contexts in another thread, an EGL_BAD_ACCESS error is generated. Additional changes: - replace `Context::getRefCount()` with `isReferenced()` for consistency with added `Surface::isReferenced()` method. - remove duplicate `ValidateSurface` call for the `drawSurface` in case if `readSurface` is the same. - remove duplicate `ValidateCompatibleSurface()` call for the `readSurface` in case if `drawSurface` is different. - Fix EGLContextASANTest.DestroyContextInUse test. - Fix EGLContextSharingTestNoSyncTextureUploads.NoSync test. Bug: angleproject:8282 Change-Id: I2af0d7f50019c2445b42279bdd0e0197dd8ad20f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4742382 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Shahbaz Youssefi 9962f078 2023-07-11T15:39:50 Pass only context-private state to private entry points This change ensures that the implementation for these entry points cannot access anything other than context-private state. Bug: angleproject:8224 Change-Id: I988672b138d861db25e91d71ab8c34baa4e8ebee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678783 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 40111c68 2023-07-11T14:21:21 Rename context-local to context-private state Bug: angleproject:8224 Change-Id: I1bb39475043f8fb14d683d11a038b4850692a8c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678781 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 44395930 2023-07-05T11:59:23 Make various state setting entry points lockless These entry points only set context-local state and thus don't require locking. Bug: angleproject:8224 Change-Id: I428c23cc862e9356d571bc085b5df0bf48017175 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4661700 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9daac2b7 2023-07-05T11:36:46 Make glEnable/Disable entry points lockless These entry points only set context-local state and thus don't require locking. Bug: angleproject:8224 Change-Id: Id4eab729115bd75f82e1ec7a27355c821a7c4320 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4661697 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi be41fe29 2023-07-04T15:35:46 Make glColor/DepthMask entry points lockless These entry points only set state that is entirely accessed by the owning context (context-local) and thus don't require locking. glColorMask* functions also affect the cached context state (in particular draw validity), so the relevant cached state is also modified to support being locklessly modified. Bug: angleproject:8224 Change-Id: I221b4efa25fc1c11419d1ac942f1c37e59ec92c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4658173 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 7d4c6d1d 2023-05-09T12:19:54 Allow glDelete* while PLS is active Banning glDelete* is extremely dangerous. It will almost definitely cause memory leaks in client code, and it makes JS garbage collection needlessly complex. Instead, specify that PLS is implicity deactivated if the client deletes anything that is attached to the current draw framebuffer during a PLS rendering pass. Bug: chromium:1421437 Change-Id: I3a18ee6b5d5567431e6fa3eccea58cb049845502 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4521436 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 45f91a8c 2023-05-08T13:11:44 Deinitialize PLS planes when their texture is deleted The spec originally called for PLS planes to be converted to memoryless when their texture was deleted, but this is not compatible with WebGL, which does not support memoryless planes. Change the behavior to deinitialize them instead. This change requires the addition of a new observer message, angle::SubjectMessage::TextureIDDeleted, which PLS uses to deinitialize a plane when the app deletes its texture. Bug: chromium:1421437 Change-Id: I58fd91003747160f0a1abc1a8a7a87668890ba1f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4518565 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 1e166daf 2023-04-10T23:49:46 Finalize PLS support for non-2D texture types Commit to supporting GL_TEXTURE_2D_ARRAY and GL_TEXTURE_3D, and add tests. Suppress D3D11 and Metal for now, since shader image support for non-2D types needs some work on those backends. Drop support for cube maps, since those will cause complications on an implementation based on texelFetch. Bug: chromium:1421437 Bug: angleproject:8124 Bug: angleproject:8125 Change-Id: I403ae157b7d2609f2190a98c2576c92f73441412 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4415150 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton a491bbe3 2023-03-18T19:05:08 Add PLS utilities for interrupting a rendering pass Adds two more simple commands to ANGLE_shader_pixel_local_storage that allow WebGL and the command buffer to interrupt rendering passes without having to either (1) make expensive queries, or (2) track lots of complex state for validation that they are not currently equipped to track. Bug: chromium:1421437 Change-Id: I80eaef3ae6b0b4bbbecb9cd2268ac90b43675d1c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4355032 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
Chris Dalton 513ca723 2023-03-13T14:30:20 Delete GL_LOAD_OP_DISABLE_ANGLE from PLS This load op makes the PLS spec and WebGL implementations unnecessarily complex. Bug: chromium:1421437 Change-Id: Iab02a8b02083899c6cc345ecb25b88c5871611c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4335148 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton eb1a13d8 2022-12-06T21:56:42 Improve PLS load and store op tokens Define more new tokens that are more clearly named, as opposed to recycling tokens that were meant for a different purpose. Bug: angleproject:7279 Change-Id: I840e5ea168235c49eec2693b2231c2d329027b0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4082057 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 9bd9c1c2 2022-11-03T11:49:33 Workaround for AMD [[raster_order_group()]] bug Metal [[raster_order_group()]] does not work for read_write textures on AMD when the render pass doesn't have a color attachment on slot 0. To work around this we attach one of the PLS textures to GL_COLOR_ATTACHMENT0, if there isn't one already. Bug: angleproject:7792 Bug: angleproject:7803 Bug: angleproject:7818 Change-Id: I7567ed28ed30c7e3ca23dc52778ed90f2fdff965 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4004529 Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 8ee1b89f 2022-11-04T13:10:37 Refactor pixel local storage options The various different PLS options were getting scattered and unruly. We are also in need of more backend-specific PLS options that would be difficult to add as-is. This CL refactors them into a single "ShPixelLocalStorageOptions" struct that gets initialized all in one place, and shared between the compiler and the backends. Bug: angleproject:7279 Change-Id: Ic58dccb8d1ba350a0b6cc5848ce15bd687e30fad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4006715 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 9bda9a79 2022-10-22T22:05:11 Add Store Ops to pixel local storage Browsers will need the ability to pre-empt pixel local storage, which means every plane will need a backing store to dump to. Store Ops allow the app to still avoid memory transactions at the end of PLS even if their plane has a backing texture. Bug: angleproject:7279 Change-Id: I3a3efa21773f87c03cd346a996e3c638028c68ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3974652 Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 3605b399 2022-10-20T17:00:02 Move PLS clear values back into context state The API that required packing raw data into a buffer was un-ergonomic for developers and difficult to implement for WebGL vendors. Bug: angleproject:7279 Change-Id: If7c98908c285462c5775e8e2d8811883be139f64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3972376 Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 5e95a4d9 2022-10-07T00:52:38 Add an EXT_shader_pixel_local_storage impl of PLS Translates ANGLE_shader_pixel_local_storage shaders directly to EXT_shader_pixel_local_storage. Polyfills load/store operations using internal fullscreen draws. Since the ANGLE extension needs the ability to preserve all active PLS planes to textures, we can only support this extension when the backend context also has access to ES 3.1 shader images. Bug: angleproject:7279 Bug: angleproject:7771 Change-Id: Id348bde412efcc081ff29ee05ec59ad652f77569 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3966075 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 9f693aa3 2022-10-22T14:45:59 Implement an allow list for PLS In order to guarantee no data is lost while using the EXT_shader_pixel_local_storage extension, we need to restrict applications to a small subset of commands while pixel local storage is active. This CL implements the allow list for GL entrypoints using wildcard matching inside the code generator, and adds custom validation for the more specific restrictions that go into effect when PLS is active. Bug: angleproject:7279 Change-Id: I5dd48bd93c10e8775f32be32a4fcf17855eb2f0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3932552 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton a7dc51f2 2022-10-01T08:49:11 Add a framebuffer fetch implementation of PLS The framebuffer fetch implementation works by attaching PLS backing textures to the framebuffer, and then rewriting PLS uniforms as "inout" fragment variables. The compiler's existing machinery takes it from there and makes it work on GL and Vulkan, and soon Metal. EXT_shader_framebuffer_fetch is now the preferred backend for pixel local storage, but we also use EXT_shader_framebuffer_fetch_non_coherent if shader images can't be coherent. This is especially interesting for Vulkan, since noncoherent framebuffer fetch is possible without any extensions. Bug: angleproject:7279 Bug: angleproject:7683 Bug: angleproject:7684 Bug: angleproject:7724 Change-Id: I33f3b2c6df9a5709969d9165c448ea71b096c9e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3900142 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 8b2aff28 2022-09-12T10:27:28 Implement the ANGLE_shader_pixel_local_storage API Implements the OpenGL ES API for ANGLE_shader_pixel_local_storage and adds thorough validation and testing as outlined in the spec. This feature is still implemented entirely in the frontend, but the extension now works end-to-end with a passing test suite, and can be used externally. Over time we can start gradually moving the implementation into backends as appropriate. Bug: angleproject:7279 Bug: angleproject:7647 Change-Id: I1c861a0fca96423be02e17bbe1fb7f57b99ea63f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3886462 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>