src/libANGLE/State.h


Log

Author Commit Date CI Message
Tingwei Guo 94777428 2025-08-08T10:36:22 Shading rate should be {1,1} when enabled PER_SAMPLE According to spec, if FETCH_PER_SAMPLE_ARM is enabled, the fragment shading rate is set to {1,1}. Bug: angleproject:437957110 Change-Id: I3ea6958f1aaec5f13923f62001906c7c6c71e09e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6839957 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Tingwei Guo <tingwei.guo@arm.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 35b92525 2025-08-13T15:27:32 Remove lock from GenVertexArrays/IsVertexArray VertexArrays are per context anyway and is thread safe, so there is no need for shared lock. This CL moves mVertexArrayMap from Context to PrivateState so that it won't be accessed by other APIs. Bug: b/433331119 Change-Id: I466a79762e887dbec78b796b52028420837cff59 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6977163 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Sungyong Choi 68baeeeb 2025-08-12T15:51:07 State: avoid GCC -Waddress by using constexpr null-check helper GCC with -Waddress warns that the static_assert comparing `handlers[0] != nullptr` is always true when MakeDirtyObjectHandlers() fully initializes the array. During constant evaluation, handlers[0] is replaced with the specific member function address (&State::syncActiveTextures), which can never be null, making the comparison tautological. This change replaces the direct `handlers[0] != nullptr` check with a constexpr helper that iterates over all handlers and verifies none are null. By comparing each element in a loop, the check still runs at compile time (constexpr), but avoids a direct “function address vs nullptr” pattern that triggers -Waddress. BUG: angleproject:438226513 Change-Id: Iaa8441000f8b2aa28c44d17730ca223fd4d4595b Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6845477 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao d8dc3cc2 2025-08-02T12:02:20 Remove shared context lock from glVertexAttrib{I}Format This CL removes shared context lock from glVertexAttribFormat() and glVertexAttribIFormat() APIs, since they no longer access anything outside VertexArrayPrivate. The main problem I had run into is validation code. Before this CL, ValidateIntegerVertexFormat() needs context's mStateCache for mCachedVertexAttribTypesValidation and mCachedIntegerVertexAttribTypesValidation. Given these two cached value are constant after initialization, in this CL, I have moved them to PrivateStateCache. PrivateStateCache argument is added to ValidateVertexAttribFormat() and ValidateVertexAttribIFormat() to get them access to mCachedIntegerVertexAttribTypesValidation. Bug: b/433331119 Change-Id: Ifc3fbed32b4d3722c335dd2c393bc6519ed0b544 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6822032 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao ae4aead5 2025-07-24T16:35:38 Remove sharedContextLock from glVertexAttrib{Divisor|Binding} With prior CLs all the functions used by glVertexAttribDivisor*, glVertexBindingDivisor and glVertexAttribBinding only access VertexArrayPrivate. This CL removes shared context lock from these APIs. Bug: b/433331119 Change-Id: Ib1632797c53d2cd7a31c21e93c0e69385c71a27f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6814157 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 394df705 2025-08-01T14:03:17 Cache per bufferIndex buffer properties in VertexArrayPrivate This is another preparation CL. This CL caches per bindingIndex buffer properties in VertexArrayPrivate: mCachedBufferPropertyMapped and mCachedBufferPropertyMutableOrImpersistent. The only difference between these and mCachedMappedArrayBuffers / mCachedMutableOrImpersistentArrayBuffers is that one indexed by attribIndex and another is indexed by bindingIndex. With this, when attribute binding changes, we no longer need to make buffer access. With this, we can move setVertexAttribBinding and setVertexBindingDivisor from VertexArray into VertexArrayPrivate class and Context argument is also removed. Bug: b/433331119 Change-Id: I666544ee0585727ca92d640f372f5a64d1d85576 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6814156 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao fa29f604 2025-07-02T13:23:31 Remove sharedContextLock from {Enable|Disable}VertexAttribArray VertexArray objects are per context objects. In theory they do not need to protected by shared context lock. The reason we are taking locks because all these functions end up accessing Buffer object which are shared. In prior CLs we have removed subject observer usage from VertexArray which means VertexArray no longer accessed from other thread. In prior CLs we also split VertexArray into two classes: VertexArrayPrivate which has no buffer, and VertexArray which is subclass from VertexArrayPrivate and owns buffer. In this CL, glEnableVertexAttribArray and glDisableVertexAttribArray calls no longer take shared context lock. ContextPrivateEnableVertexAttribArray and ContextPrivateDisableVertexAttribArray are called from these two APIs and they only have access to StatePrivate. State Private holds a VertexArrayPrivate pointer, which means they do not have anyway to access buffer objects. The main challenge I run into here is mCachedActiveClientAttribsMask, mCachedActiveBufferedAttribsMask, mCachedActiveDefaultAttribsMask, mCachedHasAnyEnabledClientAttrib, mCachedNonInstancedVertexElementLimit, mCachedInstancedVertexElementLimit. These StateCache variable needs to be updated when these two APIs are called, and calculating these variable needs access to buffer object. The solution here is adding a bool mIsCachedActiveAttribMasksValid in the PrivateStateCache so that instead of immediately update these mCached* variable, we just set mIsCachedActiveAttribMasksValid to false. Then whenever any of these mCached* variable is needed, we will check mIsCachedActiveAttribMasksValid and calculate these cached variables. It adds one if check when accessing these caches, but the other benefit is that we may have avoided duplicated calculation when multiple states changed. Bug: b/433331119 Change-Id: I3227c72bc40501712db93fb3d540b835f07150b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4514436 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Panfeng Hou 2ef85c24 2025-07-09T17:13:52 Vulkan: Add support for GL_EXT_fragment_shading_rate Add support for GL_EXT_fragment_shading_rate. Bug: angleproject:420310117 Change-Id: I7b368afc45baf8551c222b2569991269117d385b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6726817 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Panfeng Hou <panfeng.hou@arm.com> Reviewed-by: Charlie Lao <cclao@google.com>
Geoff Lang b7582680 2025-02-24T18:04:32 Reland: GL: Allow untranslated shaders to pass through on GLES Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which uses the NULL translator and passes the original shader to the driver. The parser is still used for shader reflection. Always enable the null compiler backend. It has almost no binary size cost and is now potentially used when the null ANGLE backend is not enabled. Bug: angleproject:398857482 Change-Id: Id528189ccbbacb1c444eacb151baadfda9fcc04b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6488609 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Mohan Maiya bb3f79dc 2025-06-26T16:59:48 Reorder shader resource dirty bits Process storage and atomic buffer dirty bits before uniform dirty bits. This helps the vulkan backend avoid duplicate work when multiple shader resources are dirty Bug: angleproject:426412564 Change-Id: Ibab3da44ee32d22078df851bfed4967d1c2a605e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6680035 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Igor Nazarov d5babf99 2025-06-23T12:46:51 Vulkan: Fix unhandled deferred clears after glGetMultisamplefv Issue was introduced in the commit that implemented deferred clears. The `glGetMultisamplefv()` synchronizes draw framebuffer which defers possibly staged clears. Since API is not handling deferred clears they are left untouched, causing the ASSERT. This change fixes the issue by not deferring clears for the `glGetMultisamplefv()` command during flushing staged updates of dirty framebuffer attachments. Changes: - Add `gl::Command::GetMultisample` enumeration for clarity. - Add `gl::CommandBlitBuffer::CommandBlitBufferDepthStencil` enumeration to improve code readability. - Add `command` parameter into `gl::State::syncDirtyObject()` method to use actual command enum instead of `Other`. - Remove `previousDeferredClears` local variable and update ASSERT in the `FramebufferVk::syncState()` method. New assert ensures empty `mDeferredClears` instead of just checking dirty attachments, since it is easy to make all attachments dirty making old and new assertions act the same. - Replace logic in `FramebufferVk::syncState()` that decides whether need to defer attachments or not with switch-case. This makes the logic more clear regarding handling individual commands and simplify updating this handling in the future. Except of the bug fix with `GetMultisample` command, handling of other command is uncached. - Remove `flushDeferredClears()` from `FramebufferVk::readPixels()` because `mDeferredClears` are not expected (now it's more clear after the refactoring). And even if there are `mDeferredClears` (in case of a bug or after API failure), `flushDeferredClears()` only flushes clears for the draw framebuffer, while checking `mDeferredClears` of the read framebuffer. This is a problem in case if read and draw framebuffers are not the same. Bug: angleproject:40644727 Test: angle_end2end_tests --gtest_filter=TextureMultisampleTest.GetMultisamplefvAfterClear/* Test: angle_end2end_tests --gtest_filter=EGLSurfaceTest.GetMultisamplefvAfterClear/* Change-Id: I376a62de52de5e17dbc63cc7ddb0506741a69266 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6661958 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 2fd033d0 2025-05-22T04:21:11 Vulkan: Optimize updates to uniform buffers ... when only the offset is modified. Most of the work done when handling dirty uniforms can be skipped since the buffer bindings haven't changed Bug: angleproject:386749841 Tests: UniformBufferTest31.UniformBufferBindingRangeChange*Vulkan Change-Id: Ic811bd71f0f2993f88ce9bcf93f9e8e46dfc6d99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6581359 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Panfeng Hou 9a436772 2025-06-04T16:47:51 Vulkan: Add entry points for GL_EXT_fragment_shading_rate Bug: angleproject:420310117 Change-Id: I8a8efad6cad810b2cb0b600106f6496070495605 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6620340 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi 8c48b502 2025-06-05T02:09:54 Vulkan: Fix deferred clear vs robust init vs invalidate The DIRTY_OBJECT_DRAW_ATTACHMENTS bit, when handled, goes over framebuffer attachments and requests that they be cleared. This is done only with robust init. The DIRTY_OBJECT_DRAW_FRAMEBUFFER bit, when handled, results in staged updates to be applied to the attachments. When syncDirtyObjects is called, the above bits are handled. If we end up in a situation where DIRTY_OBJECT_DRAW_ATTACHMENTS is set, but not DIRTY_OBJECT_DRAW_FRAMEBUFFER, the following happens with Vulkan: - Handle DIRTY_OBJECT_DRAW_ATTACHMENTS - TextureVk::initializeContents - ImageHelper::stageResourceClearWithFormat - Observer message to TextureVk->Texture->Framebuffer->Context - Context sets DIRTY_OBJECT_DRAW_FRAMEBUFFER - However syncDirtyObjects does not notice this bit, as it has cached the dirty objects and is in the middle of looping over them In the above scenario, the call that results in syncDirtyObjects does not process the draw framebuffer (if not already dirty for some other reason), meaning the clear is not applied _before_ the current operation but after it (whenever framebuffer is synced next). In this change, I attempted to ensure that if DIRTY_OBJECT_DRAW_ATTACHMENTS is ever dirty, DIRTY_OBJECT_DRAW_FRAMEBUFFER is also dirty. There were a few operations that could theoretically lead to this which are fixed by this change. The particular one that revealed the bug was State::syncDirtyObject syncing only the FRAMEBUFFER bit and leaving the ATTACHMENTS bit for the unsuspecting following operation. The aforementioned assertion is not included in this change however, as it revealed one unresolved issue with the d3d backend where DIRTY_OBJECT_DRAW_ATTACHMENTS is not set, but processing DIRTY_OBJECT_DRAW_ATTACHMENTS sets it while dirty bits are being processed. Bug: b/381284577 Change-Id: If3c35fbade069ae75f66dd6d4df5d73882a08a93 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6621059 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 3b77a177 2025-04-23T15:47:07 Optimize vertex attribute and buffer state change Bug: angleproject:386749841 Change-Id: I25968902282f6a201510e2ee17ea85fd71ef57c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6483915 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Alexey Knyazev 4b9525b2 2025-04-04T00:00:00 Remove all getClientMajorVersion helpers Client version checks should use proper struct compare operations. Bug: angleproject:408843436 Change-Id: I92cd91d1e7e6daa761f79060835aa534c5671264 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6467460 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 408f5853 2025-04-04T00:00:00 Make gl::Version data members private * Further simplified gl::Version implementation by making data members private and merging them. * Used proper version struct comparisons instead of accessing individual version components. * Moved known version constants to Version.h for broader availability. * Removed no longer used helpers: * PrivateState::getClientMinorVersion() * State::getClientMinorVersion() * Context::getClientMinorVersion() Bug: angleproject:408843436 Change-Id: I3ae8f495269d649253fa2381ecbfc018a184fa20 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6460787 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Yuly Novikov 5dd05578 2025-04-14T07:34:57 Revert "GL: Allow untranslated shaders to pass through on GLES" This reverts commit 4e77552b86a89b449ada6d6c18f84285f5812b1d. Reason for revert: breaks ChromeOS and fuzzers Bug: angleproject:398857482 Original change's description: > GL: Allow untranslated shaders to pass through on GLES > > Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which > uses the NULL translator and passes the original shader to the driver. > The parser is still used for shader reflection. > > Bug: angleproject:398857482 > Change-Id: I7c5fcc318c7e11931f78c08dcbf4764bf77d397d > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6297527 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: angleproject:398857482, angleproject:410423936 Bug: chromium:410114655, chromium:410100607, chromium:410121218 Bug: chromium:410052365, chromium:410290507, chromium:410178288 No-Presubmit: true Change-Id: I45b01960637a1cda05d21a7df6d07465f6a8f5e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6448984 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Geoff Lang 4e77552b 2025-02-24T18:04:32 GL: Allow untranslated shaders to pass through on GLES Add an EGL extension EGL_ANGLE_create_context_passthrough_shaders which uses the NULL translator and passes the original shader to the driver. The parser is still used for shader reflection. Bug: angleproject:398857482 Change-Id: I7c5fcc318c7e11931f78c08dcbf4764bf77d397d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6297527 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Roman Lavrov cbfa8e38 2025-03-31T09:51:33 Add "likely" hints to common validation paths This makes the hot path assembly more local. I can't tell if there is an observable effect of just doing this on the regular build performance, but this generally makes sense and reduces the assembly difference with PGO builds. Bug: b/383305597 Change-Id: Icb191e8e927217d9db4cb505d5cd6f76536403e3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6416263 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Igor Nazarov a0f54ac0 2025-03-26T21:44:38 Remove DIRTY_BIT_READ_FRAMEBUFFER_BINDING sync during draw Remove `state::DIRTY_BIT_READ_FRAMEBUFFER_BINDING` synchronization from `prepareForDraw()`, since it does not synchronize the `DIRTY_OBJECT_READ_FRAMEBUFFER`. This is to avoid synchronizing with invalid read framebuffer state. It seems that in the current code this bug does not cause any real problems and it is not possible to write test that will fail. On Vulkan back-end, this is because `DIRTY_BIT_READ_FRAMEBUFFER_BINDING` is always reset after new swapchain is created (`SubjectMessage::SurfaceChanged`). Therefore, each time `DIRTY_OBJECT_READ_FRAMEBUFFER` is synchronized, `DIRTY_BIT_READ_FRAMEBUFFER_BINDING` will be also set. However, in the follow up CL the problem becomes possible. Without this change some gold trace tests will fail. Bug: angleproject:400711938 Change-Id: I375578a848a7cee044ca4d768266f3d3efa97e44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6396863 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Chris Dalton ae71cc1c 2025-03-11T16:36:52 Don't destroy blend or color mask state in PLS The browser caches this state, so conditionally destroying it would invalidate the browser's cache. Instead, cache modifications to overridden PLS blend & color mask state in ContextPrivateState, and restore it upon ending PLS. Also update the spec to specify that FRAMEBUFFER_DEFAULT_WIDTH and FRAMEBUFFER_DEFAULT_HEIGHT may be overridden during PLS in ES 3.1. Bug: angleproject:40096838 Change-Id: Ic2c0aa6dc33ada7350e15e27bef22c79ca5f6c7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6350727 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 1ead4cbd 2025-03-07T09:49:21 Allow texture modification commands while PLS is active Just do a little extra validation and bounce modifications if they would modify an active PLS plane. Bug: angleproject:40096838 Change-Id: I6f27951f5d0ef5dfaf23b5a005a2d94a749e2c4f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6337703 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Roman Lavrov 87d891dc 2024-12-13T19:51:42 Inline more tiny functions on hot path Similar to https://crrev.com/c/6094283, not as hot but broader. Highlighted by PGO profile of driver_overhead_2 trace combined with size and offset of the corresponding .so sections to maximize reduction in TLB misses. Improves driver_overhead_2 performance by 1~2% on Pixel 8. Almost no change in .so size as functions are tiny. Bug: b/383305597 Change-Id: Ib1c021d4635141b879667b59305e4d45de7b8aef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6088958 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Roman Lavrov <romanl@google.com>
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>
Geoff Lang 166b72c9 2024-09-30T19:07:26 GL_ANGLE_blob_cache implementation. Bug: chromium:370538323 Change-Id: Ic51a951e78b48b315e36f518bcc39ff2d54660a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5900761 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
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>
Shahbaz Youssefi 7c811715 2024-09-25T11:09:44 Vulkan: fix crash when clearing stencil with ClearBuffer Follow up to [1] which fixed a crash with glClear, but the bug remained with glClearBufferiv. This change refactors the "is stencil write masked out" query to always take the framebuffer's stencil bit count into account (practically always 8), which also happens to make the rest of the code checking this query more accurate in the presence of nonsense masks where the bottom 8 bits are 0. [1]: https://chromium-review.googlesource.com/c/angle/angle/+/3315158 Bug: chromium:40207259 Bug: angleproject:42266334 Change-Id: I68a6b0b75c67ed2cdc8c4d03b243efe5495efce1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5889788 Reviewed-by: Geoff Lang <geofflang@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang da572160 2024-07-23T16:36:10 Reland: GL: Forward client-side arrays to the driver when possible The OpenGL driver can handle client-side arrays when the context is OpenGL ES or a desktop GL compatibility profile. When in these situations, use the driver default VAO for all frontend context VAOs and forward client-side data directly to the driver. Fix synchronizing the default VAO state for external contexts. There is no valid VertexArrayStateGL for external VAOs so make sure it's nulled and the VAO dirty bits are set so the correct VAO state is reapplied. Disable syncing to the default VAO for external contexts. The only VAO that they can share with ANGLE's internal state is the default VAO so avoid having to save and restore its state. Bug: angleproject:355034686 Change-Id: I015bbbc854938fe4bc1e92d0ca8fe04628d0db16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5743284 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 48969c95 2024-05-31T16:34:07 GL: Implement QCOM_tiled_rendering Bug: angleproject:343900918 Change-Id: I01612e11795d7aa8ee20f6e9bd5ef62fe40e2910 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588630 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 3f572905 2024-06-19T17:46:38 Add basic begin/end support for perf counters The AMD_performance_monitor extension has explicit begin/end calls to capture counters. This was not implemented in ANGLE and the tests were relying on ANGLE always capturing counters (incurring a small overhead). This change does not complete the implementation of that extension, but does add basic support for starting and stopping perf counter measurements. While inactive, most counters are not updated. Bug: angleproject:42267038 Change-Id: I3ff6448b22ca247c217401cb2d76ef4142c9d759 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5639343 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi a1dea207 2024-06-13T11:40:39 Implement KHR_blend_equation_advanced_coherent * Updated the validation for glBlendBarrier() and ~KHR(). * GL state now includes mBlendAdvancedCoherent. * Updated glEnable() to accept GL_BLEND_ADVANCED_COHERENT_KHR. * It can be queried via glGetIntegerv(), etc. * EXTENDED_DIRTY_BIT_BLEND_ADVANCED_COHERENT added. * Added a corresponding bit to ExternalContextState. * If coherence is supported, there should be no need to use blend barriers, as, based on the spec, the advanced blend ops should then follow order like the basic blend ops. * Relevant tests: *GLES31.functional.blend_equation_advanced.coherent* * On Linux/NVIDIA: From "Not supported" to "Passed" Bug: angleproject:42262258 Change-Id: I7e0e43bdc71524eec111c2d3b024fe73c9795e55 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5634381 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Roman Lavrov 0508fc9b 2024-04-23T15:32:52 Reland "Cleanup: replace DirtyObjectType check with constexpr generator" Avoid using lambdas with member function pointers which caused issues on MSVC C++17. This is a reland of commit 89caa0e1d99e45f3d6f355f6e14c147f8de3e0e5 Original change's description: > Cleanup: replace DirtyObjectType check with constexpr generator > > Static assert was meant to avoid kDirtyObjectHandlers getting out of > sync, but it doesn't achieve that goal as it's just comparing values > with ints which is confusing. > > Replacing with constexpr generated std::array. C++20 allows to easily > validate that all values are set by _not_ default-initializing > `handlers`. C++17 makes it trickier, addeded static_assert on an > additional static constexpr bool (silly but I can't find a more concise > way) > > Bug: angleproject:8666 > Bug: b/335295728 > Change-Id: Idf9bbd087d09d5ba253a7587ce0503cae3fcf3a7 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5478231 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Roman Lavrov <romanl@google.com> Bug: angleproject:8666 Bug: b/335295728 Change-Id: I62e66b700512e072ef10cc57a17e8837a534c0d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5589285 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 073b7628 2024-05-21T21:49:37 Revert "Cleanup: replace DirtyObjectType check with constexpr generator" This reverts commit 89caa0e1d99e45f3d6f355f6e14c147f8de3e0e5. Reason for revert: compile errors on gcc and msvc c++17 Original change's description: > Cleanup: replace DirtyObjectType check with constexpr generator > > Static assert was meant to avoid kDirtyObjectHandlers getting out of > sync, but it doesn't achieve that goal as it's just comparing values > with ints which is confusing. > > Replacing with constexpr generated std::array. C++20 allows to easily > validate that all values are set by _not_ default-initializing > `handlers`. C++17 makes it trickier, addeded static_assert on an > additional static constexpr bool (silly but I can't find a more concise > way) > > Bug: angleproject:8666 > Bug: b/335295728 > Change-Id: Idf9bbd087d09d5ba253a7587ce0503cae3fcf3a7 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5478231 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Roman Lavrov <romanl@google.com> Bug: angleproject:8666 Bug: b/335295728 Change-Id: Ie272f09f0e21498848ac3ed6477dabf28aa3da42 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5554615 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 89caa0e1 2024-04-23T15:32:52 Cleanup: replace DirtyObjectType check with constexpr generator Static assert was meant to avoid kDirtyObjectHandlers getting out of sync, but it doesn't achieve that goal as it's just comparing values with ints which is confusing. Replacing with constexpr generated std::array. C++20 allows to easily validate that all values are set by _not_ default-initializing `handlers`. C++17 makes it trickier, addeded static_assert on an additional static constexpr bool (silly but I can't find a more concise way) Bug: angleproject:8666 Bug: b/335295728 Change-Id: Idf9bbd087d09d5ba253a7587ce0503cae3fcf3a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5478231 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Shahbaz Youssefi d9943e44 2024-04-09T23:53:48 Remove Program::syncState The last bit of responsibility still left in Program::syncState was to wait for post-link tasks for the sake of EGLBlobCacheTest tests. A new extension, GL_ANGLE_program_binary_readiness_query is created so that the wait can be done in the test itself. This extension is ultimately useful for applications as well, so they can avoid blocking the CPU by calling glGetProgramBinary prematurely. Bug: angleproject:8297 Change-Id: Ied6b755cb9b060198f82c7948bfd03441435a578 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5440302 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya b978974d 2024-03-03T10:48:48 Update frontend support for QCOM foveated extensions Modifications to frontend support - 1. EXTENDED_DIRTY_BIT_FOVEATED_RENDERING is removed 2. New framebuffer attachment API - getFoveationState 3. Attachment type restriction for foveated rendering is removed 4. Addition of new test - RenderbufferAttachmentClearThenDraw Bug: angleproject:8484 Change-Id: I699cbed81346c9a6344c4ff36afa51d6cc1bf052 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5338529 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya d05c9a5e 2024-01-25T13:01:49 Frontend support for QCOM foveated extensions Add frontend state management to support foveated rendering extensions. Bug: angleproject:8484 Test: Texture2D*Foveation* Change-Id: I0e1be9f11b2d442207674562da760f5bfd7debc8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5208091 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi ecc35205 2024-01-25T23:58:25 Move uniform block dirty bits to State When glUniformBlockBinding changes the mapping from a program uniform block to a buffer binding, all contexts in the share group need to reprocess the affected block index. Prior to this change, the dirty bits that indicated which blocks have their mapping redefined were placed in the program executable, and were reset by the first context that processed them. As a result, the other contexts in the share group where not aware of such modifications. Similarly, when a buffer changed in one context, the mapped program blocks were marked dirty, with similar cross-context issues. In this change, the dirty bits are moved to State, so every context would react to these changes. Bug: angleproject:8493 Change-Id: I5712002224cbc4a576bf2ac46e8e75f26ebc5b2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5238991 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi fb6b960c 2023-11-27T14:24:28 Remove GL_CHROMIUM_texture_filtering_hint This was using an unregistered Vulkan extension to set the precision of SwiftShader's internal filtering for the sake of Chrome. That's baked in at build instead. Bug: angleproject:8349 Bug: chromium:726075 Change-Id: I12849d2d29d99626f22a92ee9d74366f78658476 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5063344 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 2155534b 2023-11-06T11:49:20 Don't set dirty bits for attribs that are out of range. PrivateState::setAllDirtyBits sets all bits in mDirtyCurrentValues. When the context has fewer max attibutes than MAX_VERTEX_ATTRIBS, this can cause out-of-bounds access to PrivateState::mVertexAttribCurrentValues if the dirty bits are iterated over without range validation. Bug: chromium:1496378 Change-Id: I65481c432263a6e353a9361bba741b97dc5e20b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5008034 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Igor Nazarov 4b724130 2023-06-27T18:08:27 Rename SharedContexMutex into ContexMutex Follow up after: Replace (Single/Shared)ContextMutex classed with ContextMutex Renamed build option: angle_enable_shared_context_mutex -> angle_enable_context_mutex Renamed because there is no more SharedContexMutex class and ContextMutex is now used for both Shared and not Shared Contexts. Bug: angleproject:8226 Change-Id: I68eea84aa59441d9c5b19870910b2bb499311e08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4650350 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Igor Nazarov ca4dc52e 2023-06-22T15:20:12 Replace (Single/Shared)ContextMutex classed with ContextMutex This CL removes `SingleContextMutex` class and not 100% safe `Context::lockAndActivateSharedContextMutex()` method. `SharedContextMutex<>` was replaced with `ContextMutex` with static mutex type which is defined in "SharedContextMutex.h": - ContextMutexType = std::mutex Above refactoring also allows storing `State::mContext` by value, instead by pointer. Actual mutex is referenced by `ContextMutex::mRoot` member. This removes extra pointer indirection and slightly improves performance. If newly created Context uses shared textures/samplers, then it uses `Display::mManagersMutex` root as its root. Performance in Single/Shared cases now will be the same, and it should be slightly faster then old Shared case (because of the reduced complexity). Bug: angleproject:8226 Change-Id: I7ca4d9ea008c665cbea98ace1c6e7bbc544f54b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4632729 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@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 74cf6a3a 2023-07-12T14:44:17 Ensure lockless entry point validations only access private data Bug: angleproject:8224 Change-Id: I19e867923b088879f9f37d0a3b4ff8b681470be0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678352 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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 eb205e68 2023-07-06T13:34:28 Make the glPatchParameteri entry point lockless This entry points only sets context-local state and thus doesn't require locking. Bug: angleproject:8224 Change-Id: I17975a97aa7f68c3ddf2ef78069b8f519fdc4c1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4670405 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Igor Nazarov <i.nazarov@samsung.com>
Shahbaz Youssefi 732a8f07 2023-07-05T17:03:46 Move max-shader-compile-threads state out of LocalState While this state is indeed context-local, setting it calls into the backend (GL backend specifically, where it forwards the call to the driver). The call to set this state is rare and now worth the risk associated with making it lockless. Bug: angleproject:8224 Change-Id: I3af395721fa18b9345698870c0da63e8cac83610 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4666355 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 7e0fb7e4 2023-07-05T17:20:23 Make glIsEnabled* entry points lockless These entry points only set context-local state and thus don't require locking. Bug: angleproject:8224 Change-Id: I6fe40bf4381e1d42248358f773ec9d5675883ada Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4666356 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 72c26926 2023-07-05T16:31:23 Make pack/unpack and hint entry points lockless These entry points only set context-local state and thus don't require locking. Bug: angleproject:8224 Change-Id: I5694d319df61a7a9df1766cf1f723b9a05208209 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4666352 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 208dfe28 2023-07-05T15:18:57 Make glStencil* entry points lockless These entry points only set context-local state and thus don't require locking. Bug: angleproject:8224 Change-Id: I612d8219ba038464173490b2c261e9e7b229c83f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4661702 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c3c2f450 2023-07-05T14:52:10 Make glBlend* entry points lockless These entry points only set context-local state and thus don't require locking. Bug: angleproject:8224 Change-Id: Ie811c35ae7b65106db9af9f7531ad3a5e0bd4f8c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4661701 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> 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>
Shahbaz Youssefi 4db13081 2023-07-04T14:40:31 Make glClearColor/Depth/Stencil entry points lockless These entry points only set state that is entirely accessed by the owning context and thus don't require locking. Bug: angleproject:8224 Change-Id: I6cddee865ffd38e228f8f87dd14adffb916e0fed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4658172 Reviewed-by: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ccf8530b 2023-06-27T16:01:58 Split context state by locality of get/set effect Some state are purely local to the context when get or set. For example, the state of depth test does not affect and is not affected by any other state. Some state on the other hand may affect other contexts. In particular, some objects are shared between contexts of a share group, and may affect each other through the observer interface. These sets of state are separated to create a clear boundary between state that can and cannot be accessed without holding the share group lock. A follow up change removes locking from the entry points that purely access the former set of states. For the latter state, it is likely possible to access most if not all of them without holding a lock, but careful inspection is required before that can be considered. In particular, most entry points that simply bind an object are likely harmless if the ref counter is turned atomic. Bug: angleproject:8224 Change-Id: I91c3fa9de870c13d48012a5e06c177dab4010907 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4651375 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@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>
Igor Nazarov 36c3e0f5 2023-01-17T17:42:59 Implement "Shared Context Mutex" functionality. Existing implementation uses single `GlobalMutex` for - EGL calls - GL calls for Contexts with concurrent access. This CL introduces abstract `egl::ContextMutex` with two implementations: - SingleContextMutex; - SharedContextMutex<Mutex>; Note: `std::mutex` is used in this commit. It is very easy to change mutex type either at compile-time or at run-time (single type per Display). When Context: - is not Shared; - does not use `EGLImage`s; - does not use EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE - does not use EGL_DISPLAY_SEMAPHORE_SHARE_GROUP_ANGLE then it will be using `SingleContextMutex` with minimal overhead. Before such Context is used as `shareContext` or uses `EGLImage` its mutex replaced by `SharedContextMutex<Mutex>`. The `GlobalMutex` is only used for EGL calls, while `egl::ContextMutex` implementations for GL calls. Because some EGL calls use Context, explicit `egl::ContextMutex` lock is required. This is implemented by generating "egl_context_mutex_autogen.h" header, and insertion of `ANGLE_EGL_SCOPED_CONTEXT_LOCK()` macro before `ANGLE_EGL_VALIDATE()` in each EGL entry point. Implementation in "egl_context_lock_impl.h" returns lock for required APIs. Special cases of `egl::ContextMutex` lock handled separately. `std::unique_lock<>` is not used for performance reasons. `egl::ContextMutex` explicitly locked when capturing EGL calls. Fixes EGLImage problem: https://chromium.googlesource.com/angle/angle/+/e18240d136d15e5cdfa4fa4a6355ca21c8d807b6 Mark contexts as shared when importing EGL images. Details: - EGLImage inherits Context's mutex when created. Mutex is used when the EGLImage accessed or destroyed. - When EGLImage is used in Context with other `egl::ContextMutex`, two mutexes are merged into one. - After the mutex merge, Context Groups will remain separate, but will not be able to run in parallel. Fixes race when checking `context->isShared()` in the `SCOPED_SHARE_CONTEXT_LOCK()` macro. One Context may start executing GL call while not "Shared", but become "Shared" inside the call. New (second) "Shared" Context may immediately start using GL and potentially corrupt some "Shared" state. Possible performance benefit: allows parallel execution in some cases, when single `GlobalMutex` would block. Important note: Process of replacing the `SingleContextMutex` by `SharedContextMutex<Mutex>` is not 100% safe. This mean that original Context may still be using `SingleContextMutex` after activating `SharedContextMutex<Mutex>`. However, this was always the case before introduction of this CL. Old `Context::mShared` member update was not synchronized in any way at all. In other words, this solution does not 100% fix the original problem. For 100% safe solution `SingleContextMutex` should not be used (always pass `SharedContextMutex<Mutex>` to the `gl::Context` constructor). See `lockAndActivateSharedContextMutex()` for more details. CL adds new build option: angle_enable_shared_context_mutex = true Behavior with other build options: - When: `angle_enable_shared_context_mutex` is disabled or `angle_enable_share_context_lock` is disabled or `angle_force_context_check_every_call` is enabled, Contexts will always have `SingleContextMutex`, however it will be only used in special cases. `SCOPED_SHARE_CONTEXT_LOCK()` will use `GlobalMutex` when applicable. - Otherwise, `SCOPED_SHARE_CONTEXT_LOCK()` will use `egl::ContextMutex`. Some GFXBench "1080p Driver Overhead 2 Offscreen" performance numbers. Tested on S906B (Samsung Galaxy S22+) on old ANGLE base: https://chromium.googlesource.com/angle/angle/+/807c94ea85e046c6f279d081d99f0fb1bcf1191a Capture/Replay: Adjust tests do adhere to capture limits Each test result is an average frame number from 6 runs. SingleContextMutex 6579 ( +0.13%) (old) GetContextLock() (mShared is false) 6570 Forced `mShared = true` or NOT using `SingleContextMutex`. SharedContextMutex<std::mutex> FORCE 5061 (-22.97%) (old) GetContextLock() FORCE 4766 (-27.46%) Bug: angleproject:6957 Bug: chromium:1336126 Change-Id: Idcd919f9d4bf482b9ae489bd8b4415ec96048e32 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4374545 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 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>
Alexey Knyazev b052a5bf 2023-03-31T00:00:00 Vulkan: Implement polygon mode extensions * NV_polygon_mode * ANGLE_polygon_mode Bug: angleproject:1791 Bug: angleproject:8132 Change-Id: I2beffdad0c1569546020b78a9c6d9b8ea87c2100 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4498687 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 73f9cf00 2023-03-31T00:00:00 GL: Implement polygon mode extensions * Implemented polygon mode extensions on the OpenGL backend * Supported capture and serialization of the new commands and state * Added PolygonModeTest end2end tests Bug: angleproject:1791 Bug: angleproject:8132 Change-Id: I3bc08546a02f110dd739950129bee25ccc507bf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4492683 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@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>
Alexey Knyazev e809e7bd 2023-03-13T00:00:00 Reland "Implement EXT_depth_clamp" This is a reland of commit f8c1418319ac2aef4b3101e322005b1d0f73120f Host GPU bugs are observable in iOS Simulator Original change's description: > Implement EXT_depth_clamp > > * Added depthClamp to the RasterizerState > * Added DepthWriteTest end2end tests covering > both clipped and clamped depth writes > > Capture > * Updated serialized rasterizer state > * Updated CaptureMidExecutionSetup > > OpenGL > * Requires GL 3.2 or ARB_depth_clamp > on desktop contexts > * Maps to EXT_depth_clamp on ES > > D3D11 > * Maps to the opposite of > D3D11_RASTERIZER_DESC.DepthClipEnable > * The new tests uncover several edge cases where > a workaround is needed to implement unextended > OpenGL semantics on top of D3D > > Metal > * Maps to the setDepthClipMode command > > Bug: angleproject:8047 > Bug: angleproject:8077 > Change-Id: I1b3448e5b84443e4be18af9bc22d2f8495ac8267 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4347753 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Bug: angleproject:8047 Bug: angleproject:8077 Change-Id: I8c5f8304276c97c51b2c3382cd2764592ee0c3fe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4349938 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Yuxin Hu 4a77b0f5 2023-03-18T00:16:24 Revert "Implement EXT_depth_clamp" This reverts commit f8c1418319ac2aef4b3101e322005b1d0f73120f. Reason for revert: This change breaks angle_end2end_tests on Metal backend: https://ci.chromium.org/ui/p/chromium/builders/ci/ios-angle-intel/26035/overview Original change's description: > Implement EXT_depth_clamp > > * Added depthClamp to the RasterizerState > * Added DepthWriteTest end2end tests covering > both clipped and clamped depth writes > > Capture > * Updated serialized rasterizer state > * Updated CaptureMidExecutionSetup > > OpenGL > * Requires GL 3.2 or ARB_depth_clamp > on desktop contexts > * Maps to EXT_depth_clamp on ES > > D3D11 > * Maps to the opposite of > D3D11_RASTERIZER_DESC.DepthClipEnable > * The new tests uncover several edge cases where > a workaround is needed to implement unextended > OpenGL semantics on top of D3D > > Metal > * Maps to the setDepthClipMode command > > Bug: angleproject:8047 > Bug: angleproject:8077 > Change-Id: I1b3448e5b84443e4be18af9bc22d2f8495ac8267 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4347753 > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Bug: angleproject:8047 Bug: angleproject:8077 Change-Id: I829add68c006c72b7b4acf03aee3efa8a9a16fac No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4350876 Reviewed-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Alexey Knyazev f8c14183 2023-03-13T00:00:00 Implement EXT_depth_clamp * Added depthClamp to the RasterizerState * Added DepthWriteTest end2end tests covering both clipped and clamped depth writes Capture * Updated serialized rasterizer state * Updated CaptureMidExecutionSetup OpenGL * Requires GL 3.2 or ARB_depth_clamp on desktop contexts * Maps to EXT_depth_clamp on ES D3D11 * Maps to the opposite of D3D11_RASTERIZER_DESC.DepthClipEnable * The new tests uncover several edge cases where a workaround is needed to implement unextended OpenGL semantics on top of D3D Metal * Maps to the setDepthClipMode command Bug: angleproject:8047 Bug: angleproject:8077 Change-Id: I1b3448e5b84443e4be18af9bc22d2f8495ac8267 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4347753 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 1174582a 2023-03-06T00:00:00 GL: Implement EXT_clip_control The extension is trivially exposed if the current context supports it. * Added packed clip control enums * Removed unused state query code * Aligned symbol names with the specs Bug: angleproject:8066 Change-Id: I9d106f39800658ecc75f4525ee93cb534dc49f9e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4306770 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Cody Northrop 1148a662 2023-02-15T08:25:51 Update GL_ARM_shader_framebuffer_fetch token support These were missed during initial implementation because the target app doesn't use them, and there are no tests for vendor extensions. The implementation is basically a noop, but allows setting and querying state, unblocking apps. Also add a test that has basic usage. Test: FramebufferFetchES31.BasicTokenUsage_ARM Bug: b/269233744 Bug: angleproject:8025 Change-Id: Ic107150d4afd9c4c4984c58a1dafb1c18e608997 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4255965 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Alexey Knyazev ef0fe638 2023-01-16T00:00:00 Implement EXT_polygon_offset_clamp * Added polygonOffsetClamp to the RasterizerState * Adjusted State::setPolygonOffsetParams * Added PolygonOffsetClampTest end2end tests * Added StateChangeTestES3.PolygonOffsetClamp test * Suppressed the affected dEQP test as it has a bug Capture * Updated serialized rasterizer state * Updated CaptureMidExecutionSetup OpenGL * Rely on the EXT extension defined both for desktop and ES contexts * On desktops, might as well use the ARB extension or GL 4.6 once ANGLE supports them D3D11 * Requires FL10_0 or higher * Maps to D3D11_RASTERIZER_DESC.DepthBiasClamp * Drive-by cleanup of extensions init code Vulkan * Requires depthBiasClamp physical device feature * Maps to the depthBiasClamp parameter of the vkCmdSetDepthBias command Metal * Maps to the clamp parameter of the setDepthBias command Bug: angleproject:7957 Change-Id: If6b28df4084f0a81db29f75fb434e75d394c8730 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4169945 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi 6c41793f 2022-12-20T15:20:50 Vulkan: Use read/write depth/stencil layouts This allows an application to have depth in read-only feedback loop while stencil is being written to for example. Bug: angleproject:7899 Bug: b/192477489 Change-Id: Ic2e11d32da7c7e3a7f3cd86dbafc5c56a0dbbfd7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4116730 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 067ace47 2022-12-21T00:00:00 Add ANGLE_clip_cull_distance extension Added an extension spec. Trivially exposed it on GL, Vulkan, and D3D11. Adjusted tests and validation to allow no cull distance support for this extension string. Removed extra built-in variable definitions. Bug: angleproject:7904 Change-Id: Ic60772dfe28132c316eaa29aadc1afd66e3b0fa7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4114290 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
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 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>
Shahbaz Youssefi 135022e4 2022-10-11T00:03:11 Vulkan: Create robust pipelines based on context state Previously, pipelines were made robust based on whether any context in the share group has so far been made robust. This means that pipelines created on non-robust contexts would still be compiled as robust. Inefficiency aside, this was buggy because robustness was not part of the pipeline cache key, so if a pipeline was created as non-robust first, then recreated in a robust context, it would reuse the non-robust variant. With VK_EXT_pipeline_protected_access, a similar situation arises for context protected-ness. However, it is incorrect in that case to create pipelines as protected unnecessarily. This change makes pipeline robustness a part of the pipeline cache key, in preparation for protectedness to be added similarly. Compute programs may now generate multiple pipelines as a result too. Bug: angleproject:7629 Change-Id: Ie95f10eff878f8c8b221c1018da44385c7aad15e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3943534 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 4ebdac79 2022-08-29T16:25:46 Vulkan: Ensure we sync the draw FB before beingQuery. Bug: chromium:1354271 Change-Id: I5fe3649d9d39de37d0a59c80a4f31a17d1a72838 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863145 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Shahbaz Youssefi 2796cbfd 2022-09-15T16:18:47 GLES1: Implement logic op through ANGLE_logic_op Bug: angleproject:7654 Change-Id: I88c784d87c1cb7cb7e5ccf8f020203553513bbb3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3899381 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 97926f80 2022-09-15T00:10:49 GL: Implement GL_ANGLE_logic_op Enabled only on Desktop GL where logic op is available. Bug: angleproject:7654 Change-Id: I3c17ffb5b21abf31aec247319a625526f1bec37d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3898316 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mohan Maiya d375547c 2022-08-12T15:54:39 Do not link program pipeline in glUseProgramStages 1. The commit 3a9f18f135fe82 caused a link to occur everytime glUseProgramStages is called. This is redundant since the program pipeline can be linked just before usage, thus allowing for multiple stages to be bound before linking the executable. 2. Mark PPO as a dirty object and link the PPO in dirty object handler 3. Early return if the same program is being bound to the same stage of the pipeline. 4. Added ProgramPipelineObjectBenchmark perf test that switches programs before a draw and observed following data - 1. vulkan profile - 1. wall_time before patch - 102000 ns 2. wall_time after patch - 38000 ns 2. vulkan_null profile - 1. wall_time before patch - 125000 ns 2. wall_time after patch - 52000 ns Bug: angleproject:5102 Bug: angleproject:6566 Test: ContextNoErrorPPOTest31.*Vulkan Test: ProgramPipelineTest31.*Vulkan Test: ProgramPipelineObjectBenchmark* Change-Id: Idbc2fcb4875bbd040e9ec847eb2a8f96f287173c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3830170 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Alexey Knyazev c517463a 2022-07-28T00:00:00 Add NoUnclampedBlendColor limitation Although ES 3.0 and ES 2.0 with floating-point color buffer extensions must support unclamped constant blend color, some drivers clamp it anyway. To let applications know the effective behavior, ANGLE state management has been expanded to simulate what the OpenGL ES driver is doing. So far, this bug has been confirmed only on Adreno GPUs. Unconditionally enabled this limitation on D3D9 as it cannot support unclamped blend color by design. Bug: angleproject:7536 Change-Id: I7e28a5553e79669d8482d48c6e79bdd811971ade Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3791350 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Geoff Lang 785353fd 2022-05-24T12:40:16 Support Desktop OpenGL context creation in end2end tests Validation of Desktop GL versions and profile masks is unimplemented. Bug: angleproject:7360 Change-Id: Ifae94215b6aada895c2b02318a1d05c9515e9b96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3664916 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi 97a6e581 2022-05-30T16:50:26 Vulkan: Useful implementation of program binaries ANGLE already serializes the pipeline state for the sake of OES_get_program_binary. This serialization had limited usefulness however, since the Vulkan driver hasn't actually created any pipelines yet (which is a costly part of program creation). Simultaneously, ANGLE deferred Vulkan pipeline creation to draw time, which causes hitching. In this change, a handful of Vulkan pipelines are precreated at link time; those at least that are sure to create different blobs in the pipeline cache (different spec consts or SPIR-V generation). These pipelines are created in the program executable's cache. The cache is then merged into the shared renderer cache (for potential blob reuse by other programs). With this, two goals are achieved: - Most pipelines created at draw time hit the pipeline cache, avoiding costly compilation. - When the program binary is retrieved, the contents of the program executable's pipeline cache is also returned. On reload, the cache is recovered, resulting in faster startup. Bug: angleproject:5881 Change-Id: I46c5451a7d0b16dffd40e44015e094640886880b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671977 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi fea19567 2022-05-17T17:44:06 Vulkan: Remove removeEarlyFragmentTestsOpt flag * Removed removeEarlyFragmentTestsOptimization and the related SPIRV transformation and variables. * Removed mUsesEarlyFragmentTestsOptimization. * Removed SH_EARLY_FRAGMENT_TESTS_OPTIMIZATION. * Merged updateUsesEarlyFragmentTestsOptimization() into updateFragmentInoutRange(). Bug: angleproject:7347 Change-Id: I7299bd4e8ab5363e5cf06eb48419d4f469106e12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3648217 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi bb3afdf4 2022-05-17T16:08:06 Drop support for 64xMSAA+ Hardware that supports anything more than 32xMSAA is rare (practically only Nvidia). That high number of samples is hardly useful either way. This change reduces the number of words for the sample mask to 1, reducing the amount of state needed to track it. Bug: angleproject:7328 Change-Id: Iea9add1cbeef494ff9bb383b10c82b839d1e53a4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3652738 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 21ad9b3c 2022-04-07T09:57:26 Vulkan: Add generic descriptors for DS cache. With the new design, the descriptor set cache keys include all identifying information needed to reconstruct the update descriptor sets calls except the specific resource handles. The places for the resource handles are held by serials intead. When we miss the cache, we no longer need a second step to then construct the update calls, and can build the update calls directly from the key structures in combination with a list of resource handles. Bug: angleproject:6776 Change-Id: If1660a557585a75e9aa2560d6a38c56b62f555c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484981 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 02b96848 2022-04-21T16:32:31 Vulkan: Add support for GL_QCOM_shading_rate Layer GL_QCOM_shading_rate over VK_KHR_fragment_shading_rate Test: ShadingRateQcomTest* Bug: angleproject:7172 Change-Id: I3f040dbfad3906facd4349937fed2ce9a464b824 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3599874 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Alexey Knyazev 62ca6449 2022-04-13T09:36:40 Reland "Fix BlendStateExt::mMaxColorMask initialization" This is a reland of commit 50d008a7efcab80f34eb742148d05389b2ed247e Besides fixing the BlendStateExt color mask initialization bug, the following changes were made: * All fields were made private with accessor functions. * A new assertion was added that ensures 64-bit storage for factors and equations. This allowed dropping one redundant mask. * Two new helper functions were added. * BlendStateExt::mMaxDrawBuffers was renamed to mDrawBufferCount. * The BlendStateExt class is now aligned to 8 bytes with an assertion. * Expanded test coverage. Also fixed incorrect usage of BlendStateExt fields in: * StateManagerGL::syncBlendFromNativeContext * StateManagerGL::restoreBlendNativeContext Original change's description: > Fix BlendStateExt::mMaxColorMask initialization > > This variable should not have its unused bits set. > > To avoid confusion with other masks of the same class, > the variable was renamed to mAllColorMask. > > Bug: angleproject:7200 > Change-Id: I72542d49ff8da3dbb8d61c5034ce37c1e8fcc6e1 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3581990 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Bug: angleproject:7200 Change-Id: I87a5fe0f9dfbbf5e525b9120f772aa9adb39ce5f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3593234 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Yuxin Hu cdd97fb8 2022-03-24T17:41:30 Reland "Vulkan: Fix invalid access with display texture share group." This is a reland of 1099b5ef2279cfe1988a39c8e011aada59c650f1. Original change's description: > Vulkan: Fix invalid access with display texture share group. > Create bufferpool that owns by RendererVk. > If we are using EGL_ANGLE_display_texture_share_group > extension, use the bufferpool owned RendererVk, > otherwise, use the bufferpool owned by EGL::ShareGroup. > The bufferpool lifetime will remain consistent with > texture lifetime. > Bug: chromium:1299211 > Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: chromium:1299211 Change-Id: I4b8f5bcb30297f2c5f24e02404fd96011f9d843b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3550038 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shrek Shao 73ec28af 2022-03-23T21:13:45 Revert "Vulkan: Fix invalid access with display texture share group." This reverts commit 1099b5ef2279cfe1988a39c8e011aada59c650f1. Reason for revert: suspect culprit of 1309304 Original change's description: > Vulkan: Fix invalid access with display texture share group. > > Create bufferpool that owns by RendererVk. > If we are using EGL_ANGLE_display_texture_share_group > extension, use the bufferpool owned RendererVk, > otherwise, use the bufferpool owned by EGL::ShareGroup. > The bufferpool lifetime will remain consistent with > texture lifetime. > > Bug: chromium:1299211 > Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: chromium:1299211, 1309304 Change-Id: Ibdc119ef6bb52352858114d72a0f1c0edcd4da5e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3546288 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shrek Shao <shrekshao@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Yuxin Hu 1099b5ef 2022-03-17T17:20:44 Vulkan: Fix invalid access with display texture share group. Create bufferpool that owns by RendererVk. If we are using EGL_ANGLE_display_texture_share_group extension, use the bufferpool owned RendererVk, otherwise, use the bufferpool owned by EGL::ShareGroup. The bufferpool lifetime will remain consistent with texture lifetime. Bug: chromium:1299211 Change-Id: Ie4e87cea1dfd20dabab24e2afed6ddd92e469888 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531155 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Mohan Maiya 29e25468 2022-01-07T07:02:53 Account for EGL 1.5 version when dealing with robustness EGL 1.5 spec allows for EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY and EGL_CONTEXT_OPENGL_ROBUST_ACCESS enums to be passed in to eglCreateContext. Update the validation layer and queries to account for the new enums. Bug: angleproject:6883 Tests: KHR-NoContext.es32.context_flags.*flag* Tests: KHR-NoContext.es32.robustness.*reset* Change-Id: I7088e0dca08cea2cfdcf1877b6d999c0e0336e5e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3373133 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Jamie Madill 3064920a 2022-01-19T11:48:57 Capture/Replay: Serialize ActiveTexturesCache. Also add group scope to samplers. Bug: angleproject:3570 Change-Id: I616a54d95544af1e3c4eeff196806e5bfb20292e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3402100 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 158ecba6 2022-01-07T16:40:26 Vulkan: Remove cached Impl pointers from ContextVk. These pointers were a common source of programming error, where sometimes they wouldn't be updated when they were needed. Instead we can pull the objects directly from the GLES state. We added them initially to attempt a performance improvement, but it's likely they didn't significantly decrease memory accesses or the number of instructions we process for GLES calls. Hence removing them should be an improvement in safety without a perf loss. Bug: angleproject:6864 Change-Id: I54107686992065a514077c71d173b804e295515e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3378904 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Yuxin Hu ef637366 2021-11-19T22:38:56 Revert the order of texture sync and frame buffer object sync This change reverts the sync order swap done in CL a280c671f178daf73da447d1030773b58b534998, to address a performance issue in TRex. The crash that sync order swap was trying to resolve was addressed by another CL 0fcad6260a3e3943fb84657a3a7f488d1e155fb7. Bug: angleproject:6014 Change-Id: Ie49628295b6dcd5d012dc795bf123865b1a7f893 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3292636 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 3a9f18f1 2021-10-18T10:44:38 Refactor program pipeline handling. In preparation for moving more code from gl::Program to gl::ProgramExecutable so it can be shared with ProgramPipeline. Bug: angleproject:6566 Change-Id: Icb7ecccb37ae8e0d7d5fef8968f0dd7ef6fe6150 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3226305 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 49ac15a5 2021-09-20T11:29:01 Optimize VAO bindings. This CL makes the XFB binding tracking WebGL-only. That will speed up VAO binding changes in non-WebGL considerably. Also has a few inline micro-optimizations that may not have a large effect. Bug: angleproject:6371 Change-Id: Ib0a26a3b956dcd6ff78626e5cd6514b46270d882 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3170116 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1ca1589f 2021-09-13T10:56:58 Give GLES extension bools a vendor suffix. This is in preparation for auto-generation which will give all of these bools suffixes. Bug: angleproject:6379 Change-Id: I7e3f6c9b644c41a2165e6bf7b62d661fd352a250 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3158503 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi df957576 2021-08-31T23:02:51 Avoid redundant blend state dirty bit setting This change no-ops a number of blend-related state setting functions when the state doesn't actually change given the parameters. Bug: angleproject:6298 Change-Id: I156e20685089aa71bd64eae560153e5def891d63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3133823 Reviewed-by: Sunny Sun <sunny.sun@arm.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>