src/libANGLE/Context.inl.h


Log

Author Commit Date CI Message
Geoff Lang f1150231 2024-01-16T16:28:36 Track WebGL buffer type in gl::Buffer state. WebGL has special validation that disallows buffers from changing "WebGL buffer type". Once a buffer is marked as having index data it cannot be bound as any other type of buffer except the copy binding points to copy to other index buffers. This disallows any GPU writes to buffers used for index data. Use this rule to shadow index buffer data when the driver is unable to give us robust access. Index range computation can be done much faster when the buffer does not need to be read back. Bug: angleproject:8434 Change-Id: I059eff732bb2f43234f61d9ef5528289f7698b38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5200242 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 7b0bb0f6 2023-09-01T13:52:28 Properly "install" program executables According to GL: - The program has an executable - The executable is overwritten during link. - After a failed link, queries of the executable may return half-linked information - On glUseProgram, the executable is installed in the context - On glUseProgramStages, the executable is installed in the program pipeline - After a successful link, the executable is updated wherever the previous executable of the program was installed. This change implements exactly the above: - The program's and the program pipeline's executables are now shared_ptr. References to an executable in the context and PPO are also through a shared_ptr. Installing an executable thus translates to sharing the executable. - The context and PPOs are made to not reference the program directly, but work solely through the executable. As a result, the program is free to create a new executable for link. With this change, the link job will be free to modify the executable as necessary because that will not be accessed until the link is done. Note that previous changes made the backend executable accessed through the frontend one, and moved all link results to the frontend and backend executables as appropriate. Bug: angleproject:6358 Bug: angleproject:8297 Change-Id: Ie636b23ff7420ad284d18b525ec4f5fb559dd9d1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4823089 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
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 5f581f87 2023-06-27T20:38:03 Pass dirty bits by value Split CL from follow up change where the dirty bits need to be passed by value as they are calculated from two sets. Many cached dirty bits are turned to constexpr as a result. Bug: angleproject:8224 Change-Id: Ibdb3090d6ee93788e1502b72bce55f4677937c58 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4650074 Reviewed-by: Roman Lavrov <romanl@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 2e209516 2023-06-26T11:58:50 Move state dirty bits definitions out of the class This is in preparation for a follow up change that splits the state class. Bug: angleproject:8224 Change-Id: Ic9b253583e40fcc93ff37605b6b6e1deb55a6e55 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4631843 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi fb0174fa 2023-06-16T12:08:51 Fix clearing of extended dirty bits in draw calls When syncing all dirty bits (i.e. in draw calls), the extended dirty bits were not cleared. This caused the extended dirty bits to be resynced every time. Credit Steven Noonan <steven@uplinklabs.net> Bug: chromium:1410191 Change-Id: I7042462bbc4346880eb99128b3501cf130987505 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4615239 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang c6ec59dc 2023-03-27T11:15:48 Explicitly pass the extended dirty bits to syncState. Add a the extended dirty bits and bit mask to syncState instead of calling gl::State::getAndResetExtendedDirtyBits when encountering DIRTY_BIT_EXTENDED. It disallowed us from masking the extended dirty bits and feels like an anti-pattern to modify the extended dirty bits in gl::State from the backend. This is a refactor only. Bug: chromium:1410191 Change-Id: I66fdec3eb57e3426cf0fda9ccb759700eafdda14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4374100 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Kimmo Kinnunen 0bbb5033 2023-01-31T13:33:09 Check if multidraw calls are no-ops Patch by: David Li <jingye_li@apple.com> Avoid assertion when prepareForDraw would try to use a program state without program. Fixed: angleproject:7990 Change-Id: I9cdac0467deafb1975664ee999067ca3813aaa7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4205893 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Mohan Maiya 4cca6b3e 2022-03-08T14:54:02 Early return when rebinding the same buffer, sampler or texture Bug: angleproject:6955 Test: SimpleStateChangeTestES3.BindingSame* Change-Id: If946a7cf534809d21e49138d9f34dcee61a73627 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3029049 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bdc633a8 2021-10-20T12:33:42 Pass command type down to ContextImpl::syncState. This mirrors the command type passed to the object sync functions. It will be useful to determine if we're syncing for a draw or a dispatch call. Bug: angleproject:6595 Change-Id: Ia04bd14a3c2dd2eb211c47a6e55f8ddcbfedfaaa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233904 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mark Lobodzinski c37b1ef8 2021-05-13T14:31:59 Balance debuglabel begin/end pairs for skipped drawcalls Some drawcalls may be no-op'd due to shader issues or having zero instance or element counts. In these cases, the ANGLE markers used for AGI will become imbalanced as it is the drawcalls that trigger the 'begin' marker. This patch ensures that the dirty-bit draw event handler is called for no-op'd drawcalls to keep the AGI commandTree in balance. Bug: b/184888395 Change-Id: I1041d2f06fb313934365340c35e458bc5a66ba64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2895330 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Mohan Maiya 54242b8f 2021-02-04T12:20:57 Vulkan: Leverage ExtendedDirtyBitType Expand ExtendedDirtyBitType to include bit for clip distance, mipmap generation hint and shader derivative hint. Handle these dirty bits in ContextVk::syncState Bug: angleproject:5611 Change-Id: If8d1646334e737f81ac72cdddb8fe3ba613b4b94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2676173 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 89f50584 2021-02-03T08:51:04 Vulkan: Add ExtendedDirtyBitType bitset ExtendedDirtyBitType qualifies DIRTY_BIT_EXTENDED dirtybit. Clip control code path can now set the appropriate ExtendedDirtyBitType when there is a change in state. Also remove the ClipSpaceOrigin member in the Vulkan backend that cached front-end state. Bug: angleproject:5471 Tests: dEQP-GLES2.functional.clip_control.* Change-Id: I8dbb509ef940e7905439d32483fd67a8fc171a6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2673062 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Tim Van Patten 81370214 2020-07-29T12:54:02 Pass the Command when sync'ing dirty objects A new enum is being created that contains command types, which are then passed to each dirty object when they are synced. This allows the syncState() methods to perform special handling for each command type. This change is in preparation for optimizing resolving multisample images with glBlit, since the render pass needs to be updated before it's ended. Bug: angleproject:4753 Change-Id: I77701f79418d35cff689e864c8a8b47b6fca0255 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2327335 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 248119b3 2020-07-20T16:05:45 Vulkan: Fix render target's tracking of content defined Imagine the following scenario: 1. Clear draw framebuffer 2. Invalidate draw framebuffer 3. Update texture attached to draw framebuffer 4. Draw again into draw framebuffer Step 3 could be a number of things, such as glCopyTex[Sub]Image, glBlitFramebuffer, glTex[Sub]Image2D, glGenerateMipmap etc. In the above scenario, at step 2, the framebuffer's render target remembers it being invalidated (mContentDefined = false). This is used to set the loadOp of the next render pass to DONT_CARE. However, mContentDefined was implemented for a very specific optimization regarding the swapchain's depth buffer. The reuse of this variable for glInvalidateFramebuffer was erroneous as this variable didn't track whether the contents are defined for the general case. With this change, mContentDefined is set to true during FramebufferVk::syncState for each render target whose contents are marked dirty. This change additionally makes glBlitFramebuffer signal the contents of the blit targets as dirty, as well as textures that are used as storage images. Bug: angleproject:4859 Change-Id: I68c829f75ff4a3d03bb293ec72c609384983026d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2309110 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
shrekshao 796df76c 2020-06-25T11:49:12 MultiDraw Refactor Refactor MultiDraw* from general Context to different ContextImpl. Move general multiDraw code to renderer_utils.cpp. Bug: angleproject:3402 Change-Id: I85cb4b781afa2b3a8beb382a9c735910057f2ebe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2268580 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 12b6a82e 2020-04-03T18:31:22 No-Op draws when no active VS and/or FS is present Re-land CL with WebGL fixes: This required some extra pointer checking during validation to handle the fact that a Program and/or ProgramExecutable may not be present when attempting to draw. This isn't an error, just undefined behavior, which we (eventually) treat as a no-op. According to the OpenGL ES 3.1 spec: 7.3. PROGRAM OBJECTS If there is no active program for the vertex or fragment shader stages, the results of vertex and fragment shader execution will respectively be undefined. However, this is not an error. To handle this, if no VS or FS is present in the active Program/PPO, we will no-op the draw command. Bug: angleproject:3570 Test: KHR-GLES31.core.sepshaderobjs.StateInteraction Change-Id: I70d688bf344a78cf3b4fd66c995ae03ce4b9b807 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2185156 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Courtney Goeltzenleuchter 1ab55d96 2020-05-06T14:45:18 Revert "No-Op draws when no active VS and/or FS is present" This reverts commit a4b506f79e3286ffcf3a5d68f20aa97a63edab8e. Reason for revert: WebGL crash https://bugs.chromium.org/p/angleproject/issues/detail?id=4616 Original change's description: > No-Op draws when no active VS and/or FS is present > > According to the OpenGL ES 3.1 spec: > > 7.3. PROGRAM OBJECTS > If there is no active program for the vertex or fragment shader > stages, the results of vertex and fragment shader execution will > respectively be undefined. However, this is not an error. > > To handle this, if no VS or FS is present in the active Program/PPO, > we will no-op the draw command. > > Bug: angleproject:3570 > Test: KHR-GLES31.core.sepshaderobjs.StateInteraction > Change-Id: If19e9fbb1bc09fa0d490832079bb9f514eab6035 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2136386 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,jmadill@chromium.org,cclao@google.com Change-Id: Ia24c4156ff7779b69c1f3f705f1a91cbb1c9684c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:3570 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2184849 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Tim Van Patten a4b506f7 2020-04-03T18:31:22 No-Op draws when no active VS and/or FS is present According to the OpenGL ES 3.1 spec: 7.3. PROGRAM OBJECTS If there is no active program for the vertex or fragment shader stages, the results of vertex and fragment shader execution will respectively be undefined. However, this is not an error. To handle this, if no VS or FS is present in the active Program/PPO, we will no-op the draw command. Bug: angleproject:3570 Test: KHR-GLES31.core.sepshaderobjs.StateInteraction Change-Id: If19e9fbb1bc09fa0d490832079bb9f514eab6035 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2136386 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 405f8e7b 2020-02-24T17:38:10 Vulkan: Support Program Pipeline Objects Add support for PPOs to the Vulkan back end. Bug: angleproject:3570 Change-Id: I5403456929847c185467b008d810f31ecfcb60cc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2072652 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill d03b15b2 2020-03-26T17:22:18 Vulkan: Mask out Depth/Stencil RTs in feedback loops. This should enable some cases of limited support for feedback loops with depth/stencil buffers. For example with Manhattan and the Vulkan back-end. Increases the number of RenderPasses in Manhattan slightly. This will regress performance slightly until we can work out a better solution that is also conformant with the spec. Bug: angleproject:4517 Change-Id: I2758e6b4c2a930474c09cdc0950f3b6c34541089 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2106670 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill c77cb596 2020-03-24T14:39:32 No-op draw calls with rendering feedback loops. This is quite within spec and protects our various back-ends from FB loops. Also makes the check more cached for optimization purposes. Bug: angleproject:4490 Change-Id: Ia82ec88244d07670d68ce53495b5893b8a75ac42 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2118153 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 3b3fe837 2019-08-06T17:44:12 Use BufferID in place of GLuint handles. Introduces enable_if handling for "FromGL". Avoids the use of any macro code to handle resource id casting. Bug: angleproject:3611 Change-Id: I1a6d10c3c9cc6ba0dc072bad1d62c33551f05d87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1736127 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
James Dong 020abb8b 2019-07-24T11:33:49 Vulkan: invalidate translation buffers for SSBOs Translation buffers weren't being marked dirty after running a compute shader in which they are bound as SSBOs. This change invalidates all SSBOs after a draw or compute call. Bug: angleproject:3739 Change-Id: I66b56df7e619b55afc7e3da6b5613b6d050e06bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1717144 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: James Dong <dongja@google.com>
Jamie Madill c09ae15c 2019-02-01T14:16:32 Enable -Wextra-semi and -Wextra-semi-stmt. This will prevent users from accidentally making semicolon errors in the future. Bug: chromium:926235 Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9 Reviewed-on: https://chromium-review.googlesource.com/c/1446493 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill c3dc5d48 2018-12-30T12:12:04 Merge gl::Context and gl::ContextState. This reduces the number of indrections when accessing the Extensions or Caps structures. It will provide a small speed-up to some methods. It also cleans up the code. Bug: angleproject:2966 Change-Id: Idddac70758c42c1c2b75c885d0cacc8a5c458685 Reviewed-on: https://chromium-review.googlesource.com/c/1392391 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Markus Tavenrath <matavenrath@nvidia.com>
Jamie Madill 60a50cfc 2018-12-29T16:04:05 Inline Context::DrawArrays and Context::BindBuffer. This reduces the call depth of both of these two hotspots. Reduces time spent in the CPU overhead benchmarks by about 10%. Bug: angleproject:2966 Change-Id: I5052e56dcc1dfb80274326a7f0891fafba7d6655 Reviewed-on: https://chromium-review.googlesource.com/c/1392389 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Markus Tavenrath <matavenrath@nvidia.com>
Markus Tavenrath cb9609fe 2018-12-26T00:52:44 Optimize glDrawElements performance A call to glDrawElements results in a calling depth of up to 4 * glDrawElements * gl::Context::DrawElements * rx::ContextGL::DrawElements * VertexArrayGL::syncDrawState. Each function call has to save/restore a lot of registers which results in a stall in the prologue of rx::ContextGL::DrawElements due to memory bandwidth limitations. The main change is the function gl::Context::DrawElements being inlined to reduce the calling depth by one. In addition the call to ContextGL::syncDrawElementsState is now protected so that it gets called only if it's required. Finally a few small getter functions have been inlined where the calling code was bigger than the actual function. In total this change improves performance of the DrawElementsPerfBenchmark.Run/gl benchmark by 16%. Bug: angleproject:2966 Change-Id: I423d18452f2f5b520ab52850fda2054e1da86991 Reviewed-on: https://chromium-review.googlesource.com/c/1389988 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Markus Tavenrath <matavenrath@nvidia.com>