src/libANGLE/Observer.h


Log

Author Commit Date CI Message
SeongHwan Park 16a61bbb 2021-08-05T23:06:22 D3D: Fix not notifying RenderTarget release in TextureD3D This could lead to use-after-free for the RenderTarget object. Bug: chromium:1234829 Change-Id: I73d4547b8f09f2f2cf3f7f8394f7f573fe5a4ef5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3063858 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 0261b1d3 2021-03-31T10:48:08 PPO: Fix updating sampler uniforms between draws Updating sampler uniforms when using PPOs is currently broken, since the Context/State use the currently bound ProgramExecutable which belongs to the PPO, but the updates only happen to the Program's executable that the uniform belongs to. This change updates Program::updateSamplerUniform() to update any PPO ProgramExecutables with the updated texture information when a Program's sampler uniforms are updated, so the Context/State use the correct data. Bug: b/182409935 Test: ProgramPipelineTest31.SampleTextureAThenTextureB Test: SamplersTest31.SampleTextureAThenTextureB Change-Id: I3c4e156c6e0c781e706f321f0bd12baf484ff42a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2797951 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 323c5f24 2021-03-29T17:47:53 Validate PPO sampler uniforms "Command & Conquer: Rivals" uses PPOs and was hitting the following assert: angle::Result ContextVk::updateActiveTextures(const gl::Context *context) { ... for (size_t textureUnit : activeTextures) { gl::Texture *texture = textures[textureUnit]; gl::TextureType textureType = textureTypes[textureUnit]; ASSERT(textureType != gl::TextureType::InvalidEnum); This is the same assert that is generated by the test ProgramPipelineTest31.DifferentTextureTypes which is currently being skipped since it's known to fail. This CL refactors sampler validation into the ProgramExecutable to allow PPOs to take advantage of the shared code and behave correctly, since the necessary data is already copied into the PPO's ProgramExecutable via ProgramExecutable::updateActiveSamplers(). This also takes advantage of the subject/observer pattern that's already established between programs and PPOs to ensure only the PPOs that the program is a part of are updated when a program's sampler uniforms are updated. Bug: angleproject:3570 Bug: b/182409935 Test: ProgramPipelineTest31.DifferentTextureTypes Change-Id: I3d34efd66dc85e7ff23a8422cb14d5f90a5f7085 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2792862 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Tim Van Patten e3b9dbef 2021-03-17T18:01:02 Update PPO's executable when attached program is re-linked When a program that's being used by a PPO is successfully re-linked, the PPO's ProgramExecutable needs to be updated. This takes advantage of the subject/observer pattern that's already established between programs and PPOs to ensure only the PPOs that the program is a part of are updated. Bug: b/182409935 Test: ProgramPipelineTest31.ModifyAndRelinkShader Change-Id: Idcc11e7e819b4a9bef02bdd71afc8ea58111acc6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2770684 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Ian Elliott 6eb7756d 2020-08-07T17:41:39 Vulkan: tell ContextVk when swapchain is re-created For an app that only draws to the swapchain, if the swapchain is recreated with a different rotation (as done by the ANGLE perf tests when switching from Angry Birds 2 to Candy Crush), ContextVk is not informed, and so the new rotation is ignored. Use the subject-observer pattern to set the appropriate dirty bits. Test: run_angle_perftests --gtest_filter=TracePerfTest.Run/vulkan_angry*:*vulkan_candy* --verbose --local-output Bug: angleproject:4910 Bug: b/163126746 Change-Id: Ib5303e9c4095db1b3e736911f483589e40a73d0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2341768 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 1c88cf27 2020-03-18T18:00:01 Add optimized rendering feedback loop tracking. This can be used both for WebGL and the Vulkan back-end workaround for Manhattan. Uses the recently added tracking for Textures being bound as samplers. Then caches this information in the Framebuffer using the Subject/Observer pattern. Bug: angleproject:4490 Change-Id: I08bef0a1b95c4333da19c2dae1f02a993e5835e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2109335 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 124f78c2 2019-06-18T11:48:24 Remove gl::Context parameter from Observer functions. It was only used in exactly one instance in VertexArray. Instead we can cache a bool and avoid needing to pass it around. Will make signaling dirty easier in the Vulkan back-end. Bug: angleproject:3539 Change-Id: Ia570aec051a24a5280df49edc4345c54022b46ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1663838 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill e4faae21 2019-05-10T08:27:00 Rename state change notification messages. This makes the style use CamelCase instead of ALL_CAPS. It also cleans up some of the naming. It also changes some uses of the messages in some of the objects to hopefully be more consistent. See the comments added to the enum SubjectMessage in Observer.h for more details. Bug: angleproject:3427 Change-Id: I6dff4f6d335ecf1a27e48df65743b1490bd3025a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1600411 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill cf9383ed 2019-01-31T19:52:49 Optimize VertexArray::bindVertexBufferImpl. Reduces the buffer nullptr checks to a single location. Also optimizes how the transform feedback binding counter is changed. Improves the score of the draw call vertex array change test. Bug: angleproject:3014 Change-Id: I08ff341e08194a407c24143965a3d568e92b97b7 Reviewed-on: https://chromium-review.googlesource.com/c/1406891 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill cd0a0a3c 2018-10-18T18:41:57 Introduce SubjectBindingPointer. We can share the same pointer for the subject binding and the binding pointer. This further allows us to optimize buffer re-binding. The shared memory increases cache coherency and reduces the number of instructions needed. Bug: angleproject:2891 Change-Id: Id3162fa79de203f75989e7289ea02cb2ea1bec73 Reviewed-on: https://chromium-review.googlesource.com/c/1270217 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Jamie Madill 956ab4d9 2018-10-10T16:13:03 Optimize several functions for the Program perf test. This gives the same or slightly better performance in the ProgramDraw perf test. Also only set the Program object as dirty when there are dirty bits set in the Program itself. Bug: angleproject:2877 Change-Id: I07b428b40d3e3c24e0a42c970524756b6dc3a30e Reviewed-on: https://chromium-review.googlesource.com/c/1271475 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d511948b 2018-09-18T11:32:42 Use FastVector in angle::Subject. This improves object binding performance. We no longer need to check two containers when manipulating the bound subjects/observers. Bug: angleproject:2763 Change-Id: I0ccb2e76be47bd8a28fba5a0c3eff857aa166bb7 Reviewed-on: https://chromium-review.googlesource.com/1227795 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill d69a5f12 2018-08-01T11:34:48 Cache VertexArray::hasMappedBuffer. This can be updated in several places. Also adds a test which covers some of the paths. Bug: angleproject:2746 Change-Id: Id119e527fd0064998d7ad5011a9d8376e7b9dab0 Reviewed-on: https://chromium-review.googlesource.com/1153569 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 7267aa65 2018-04-17T15:28:21 Optimize ValidateDrawAttribs: Part 3. This is a small optimization for the WebGL compatibility mode. Instead of scanning the list of attributes for a Transform feedback conflict, it can quickly check a cached mask. This should save a lot of cycles on the fast path. Bug: angleproject:1391 Change-Id: Icb8d095493a629dbff0e93872357e5bf7c7458ae Reviewed-on: https://chromium-review.googlesource.com/1011236 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 3418fe80 2018-04-09T14:08:19 Optimize Subject's binding method. Using FixedVector, we can remove the need for dynamic allocation in most of the use cases. Only when we exceed a certain amount of fixed storage do we need to spill into the heap. Bug: angleproject:2389 Bug: chromium:829906 Change-Id: Ib5f7073b58876bfd2400bd87b743bddcee5e5dc8 Reviewed-on: https://chromium-review.googlesource.com/1002884 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d7518622 2018-03-27T09:44:31 Buffer11: Refactor Subject/Observer pattern. Instead of having a direct/static observer distinction, add two messages for 'Contents Changed' and 'Storage Changed'. This makes Buffer11 itself the subject with two different message handling cases in the onSubjectStateChange methods. Bug: angleproject:2389 Change-Id: I645cd4b7cc7ce51cb7f48a01c7fc72939cbe89fe Reviewed-on: https://chromium-review.googlesource.com/957940 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Luc Ferron 879f90d2 2018-03-01T11:45:20 Vulkan: Avoid recopying the data every time we draw line loops Use the Observer pattern to get notified when the BufferVk we've copied our data from is changing. We will only recopy the data if anything has changed, but otherwise we'll keep drawing with the same index buffer we've created previously. Bug: angleproject:2335 Change-Id: Ib65677b4d5ec90c46a5e3b975fffd1fddeed59e7 Reviewed-on: https://chromium-review.googlesource.com/948622 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 6f683089 2018-02-28T00:35:16 Rename signal utils to Observer. This completes the basic refactor to the Observer pattern. Bug: angleproject:2372 Change-Id: I810deff7c7e39baa64b57ce2a79cd732b1af7c34 Reviewed-on: https://chromium-review.googlesource.com/940862 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>