src/libANGLE/renderer/vulkan/ContextVk.cpp


Log

Author Commit Date CI Message
Jeff Vigil d2b659f9 2021-03-25T15:40:58 EGL: implement EGL_EXT_protected_content Context Add Validation check to Contexts and Surfaces Add Vulkan protected memory features and properties Add protected member to Surfaces and Contexts Implement hasProtectedContent in Vulkan Add QueueFamily helper, extent DeviceQueueMap Protected Swapchains always on for Android Add EGLProtectedContentTest Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: I9352b1e594f71bb4e89cee7137a468940d186b1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2800413 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 5c8bf081 2021-06-08T13:12:24 Vulkan: Add support for YUV internal format extension 1. Add a function to upload YUV image data to textures 2. Modify stageSubresourceUpdate method to account for YUV images 3. Create VkSamplerYcbcrConversion when initializing ImageHelper 4. Update hasImmutableSampler to account for native YUV format support 5. Skip initializeNonZeroMemory for YUV formats Bug: angleproject:5773 Test: Texture2DTestES3.TexStorage2D*Yuv*Vulkan* Change-Id: I270f04bbf903cf2bf19f100eb95f32953d491c39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2947767 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 223cd0ac 2021-06-15T18:46:07 Capture/Replay: Refactor shared context handling This is the initial CL to enable capture/replay of multi-context applications. This CL refactors FrameCapture and FrameCaptureShared to move much of the functionality into FrameCaptureShared, since most everything is shared by Contexts in the share group. For example, the setup of the majority of the GL objects is done in the new SetupReplayContextShared() function in the new $LABEL_capture_context_shared_frame001.cpp file. The setup is performed by (for example): void SetupReplay() { $LABEL::InitReplay(); $LABEL::SetupReplayContextShared(); SetupReplayContext2(); } This performs the shared setup first, followed by the context-specific setup, which may reference shared objects careated by LABEL::SetupReplayContextShared(). No re-capturing is required with this change, since the external APIs (i.e., SetupReplay()) are still the same. Bug: angleproject:5878 Test: Manual MEC and replay of Magic Tiles 3, Candy Crush Soda Saga, Temple Run 2 Change-Id: Iab7bfe651437e9be1dee83514cd97acc20c61d1d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2965780 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 715a49c7 2021-07-03T08:48:07 Vulkan: Handle incompatible immutable sampler formats If the immutable sampler format of an active texture is not compatible with those supported by the pipeline layout, recreate the pipeline layout. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Test: ImageTest.SourceAHBTarget2DExternalCycleThroughYuvTargetsNoData*Vulkan Change-Id: Iea78e1738ea2fb133a24dc88f5b68daf4cc1bdfe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2997289 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jason Macnak 7c4404da 2021-07-09T13:37:29 Vulkan: update D/S state in ContextVk::onFramebufferChange ANGLE needs to ensure that the stencil test is correctly handled when framebuffers are cleared before stencil attachments are configured. Adds two stencil tests for clearing fbo before stencil attached which fail before this change and which replicate the behavior of CtsNativeHardwareTestCases's StencilAffectsDrawAcrossContexts. BUG=b/192315789 TEST=newly added tests on Cuttlefish Change-Id: I58d97af97d3f78787051b069d2594041ccd2bfba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3018486 Commit-Queue: Jason Macnak <natsu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 913eb916 2021-06-28T12:51:12 Vulkan: (Mostly) re-unify secondary command buffer interfaces SecondaryCommandBuffer and CommandBuffer in vk_wrapper had diverged in API, which this change helps alleviate to some extent. Bug: angleproject:6100 Change-Id: I0d59b24c659afbaf58865b3d85f275c545e3acce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2987872 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Mohan Maiya e2881e25 2021-06-27T10:45:41 Vulkan: Handle incompatible pipeline layouts It is necessary that a pipeline layout be compatible with active textures. Make sure to recreate the pipeline layout otherwise. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Test: ImageTest.SourceAHBTarget2DExternalCycleThroughRgbAndYuvTargets*Vulkan Change-Id: Iab371a9035b6cd143585e5000e2e68c7302ef447 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2992056 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4375d6c7 2021-06-18T23:51:23 Vulkan: Support multiview queries When using queries with multiview, Vulkan specifies that N queries are actually produced (N being the number of views) which must be summed by the application. Bug: angleproject:6048 Change-Id: I5ea615536f1a357806b7ea8093280b9122f1d66a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2971562 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b6adeb2f 2021-06-21T11:11:30 Vulkan: Use pipeline statistics query to emulate primitives generated The VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT query produces the same result as the GL primitives generated query. One caveat is that in combination with rasterizer discard this query may not work. This is emulated by disabling rasterizer discard when this query is active and applying an empty scissor instead. When VK_EXT_primitives_generated_query is released and supported, a similar issue with rasterizer discard persists so this change will facilitate using that extension as well. Bug: angleproject:5430 Change-Id: Id45b6f058c5cb6837e04aa64b1efde28c104e4cf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2976181 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Ian Elliott 3706f9eb 2021-06-10T18:45:15 Vulkan: Fix AGI hierarchy crash for noop'd clears/queries The ASSERT in ContextVk::endEventLogForClearOrQuery() was wrong. Certain glClear*, glBeginQuery*, and glEndQuery* commands may exit early (e.g. noop). When this happens, mQueryEventType will be set to NotInQueryCmd. In such cases, return without trying to finish a non-started debug-util-marker hierarchy. Bug: b/191489405 Change-Id: If40ed00fdc6e420ae6a11c2aeaced19e5aa45a5f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2973342 Reviewed-by: Trevor David Black <vantablack@google.com> Reviewed-by: Mark Lobodzinski <mark@lunarg.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Cody Northrop 851fbedb 2021-06-10T21:27:01 Vulkan: Switch viewport and scissor to dynamic state Heavily based on http://crrev/c/1316888 Some apps are creating a large number of viewport combinations and are running out of graphics memory. This CL drops their graphics pipeline use from tens of thousands to tens. Performance testing shows little impact to application traces. Bug: b/190026813 Bug: angleproject:3143 Change-Id: Ib7415be1128f8fedae4a7ca72e067b2815201223 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954925 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexis Hetu 4fbb6f43 2021-06-14T18:20:06 Vulkan: Fix accessing index buffer with uninitialized memory This was discovered by Clusterfuzz on MacOS. The issue was that is index buffer of a draw indexed call was missing, causing SwiftShader to access uninitialized memory, leading to the ASAN crash. The missing index buffer was caused by DIRTY_BIT_INDEX_BUFFER not being set. This was in turn caused by ContextVk::flushDirtyGraphicsRenderPass() not setting dirty bits not included in the dirtyBitMask, despite needing to be set for future processing. Bug: chromium:1183068 Bug: chromium:1190493 Change-Id: I65b398d8737b3df5fd51a03a2c8074a774a94a81 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2961690 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Ian Elliott ebf75698 2021-06-10T18:55:04 Vulkan: Fix AGI clear hierarchy bug for clear commands This approach properly handles outside-render-pass clears. Bug: b/190622922 Change-Id: Ia4a9d6ec13d7da8c4a445af1127e82c03f37e8b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2951960 Reviewed-by: Mark Lobodzinski <mark@lunarg.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Ian Elliott 1fcbf77c 2021-06-10T16:02:31 Vulkan: Fix AGI hierarchy for query commands Treat glBeginQuery* and glEndQuery* commands the same as glDraw* commands, generating a hierarchy. This results in vkCmdBeginQuery and vkCmdEndQuery commands being nested under gl*Query*, instead of being a peer of glDraw* commands. This change necessitated plumbing some of the existing "end" path to return angle::Result. Bug: b/190512191 Change-Id: I898d3fdd9b4b7d86e76dfae2ffc5d6f7316a55ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2950926 Reviewed-by: Mark Lobodzinski <mark@lunarg.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Mark Lobodzinski 4bafc503 2021-06-01T10:59:17 Vulkan: Fix AGI hierarchy for clear commands Treat mid-render-pass glClear* commands the same as glDraw* commands, generating a hierarchy. This results in vkCmdClearAttachment commands being nested under glClear, instead of being a peer of glDraw* commands. Bug: b/183547523 Change-Id: Ibc6900b0485fd174d79c8fe6c94ea17dbefa520b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2941364 Reviewed-by: Mark Lobodzinski <mark@lunarg.com> Reviewed-by: Mike Schuchardt <mikes@lunarg.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Mark Lobodzinski 0a6c6c00 2021-06-01T10:59:17 Vulkan: Submit Dispatch commands outside renderpass Compute dispatch commands must be submitted outside a renderpass, but their associated debug event markers were being submitted on the renderpass commandbuffer. The dispatch debug event markers are now handled separately from those for draw calls and are now submitted on the correct commandbuffer. Failure manifested in malformed AGI traces for Ragnarok M: Eternal Love Bug: b/181611786 Change-Id: I768eeccd76be38818fc99d6d56f5899290c8fc5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2930818 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Mohan Maiya 26a54260 2021-05-26T16:53:29 Reland "Vulkan: Handle immutable sampler state change in TextureVk" This is a reland of 349c08300e08bc809c448d62e0ad969ecb17c047 Skip YUV tests on Pixel2 Original change's description: > Vulkan: Handle immutable sampler state change in TextureVk > > Transitioning between sources in RGB and YUV colorspace or between > YUV formats with different layout should force the recreation of > pipeline layout and the invalidation of texture's sampler. > > Only textures that are EGLImage targets are handled for now. > > Bug: b/155487768 > Bug: angleproject:5033 > Bug: angleproject:5773 > Test: ImageTest.SourceAHBTarget2DExternalCycleThrough*Vulkan > Change-Id: I02d5763e7f89b910313e14b57bfc5403113dfbb2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2924415 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Change-Id: Ie3791bc6f6e9b53eb0db23759a14fdc038c8f5b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939354 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Sunny Sachanandani 03d8e7c9 2021-06-04T21:22:52 Revert "Vulkan: Handle immutable sampler state change in TextureVk" This reverts commit 349c08300e08bc809c448d62e0ad969ecb17c047. Reason for revert: anglebug.com/6028 Original change's description: > Vulkan: Handle immutable sampler state change in TextureVk > > Transitioning between sources in RGB and YUV colorspace or between > YUV formats with different layout should force the recreation of > pipeline layout and the invalidation of texture's sampler. > > Only textures that are EGLImage targets are handled for now. > > Bug: b/155487768 > Bug: angleproject:5033 > Bug: angleproject:5773 > Test: ImageTest.SourceAHBTarget2DExternalCycleThrough*Vulkan > Change-Id: I02d5763e7f89b910313e14b57bfc5403113dfbb2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2924415 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Bug: angleproject:6028 Change-Id: Ib8b3b54ff61f26910df2af4a6b894b3d2d5906bb No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2941547 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Mohan Maiya 349c0830 2021-05-26T16:53:29 Vulkan: Handle immutable sampler state change in TextureVk Transitioning between sources in RGB and YUV colorspace or between YUV formats with different layout should force the recreation of pipeline layout and the invalidation of texture's sampler. Only textures that are EGLImage targets are handled for now. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Test: ImageTest.SourceAHBTarget2DExternalCycleThrough*Vulkan Change-Id: I02d5763e7f89b910313e14b57bfc5403113dfbb2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2924415 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Ian Elliott 152450f8 2021-06-02T15:38:35 Fix ContextVk::handleNoopDrawEvent() for when no cmd buffer ContextVk::handleNoopDrawEvent() was created to handle no-op glDraw*'s. However, it assumed/assert'd a valid mRenderPassCommandBuffer. That is not always the case. Fix this by having handleDirtyEventLogImpl() check for a valid command buffer. Bug: b/189967673 Bug: b/184888395 Change-Id: Ice7c5da842a6f41f27c24af8e858147d01be86bc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2935756 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Charlie Lao b6bd039c 2020-10-06T13:34:53 Vulkan: Fine-grained depth stencil layout transition barrier Gfxbench Manhattan uses depth attachment as texture in the same render pass, which creates a feedback loop. The layout we are using for this has kAllShadersPipelineStageFlags even though it only used by fragment shader. This creates an unnecessary vertex/fragment dependency that hurts performance on some mobile GPUs. This CL split DepthStencilReadOnly to DSAttachmentReadAndFragmentShaderRead, DSAttachmentReadAndAllShadersRead, and DepthStencilAttachmentReadOnly, so that if it is used by fragment shader, we only barrier against fragment stage. If not used by any shader, we don't block any shader stages. To make names consistent, this CL also renames DepthStencilAttachmentAndFragmentShaderRead to DSAttachmentWriteAndFragmentShaderRead, renames DepthStencilAttachmentAndAllShadersRead to DSAttachmentWriteAndAllShadersRead. Bug: b/169891513 Change-Id: Iede497e8af028861f9166a32d122f26dc7aa864a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2453599 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
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>
Charlie Lao 09dad082 2021-05-07T17:28:15 Vulkan: Add feature flag to flush at framebuffer boundary Testing shows most app traces seeing performance improved on ARM GPU when we flush at FBO boundary instead of one submit per frame. This likely due to more frequent submission means less chance of GPU starvation. This also helps ANGLE to detect GPU finish at finer grain since the queue serial is per submission. Finer grain detection of object completion means memory gets recycled quicker and mapBufferRange able to hit fast code path more often. With this CL, manhattan 3.1 offscreen score also score improves 7%. This may also helps onscreen performance if frame time is on the edge of 16ms by submit FBO rendering earlier instead of been blocked by vkAcquireNextImage. Bug: b/187993625 Bug: angleproject:5295 Change-Id: I2946a7159231d36019ace89805a69ac8e906ce94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2888709 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi e354ff1a 2021-03-05T04:07:21 Vulkan: Allow DynamicBuffer suballocation in BufferVk When allocations are made from DynamicBuffer, they suballocate from a possibly larger BufferHelper. In BufferVk, the offset of the suballocation was discarded, which limited the use of DynamicBuffer to a pool of small buffers. This change applies any such offset that may arise from suballocations everywhere, and makes BufferVk use a larger buffer size when the GL_DYNAMIC_* buffer usage hints are provided. Bug: angleproject:5719 Change-Id: I3df3317f7acff1b1b06a5e3e2bb707616a7d0512 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2738650 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill ccc0fbaa 2021-03-24T17:56:38 Vulkan: Related fixes for buffer descriptor set cache. Includes some stats counter gathering and a few related refactors and cleanups. Also includes a new overlay widget. Bug: angleproject:5736 Change-Id: Ida8d2cd815c5b598c6a442dd9bbfdf51e9c05180 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2785431 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill be7049d7 2021-04-20T10:03:33 Vulkan: Redesign buffer descriptor set cache key. Instead of writing the bitset masks, iterate up until the last active buffer. Write zeros instead of skipping spaces. This is a bit simpler to implement and also fixes a bug where empty buffers could cause us to write invalid handles. Bug: angleproject:5736 Change-Id: I785ef18ef5ae45109ec7d6e0b079b79a9984a1f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2837848 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Ian Elliott e167d453 2021-04-21T14:14:33 Vulkan: Allow logging with VVL and/or AGI debug utils to be used A recent change allowed logging API commands on Android to be used with Vulkan Validation Layers (VVL). That broke debug utils for AGI (i.e. when the ANGLE-built VVL is not being used). This allows both use cases to be supported. Bug: b/183133198 Change-Id: Ide83ed63fad99d0eca97998365276a1ef365a4e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2842325 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Geoff Lang b574643e 2021-04-19T12:47:05 D3D11: Skip blits if there is no intersection of dest areas Blit11 would clip the destination rectangle with the destination size but ignore the result. gl::ClipRectangle returns false when the rectangles do not intersect at all, indicating the blit can be skipped. This could lead to an out-of-bounds write to the GPU memory for the destination texture. Mark ClipRectangle as nodiscard to prevent future issues. Bug: chromium:1199402 Change-Id: I260e82d0917b8aa7e7887f2c9f7ed4b1a03ba785 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2836786 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Jamie Madill 0c77f3ad 2021-03-10T15:58:00 Vulkan: Implement shader buffers descriptor cache. Implements a descriptor set cache for UBOs, SSBOs, and atomic counter buffers. Storage Images and framebuffer fetch input attachments are not yet included. Requires moving the buffer barrier handling into ContextVk, similarly to how we handle the barriers for Textures. The packed description key for the descriptors uses a "fast" vector with a basic minimum size. For most cases of a few buffers this will fit easily in stack memory, but for larger programs with many buffers we fit this into heap memory. The key has a large upper bound due to the high ES 3.2 requirements and the need to index several values such as the offset and binding size. We use dynamic offsets for uniform buffers when possible. This ensures applications like Manhattan 3.1 that use sets of common buffers with changing offsets hit the cache most of the time. Because of resource limits we pick at compilation time whether to use dynamic or static descriptor sets. Mostly this applies to tests that use a large number of uniform buffers. A future implementation could be smart and would recompile the program with heuristics to use a minimal number of dynamic indices. Reduces the number of descriptor set updates from ~300 -> ~30 per frame in Manhattan 3.1 and in Asphalt 9 from 900+ to as low as 0 per frame. Bug: angleproject:5736 Change-Id: I5c2a3881bec90d301dab15cc86c8a70e60674ad7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2757515 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao fb288312 2021-04-12T12:38:03 Vulkan: Consolidate mReadOnlyDepthStencilMode to mRenderPassUsageFlags Since now ImageHelper object has a mRenderPassUsageFlags tracking how it is been used by current RenderPassCommands, we can consolidate mReadOnlyDepthStencilMode into a bit in the mRenderPassUsageFlags. The read only mode is just a special attachment mode, so this makes code more consistent and able to get rid of the extra dword for mReadOnlyDepthStencilMode. Bug: b/181797383 Change-Id: Ie9b7be1c18c392e5b2712bdae6ab6506de8d6d34 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2821942 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 5eac3169 2021-04-09T15:54:11 Vulkan: Support sample/render to depth texture with different LOD Previously we supported read only depth attachment that attachment and sample are using the same texture. It was always assuming it will be read only if the same texture is attached to FBO and same time bound to texture unit. But we never supported if it actually writing to depth texture, but at the different level with sampling. This is supported OpenGL operation as long as the levels render to is outside [base_level, max_level]. Later on, we added support of the above operation, but limited to color buffers. This CL extends the same support of render and sample to the same depth texture with non-overlapping levels. Android game black desert mobile is running into this usage case. Bug: b/181797383 Change-Id: I7ee1d52f27603f933102ad1b098684309449c406 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2819487 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Ian Elliott 9c51f93d 2021-04-12T16:49:53 Don't call {begin|end}DebugUtilsLabelEXT() when not enabled The ContextVk::handleDirtyEventLogImpl() and ContextVk::endEventLog() methods called the {begin|end}DebugUtilsLabelEXT() methods when the VK_EXT_debug_utils extension is not enabled. This manifests when enabling/using VVL stand-alone (i.e. when the the debug-utils extension is not also present). Bug: b/183133198 Change-Id: I043b174d457a8796831184c092661f24b33c1db4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2821943 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten d3e1a7ff 2021-03-29T16:21:23 Reset mCurrentGraphicsPipeline in ProgramExecutableVk::reset ContextVk::mCurrentGraphicsPipeline should be reset during ProgramExecutableVk::reset() since programInfo.release() frees the PipelineHelper that it's pointing to. This has resulted in several use-after-free errors, which this CL will prevent in the future. Bug: angleproject:5624 Bug: b/182409935 Change-Id: I847bb7eb5b593c89b84f0fbbca23ea5367f5f55c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2792861 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Charlie Lao fd3b8faf 2021-03-30T11:55:49 Vulkan: Split fragment shader from ColorAttachmentAndAllShadersRead Even though it is not common usage case that the same texture is used as attachment and texture, but aztec ruins is using it. And earlier version of gfxbench's T-Rex also running into this. So performance is still important. This CL splits the texture from fragment shader usage case out so we can have lighter barrier. Bug: angleproject:5780 Change-Id: Ifdcbfe24488fdac62826c5af6ecfbb05f87c0499 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2795269 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 572fd801 2021-03-22T16:14:34 Vulkan: Rename Uniforms/XFB descriptor desc. The new name is more consistent with the other names. Refactoring change only. Bug: angleproject:5736 Change-Id: Idc47fef29040e3a422267795c4536163a6f8eb4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2779953 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 02acc5ee 2021-03-18T16:08:59 Vulkan: More cleanups to perf counters. This refactors the pipeline type in the ContextVk class to also use a packed enum map. It also expands the object perf counters to store both a specific and cumulative version for use in different cases. Bug: angleproject:5736 Change-Id: I6ff78e38065eb577f2b95b1d9c4f9cc31d7f325f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2774184 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 867411a4 2021-03-08T19:08:14 Vulkan: Track images used for both attachment and sampler This CL adds a new layout ImageLayout::ColorAttachmentAndShaderRead. We detect that the same ImageHelper object is used for both sampler and attachment and will pick this new layout instead of ColorAttachment. Bug: b/175584609 Change-Id: I2089f59d4dc1ad4de7edab0e067797adcfa9b020 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2749479 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao da437f26 2021-03-08T19:08:14 Vulkan: Defer color image layout changes at endRenderPass time Right now color render target's image's layout change are done at beginRenderPass time. The problem is that the layout also depends on whether texture is also being used as a sampler or not. That information is not known when renderpass starts. We did some special treatment for depth stencil attachment so that its layout determination is deferred until endRenderPass time. This CL expands that same mechanism to color attachment as well. Right now the color attachment will still pick the same ImageLayout::ColorAttachment layout since the logic to detect it is also used for texture sampling is not there yet. Bug: b/175584609 Change-Id: Id7486174d475f894461578b31d0d40fdd90e808a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2744121 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill b717952e 2021-03-18T10:39:34 Vulkan: Use packed enum map for descriptor set index. This simplifies a lot of the data structure indexing in the program executable class. Also renames the "DriverUniforms" and "InternalShader" index into a single "Internal" index. Bug: angleproject:5736 Change-Id: I2a51d8b14d5b16b438dbe636f77b11bbc045ba9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2773321 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 81dcf078 2021-03-08T11:21:31 Reland "Vulkan: Support EXT_sRGB_write_control" This is a reland of 6073af536cf627742696823edc82c9b0a481a8bc with 2 changes - 1. Don't enable the extension even in nonConformant mode 2. Don't enable VK_KHR_image_format_list for swiftshader Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075 Change-Id: I8e149d196a39c3c4769bfa8690792f3c53831299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2762647 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 629f66ce 2021-03-16T00:34:16 Vulkan: Fix missing dirty bits for compute In the following scenario: - Dispatch - Flush outside render pass commands - Dispatch The second dispatch doesn't rebind the pipeline because it assumes it's recording to the same primary command buffer. This assumption is broken if another thread causes a submission before the second dispatch. It's also broken if using Vulkan secondary command buffers. Bug: b/181711029 Change-Id: I5335be95208f41724cf8e9c60ae5322ad91840fd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2763143 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 89d2a96a 2021-03-09T18:37:57 Vulkan: Add test for UBO descriptor allocations. This performance counter test verifies that re-binding the same two buffers repeatedly doesn't allocate new descriptor sets. Currently the test fails because we don't cache descriptor sets for UBOs. Covers equivalent code patterns in Asphalt 9. Reorganizes the perf counters collected for the program objects. Now they are per-frame reset instead of cumulative. This tracking is now consistent for the different counter types. In the future we can add cumulative tracking for all per-object and global perf counters. Bug: angleproject:5736 Change-Id: I23d04b6453e38af1cf4af7274d24382d136efad3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2746176 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 920cb58b 2021-03-09T23:02:40 Vulkan: Fix MemoryBarrier function name typos Bug: angleproject:5070 Change-Id: Ic0c3de4380d02d150e2f52690ded9dfcc07b4575 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2747854 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Peng Huang b27740f3 2021-03-09T16:15:15 Revert "Vulkan: Support EXT_sRGB_write_control" This reverts commit 6073af536cf627742696823edc82c9b0a481a8bc. Reason for revert: crbug.com/1186140 Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075,chromium:1186140 Change-Id: Ib0d4d60fe7434fb950f99db2c210aab9af7d2d0e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743663 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Peng Huang <penghuang@chromium.org>
Mohan Maiya 6073af53 2021-03-08T11:21:31 Vulkan: Support EXT_sRGB_write_control Implement support for EXT_sRGB_write_control. This extension requires VK_KHR_image_format_list to be supported. The spec requires this functionality to work with glBlitFramebuffer as well but support for that will be added in a follow up change. As such, this extension is only exposed in non-conformant mode. Bug: angleproject:5075 Tests: SRGBFramebufferTest.*Vulkan* Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e366e2c3 2021-02-27T01:00:02 Vulkan: Keep dynamic buffer's free list trimmed ContextVk's staging buffer never gets a chance to free its free buffer list. During application load time, a large amount of memory may be allocated from this buffer to stage texture updates and they would remain throughout the life of the application. This change ensures that the free buffer list doesn't grow unbounded. In the Manhattan trace, this saves >1GB of memory on Linux. There are now three policies for vk::DynamicBuffer: - Always reuse buffers: This is useful for dynamic buffers that make frequent small allocations, such as default uniforms, driver uniforms, default vertex attributes and UBO updates. - Never reuse buffers: This is for situations where the buffer is unlikely to be used after some initial usage, such as texture data upload or vertex format emulation (as the conversion result is cached, so it's never redone). - Limited reuse of buffers: For the staging buffer in the context which is shared by all immutable texture data uploads, it's useful to keep a limited number of buffers (1 in this change) to support future texture streaming while allowing a large number of buffers allocated in a burst to be discarded. Bug: angleproject:5690 Change-Id: Ic39ce61e6beb3165dbce4b668e1d3984a2b35986 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2725499 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 07025aa3 2021-03-02T00:28:32 Overlay: Widget for vk::DynamicBuffer allocations Bug: angleproject:5690 Change-Id: Idfa591903627bbebffe306b387e95cbec1195338 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2725767 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 67333608 2021-02-25T14:15:33 Vulkan: Check texture type before calling into feedbackloop check In ContextVk::updateActiveTextures we end up calling this method shouldSwitchToReadOnlyDepthFeedbackLoopMode(...) for every active texture. Since color textures are more numerous than depth, check the texture type beforehand to decrease function stack depth. This removes 0.5% CPU overhead from a Manhattan30 offscreen run Bug: angleproject:5689 Change-Id: I14758b031e58b269392b4f450a5bb1ba8edabb44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2723493 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 550f2a3e 2021-02-24T09:49:42 Vulkan: Shader support for EXT_shader_framebuffer_fetch_non_coherent Translator can accept gl_LastFragData and 'inout' variable to gain access to framebuffer attachment data. The Vulkan translator replaces it with the SubpassInput type variable. Note that this works only for the noncoherent version of the extension. Bug: angleproject:5454 Test: *EXTShaderFramebufferFetchNoncoherent*.* Change-Id: I392f84ee3ad3eb9fbd09d0b7ff83731a9a3f33f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598060 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 999da35e 2021-02-18T17:29:20 Vulkan: Optimize glMemoryBarrier more The implementation assumed that the X_BARRIER_BIT bits implied two barriers; write->X and X->write. However, they only imply write->X, with the exception of SHADER_IMAGE_ACCESS_BARRIER_BIT and SHADER_STORAGE_BARRIER_BIT which handle X->write for images and buffers respectively. As a result, the other bits no longer set the MEMORY_BARRIER dirty bit as they don't guard against X->write usage. Bug: angleproject:5070 Change-Id: Id23904c455a5f56dc45fc6832a74fdfbba6a4827 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2705702 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 39d7fc18 2021-02-17T00:18:41 Vulkan: Don't break the render pass on dispatch calls The only reason a dispatch call may need to break the render pass implicitly is for read-after-writes where the write originates from the render pass but is not through a storage buffer/image. There are only two such scenrios possible: - Framebuffer attachment write -> texture sample - Transform feedback write -> ubo read All other uses of the buffers and textures that require breaking the render pass are handled by `glMemoryBarrier`. Bug: angleproject:5070 Change-Id: I92b50d69d8782097ee8ff477ac57da6209c326a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2698998 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 6e8cdd39 2021-02-17T00:17:17 Vulkan: Don't break the render pass on indirect calls The render pass is now only broken if the indirect buffer was used as transform feedback. Any other write to the indirect buffer is synchronized with `glMemoryBarrier`. Bug: angleproject:5070 Change-Id: I67868ae9a8f08e1ab186440a3cbdc7439c66808e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2698996 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e96d1744 2021-02-12T14:14:02 Vulkan: Optimize glMemoryBarrier Previous to this change, glMemoryBarrier was processed as it is issued. This made it impossible to know whether a draw call would follow or a dispatch call, and what resources it would use. The render pass was conservatively broken due to this limitation. To address this limitation, handling of glMemoryBarrier is deferred until the next draw or dispatch call. Note that glMemoryBarrier acts as two barriers: - An execution+memory barrier: shader writes are made visible to subsequent accesses - Another execution barrier: shader accesses are finished before subsequent writes An important observation is that for most resources, ANGLE actually necessarily has to issue memory barriers automatically to conform with Vulkan. In terms of memory barrier thus, ANGLE already does the right thing except for when there's no binding change. This means WaW hazards (i.e. storage buffer and image writes) with no binding change require a memory barrier as a result of glMemoryBarrier. In all other cases, it's enough for glMemoryBarrier to break the render pass if necessary and ensure that corresponding bindings are marked dirty (for the execution or memory barriers to happen automatically later). Bug: angleproject:5070 Change-Id: Ide359c43362f8a78805ecf797a91de7aa79221f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2693473 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 907a3cee 2021-02-17T08:07:45 Vulkan: Add support for EXT_shader_framebuffer_fetch_non_coherent EXT_shader_framebuffer_fetch_non_coherent is implemented using subpass input attachments. The extension will be enabled in a follow up change that adds required changes to the Vulkan translator. Bug: angleproject:5454 Test: FramebufferFetchNonCoherentES31.*Vulkan Change-Id: Ic73c66a476c4a21db5269431166a198841f1dc0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598059 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 3c28b2a0 2021-02-10T16:49:32 Vulkan: Remove render pass check from setupDraw() ... and move it to handleDirtyGraphicsRenderPass. Bug: angleproject:5528 Change-Id: I416b2fedb1cd924d04fa739aecb65193fd845f6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2686441 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi e8c0aa81 2021-01-26T23:40:36 Vulkan: Clean up transform feedback extension pause/resume 1. The xfb counter buffer barrier issued was wrong, following a typo in the spec. This barrier is now correctly issued using the usual barrier APIs. 2. A mechanism was added to automatically pause/resume transform feedback when a program pipeline needs to be rebound. This is incorrect as it misses the xfb counter buffer barrier. The render pass is broken instead if transform feedback is active/unpaused and the program pipeline is changed. 3. The transform feedback counter buffers are now disposed of when transform feedback is ended. This avoids an unnecessary barrier that this change would have otherwise incurred (and hence render pass break) in Manhattan which repurposes the same transform feedback object. Bug: angleproject:5528 Change-Id: I1ffe8b4b8975645ba43afd70e9cdbb0765529da5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2651647 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d7037aa2 2021-02-11T14:35:30 Vulkan: noop glMemoryBarrier(CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT) CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT requires a memory barrier: shader buffer write -> host read. According to the spec, the data is only available after a call to glFinish or wait on sync: > The application must call MemoryBarrier with the > CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT set and then call FenceSync with > SYNC_GPU_COMMANDS_COMPLETE (or Finish). Then the CPU will see the > writes after the sync is complete. When a buffer is written to by the GPU, ANGLE calls onHostVisibleBufferWrite(), which ensures a "memory write -> host read" barrier is issued at the end of the command buffer. Additionally, persistently mapped buffers use VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, so there's no need for a call to vkInvalidateMappedMemoryRanges. As a result, there's nothing necessary in ANGLE to do for this barrier bit. Note that should persistenly mapped buffers start using non-coherent memory, this barrier should imply a call to vkInvalidateMappedMemoryRanges for the persistently mapped buffers. Bug: angleproject:5070 Change-Id: Iaeae019dadfa659a47d2dac41c0c09f1c15e584b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2689380 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 79ae52dd 2021-02-11T14:18:41 Vulkan: Fix missing visibility barrier for host-visible buffer writes See https://chromium-review.googlesource.com/c/angle/angle/+/1661252 for context. This was accidentally broken during the command graph rework. This will eventually be validated by syncval. See https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/2329. Bug: angleproject:5070 Change-Id: Ic16fa900e554d46e54b42fc3fbe0f96d5327fa0f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2689379 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 30622479 2021-02-16T12:33:40 Vulkan: Fix crash with deferred clears and MSRTT The following scenario was mishandled: - MSRTT draw with an unresolve operation (i.e. has two subpasses) - Deferred clear - Flush deferred clear with MSRTT framebuffer not needing unresolve (i.e. has one subpass) Bug: chromium:1178693 Change-Id: If3548e99897d698d61dfafbe9f86193723d06e5a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2697648 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi ca6573eb 2021-02-13T21:21:26 Vulkan: Fix dirty bit bug when closing RP in setupDraw() Bug: angleproject:5644 Change-Id: I2e1fa8c4db8eba1beb74c83dcb24cbe2e70ddca6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2694076 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten a9de5d99 2021-02-04T20:44:15 Vulkan: setAllDefaultUniformsDirty after createPipelineLayout The default uniform descriptor set is reset while recreating the pipeline layout during handling of immutable samplers and then is never re-allocated and bound before the next draw. The call stack to allocate the program uniforms descriptor set: ProgramExecutableVk::allocUniformAndXfbDescriptorSet ProgramVk::updateUniforms ContextVk::setupDraw ContextVk::drawArrays Context::drawArrays Unfortunately, this occurs before the pipeline layout is reset (and the descriptor sets are reset) due to the presence of an immutable sampler: ProgramExecutableVk::reset <<---- mDescriptorSets.fill(VK_NULL_HANDLE); ProgramExecutableVk::createPipelineLayout ContextVk::updateActiveTextures ContextVk::invalidateCurrentTextures ContextVk::syncState Context::syncDirtyBits Context::prepareForDraw Context::drawArrays This CL calls setAllDefaultUniformsDirty() for the Program/PPO to ensure the default uniforms descriptor sets are re-allocated and re-bound before the next draw command. Bug: b/178424566 Bug: angleproject:5624 Test: CtsCameraTestCases Change-Id: If54a9f2cc09809a5103bc3eac641c77f56362229 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2677385 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 8b624c6d 2021-02-05T15:33:52 Use constexpr initializer list for bitsets Allows setting/resetting multiple bits to be coalesced into one operation. Bug: angleproject:5528 Change-Id: Ibf2dff8c81441a75c268d95066d23da1b2a3c810 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2678885 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 45a493ea 2021-02-05T13:48:48 Vulkan: Use a dirty bit to start the render pass Some dirty bits need to run before the render pass starts. An upcoming change for example needs to break the render pass when the program pipeline is changed while transform feedback is active. Another upcoming change may need to do the same based on a preceding glMemoryBarrier. This change adds a new dirty bit to start the render pass after some dirty bits have already been processed. Bug: angleproject:5528 Change-Id: I993c9efefed4c8fee268b218a8dd66a582d4e7cd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2678863 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten dccec125 2021-02-08T16:21:30 Vulkan: Clear mCurrentGraphicsPipeline after createPipelineLayout() Set mCurrentGraphicsPipeline = nullptr when the pipeline layout is recreated if immutable samplers are used to prevent a use-after-free. For a fuller discussion on why this is necessary, see: Vulkan: clear mCurrentGraphicsPipeline during invalidate | https://chromium-review.googlesource.com/c/angle/angle/+/2647746 Bug: b/178424566 Bug: angleproject:5624 Change-Id: I70679bda85cd587dbd8893a4576ee5d33aee2b70 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2683041 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill a8a2a71b 2021-02-01T17:18:18 Vulkan: Support y-flip with no driver support. We can reuse the surface rotation matrix code to do the y-flip. This requires the SPIR-V transformation support. Because not all rotations are encoded into the table we can only support rotation with the driver support for y-flip (currently). Includes some very minimal regression testing. This work is targeted towards supporting vk-portability implementations which are not as up-to-date with Vulkan features. Bug: angleproject:5596 Change-Id: I270fa1efc03267551d28df33ddac9972e1343d60 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2665892 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Jonah Ryan-Davis 4968f6f2 2021-02-04T16:40:36 Move getRendererDescription from ContextImpl to DisplayImpl The other backend description strings are in DisplayImpl. This will help with caching the result of glGetString in the GL backend. Also Update the getters to not be const in order to allow caching. Bug: chromium:1173672 Change-Id: I43df35688762b23429f47f169c04482cf4cd089a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2676881 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
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>
Mohan Maiya 7e81056a 2021-02-01T11:16:14 Vulkan: Support integer type incomplete texture Support both signed and unsigned integer type incomplete textures. Bug: angleproject:5502 Bug: angleproject:4432 Tests: IncompleteTextureTestES3.*IntegerType* dEQP.KHR_GLES31/core_sample_variables_mask_rgba8*i_* Change-Id: Ic8c972aac0ca8589b26333b66dd0cc5fb5134043 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2613245 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 4a426e1f 2021-02-01T12:10:46 Vulkan: Add missing variable inits to ContextVk. This was preventing testing with the viewport flip disabled. Bug: angleproject:5596 Change-Id: I5cc39eb2e1b431625f2f1498ab73828961af42ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2664249 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis 0be050a4 2020-09-23T15:12:56 Pass GL_VERSION info through ANGLE's GL_RENDERER string Chrome needs ANGLE to pass through the underlying driver vendor and version, which cannot always be determined by the SystemInfo library. This is done by construction GL_RENDERER in the frontend through combining GL_VENDOR, GL_RENDERER, and GL_VERSION from the backends. Example changes are in the doc: https://docs.google.com/document/d/1p0dvrLlu8NKhO-RCU5gqlQ_LvcQj-ZqhvfwSk1n3Sz8/edit?usp=sharing Bug: chromium:1126526 Bug: chromium:1131248 Bug: chromium:1134669 Bug: chromium:1169861 Change-Id: Ia618ebcd7f3caaeb376b4b6a03446732efdaeecb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2427383 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi eae262e7 2021-01-27T13:56:49 Vulkan: Fix image layout barriers for tessellation shaders Also fixes a bug where invalid stages may be specified for example if AllGraphicsReadOnly or DepthStencilReadOnly layouts are used and geometry or tessellation shaders are not supported by the implementation. Bug: angleproject:5557 Change-Id: Ia25a6aec8138c67701c63da65783263d8a7bda27 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2653911 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 6d86a0fe 2021-01-29T11:08:04 Fix mActiveImageShaderBits not updated in PPO's executable Allows the backend to rely on this bitset always being valid, instead of working around the bug. Bug: angleproject:5587 Change-Id: I25e1304c0e5e34b5fc1677a819315574603ed034 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2658885 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 80a4223e 2021-01-28T17:51:31 Vulkan: Handle changes to viewport when clip origin is modified The expected view port is different from current viewport translation when the clip origin is the upper left. So now, it has four different view port translations based on clip origin and y-flip of framebuffer. - add query and state management for EXT_clip_control - add dirty bit for clip control - change viewport, scissor and cull face when clip origin changes Bug: angleproject:5471 Tests: dEQP-GLES2.functional.clip_control.* Change-Id: I78dc752c3287b09f25496034e0d0d2724138010c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2615863 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 4921e457 2021-01-22T22:36:13 Vulkan: Avoid unnecessary pipeline rebinds Bug: angleproject:5528 Change-Id: I5502498fa5d6767f55635fe9fff949d7fd644f4f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2645640 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 535d4783 2021-01-20T14:14:02 Vulkan: Flush if sync object is pending during SyncVk::getStatus() When a glGetSynciv() is performed for GL_SYNC_STATUS, we should flush any pending commands if a sync object is pending a flush, since the caller is interested in the status of a fence. This will guarantee that the work is submitted to the hardware and eventually completes. This is accomplished by moving mSyncObjectPendingFlush from ContextVk to ShareGroupVk, so that any sync objects used by any contexts within the share group are submitted to hardware and the required work completes. Bug: angleproject:5306 Bug: angleproject:5425 Test: FenceSyncTest.BasicOperations Change-Id: I2e2681ad01fda429ba37f061c9bac5eb91f800fd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2641095 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill b912eec5 2020-11-27T11:08:41 Vulkan: Support GL_EXT_tessellation_shader. Shader translator changes done in http://crrev.com/c/2633936 Adds a new DIRTY_BIT_PATCH_VERTICES state to Context. Supportes state query and transform feedback. 4 test suppressions remain as follow-up fixes. Adds a new varying packing mode for a simple Vulkan rule set. Based on work by Mohan Maiya (m.maiya@samsung.com). Test: dEQP-GLES31.functional.tessellation.* Bug: angleproject:3572 Change-Id: I4cad2cca30adb754fd12c83027673906541f566a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568234 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 81430e11 2021-01-18T11:56:16 Vulkan: Remove command processor special functions. These functions are no longer needed. Bug: b/170328907 Bug: b/170329600 Bug: b/172704839 Change-Id: Icf18717905fa79dc0ccf7063d8482d4ca07d8b80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2635073 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi dfd9bdfd 2021-01-16T11:32:30 Reland "Vulkan: Generate gl_Position pre-rotation in SPIR-V" This reverts commit 3d39b7c5eab88c420d982155ffbb6181c678ceea. Reason for revert: Fixed interaction with the `forceDriverUniformOverSpecConst` workaround. Original change's description: > Revert "Vulkan: Generate gl_Position pre-rotation in SPIR-V" > > This reverts commit 0f86b196ffaffeeee3460e3188f20a7ac120796d. > > Reason for revert: > Breaks pre-rotation for all apps, so they are displayed in portrait instead of landscape. > > Original change's description: > > Vulkan: Generate gl_Position pre-rotation in SPIR-V > > > > Instead of having the translator output pre-rotation code in the vertex > > stage based on a specialization constant, this change makes the SPIR-V > > transformer perform pre-rotation of gl_Position on the last geometry > > stage. > > > > An alternative solution would be to generate pre-rotation code in the > > translator in every geometry stage, each controlled by a separate > > specialization constant. This change avoids unnecessary modifications > > to earlier stages. The generated shaders are also smaller, as they > > don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V > > transformer knows the pre-rotation at transformation time, so it can > > simply use swizzles to achieve the same results. > > > > This also ties in with upcoming changes which move gl_Position.z > > correction to the last geometry shader stage, which is trivially done > > piggy-backing on the infrastructure in this change. > > > > Bug: angleproject:5478 > > Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I81f237fa6b10c7d59831363bee8999e7ad2f09be > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:5478 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633694 > Reviewed-by: Tim Van Patten <timvp@google.com> > Commit-Queue: Tim Van Patten <timvp@google.com> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Bug: angleproject:5478 Change-Id: I7c5eaeef03d9520abd36a1c4a766b6abbf4fdb45 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633709 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 60015ff6 2021-01-14T02:03:07 Vulkan: Redo RewriteStructSamplers This transformation is split into two. The first transformation solely takes out the samplers out of structs, and potentially generates array of array of samplers. A second transformation is added that takes any array of array of opaque uniforms and flattens it. A follow up change will simplify RewriteAtomicCounters which also handles array of arrays (which is no longer possible), and removes dependency on shaderStorageBufferArrayDynamicIndexing. Bug: angleproject:2703 Bug: angleproject:3881 Bug: angleproject:4071 Bug: angleproject:4211 Change-Id: I352bb2bbe65ac49f4d7d753c0ba3160fa3cc925a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2628138 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 3d39b7c5 2021-01-16T00:15:14 Revert "Vulkan: Generate gl_Position pre-rotation in SPIR-V" This reverts commit 0f86b196ffaffeeee3460e3188f20a7ac120796d. Reason for revert: Breaks pre-rotation for all apps, so they are displayed in portrait instead of landscape. Original change's description: > Vulkan: Generate gl_Position pre-rotation in SPIR-V > > Instead of having the translator output pre-rotation code in the vertex > stage based on a specialization constant, this change makes the SPIR-V > transformer perform pre-rotation of gl_Position on the last geometry > stage. > > An alternative solution would be to generate pre-rotation code in the > translator in every geometry stage, each controlled by a separate > specialization constant. This change avoids unnecessary modifications > to earlier stages. The generated shaders are also smaller, as they > don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V > transformer knows the pre-rotation at transformation time, so it can > simply use swizzles to achieve the same results. > > This also ties in with upcoming changes which move gl_Position.z > correction to the last geometry shader stage, which is trivially done > piggy-backing on the infrastructure in this change. > > Bug: angleproject:5478 > Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I81f237fa6b10c7d59831363bee8999e7ad2f09be No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:5478 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2633694 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 0f86b196 2020-12-21T22:54:05 Vulkan: Generate gl_Position pre-rotation in SPIR-V Instead of having the translator output pre-rotation code in the vertex stage based on a specialization constant, this change makes the SPIR-V transformer perform pre-rotation of gl_Position on the last geometry stage. An alternative solution would be to generate pre-rotation code in the translator in every geometry stage, each controlled by a separate specialization constant. This change avoids unnecessary modifications to earlier stages. The generated shaders are also smaller, as they don't contain a mat2[8] pre-rotation constant matrix. The SPIR-V transformer knows the pre-rotation at transformation time, so it can simply use swizzles to achieve the same results. This also ties in with upcoming changes which move gl_Position.z correction to the last geometry shader stage, which is trivially done piggy-backing on the infrastructure in this change. Bug: angleproject:5478 Change-Id: I9d5d9d19f3ccda665f5504368ce5ddfa5f383faf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598584 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi a4b582e8 2021-01-11T15:31:13 Vulkan: Notify ContextVk when UtilsVk binds compute pipelines This issue was fixed for graphics pipelines (in UtilsVk::clearFramebuffer), but remained for compute pipelines. If UtilsVk issues a dispatch call, it now notifies ContextVk to rebind the pipeline and descriptor sets. Bug: angleproject:5529 Change-Id: Ic52f91bdc70d02c065ec2d5e2a3614c11fd62a9f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2622236 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e2a8a69a 2021-01-04T23:52:02 Vulkan: Move xfb emulation offset calculation to translator A new function is added by the translator to calculate the transform feedback offsets in the emulation path. This function makes the generated code for transform feedback smaller. Bug: angleproject:3606 Change-Id: I01460f907e20e2887cb720bddad96697fdcb0cf3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2607492 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 07d619cb 2021-01-06T11:36:40 Vulkan: Fix missing xfb buffer rebind on new command buffer When a command buffer is ended, bindings are lost. This adds a dirty bit to `mNewGraphicsCommandBufferDirtyBits` to make sure transform feedback buffers are bound again on the new command buffer. Bug: angleproject:5428 Change-Id: I7733c93b1eb5d33a77cbee231a83199be950e19f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2611552 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 74788951 2020-12-22T13:11:17 Vulkan: Fix assertion in xfb of indirect calls An assertion was fired which was only valid when emulating transform feedback. The relevant block is conditioned to the respective feature. Bug: angleproject:3571 Change-Id: I287ef6d94c920ccda742e4032bfc389409a38e1f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2599951 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 909ea88b 2020-11-20T13:07:53 Reland "Vulkan: Ignore glFlush to reduce vkQueueSubmits in Asphalt 9" This is a reland of 5cf7472dd161bbda329dfc5e4e65bb6ce0c06fbd The ShareGroupVk::mResourceUseLists was not being cleared each call to RendererVk::submitFrame(), so it was growing indefinitely. Each vk::ResourceUseList within it was cleared, so it was holding an essentially "infinite" list of empty lists, but that caused the loop in RendererVk::submitFrame() to take more and more time until the tests timed out. The fix is to do 'resourceUseLists.clear()' once the loop to release all resources has completed, like releaseResourceUsesAndUpdateSerials() does for each individual list. Additionally, ASSERTs are added to guarantee that the lists are empty when the ContextVk and ShareGroupVk are destroyed. Original change's description: > Vulkan: Ignore glFlush to reduce vkQueueSubmits in Asphalt 9 > > Multithreaded apps can use the following pattern: > > glDrawElements() > glFenceSync() > glFlush() > glWaitSync() > > This currently results in a vkQueueSubmit for every glFlush() to ensure > that the work has landed in the command queue in the correct order. > However, ANGLE can instead avoid the vkQueueSubmit during the glFlush() > in this situation by instead flushing the ContextVk's commands and > ending the render pass to ensure the commands are submitted in the > correct order to the renderer. This improves performance for Asphalt 9 > by reducing frame times from 150-200msec to 35-55msec. > > Specifically, ANGLE will call flushCommandsAndEndRenderPass() when > there is a sync object pending a flush or if the ContextVk is currently > shared. > > Additionally, on all devices except Qualcomm, ANGLE can ignore all other > glFlush() calls entirely and return immediately. For Qualcomm devices, > ANGLE is still required to perform a full flush (resulting in a > vkQueueSubmit), since ignoring the glFlush() reduces the Manhattan 3.0 > offscreen score by ~3%. > > Bug: angleproject:5306 > Bug: angleproject:5425 > Change-Id: I9d747caf5bf306166be0fec630a78caf41208c27 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2552718 > Commit-Queue: Tim Van Patten <timvp@google.com> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: angleproject:5306 Bug: angleproject:5425 Bug: angleproject:5470 Change-Id: I14ee424d032f22e5285d67accbec078ad1955dd0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2595811 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez a19bd601 2020-12-16T13:04:38 Revert "Vulkan: Ignore glFlush to reduce vkQueueSubmits in Asphalt 9" This reverts commit 5cf7472dd161bbda329dfc5e4e65bb6ce0c06fbd. Reason for revert: causes timeouts, see anglebug.com/5470 Original change's description: > Vulkan: Ignore glFlush to reduce vkQueueSubmits in Asphalt 9 > > Multithreaded apps can use the following pattern: > > glDrawElements() > glFenceSync() > glFlush() > glWaitSync() > > This currently results in a vkQueueSubmit for every glFlush() to ensure > that the work has landed in the command queue in the correct order. > However, ANGLE can instead avoid the vkQueueSubmit during the glFlush() > in this situation by instead flushing the ContextVk's commands and > ending the render pass to ensure the commands are submitted in the > correct order to the renderer. This improves performance for Asphalt 9 > by reducing frame times from 150-200msec to 35-55msec. > > Specifically, ANGLE will call flushCommandsAndEndRenderPass() when > there is a sync object pending a flush or if the ContextVk is currently > shared. > > Additionally, on all devices except Qualcomm, ANGLE can ignore all other > glFlush() calls entirely and return immediately. For Qualcomm devices, > ANGLE is still required to perform a full flush (resulting in a > vkQueueSubmit), since ignoring the glFlush() reduces the Manhattan 3.0 > offscreen score by ~3%. > > Bug: angleproject:5306 > Bug: angleproject:5425 > Change-Id: I9d747caf5bf306166be0fec630a78caf41208c27 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2552718 > Commit-Queue: Tim Van Patten <timvp@google.com> > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,jmadill@chromium.org,cclao@google.com Change-Id: I9886bf901a835d408b6a4b8be7ea408fa2121be0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:5306 Bug: angleproject:5425 Bug: angleproject:5470 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2595032 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Mohan Maiya 98b56e60 2020-12-12T16:28:21 Vulkan: Accumulate internal cache stats in renderer The CacheStats of all internal caches are accumulated by the renderer. In order to see the hit ratios of all caches, the following GN args must be enabled: is_debug = true angle_enable_perf_counter_output = true Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: Iaca3249192e9e4e130d8291b7759c459d79b06ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2588430 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 5cf7472d 2020-11-20T13:07:53 Vulkan: Ignore glFlush to reduce vkQueueSubmits in Asphalt 9 Multithreaded apps can use the following pattern: glDrawElements() glFenceSync() glFlush() glWaitSync() This currently results in a vkQueueSubmit for every glFlush() to ensure that the work has landed in the command queue in the correct order. However, ANGLE can instead avoid the vkQueueSubmit during the glFlush() in this situation by instead flushing the ContextVk's commands and ending the render pass to ensure the commands are submitted in the correct order to the renderer. This improves performance for Asphalt 9 by reducing frame times from 150-200msec to 35-55msec. Specifically, ANGLE will call flushCommandsAndEndRenderPass() when there is a sync object pending a flush or if the ContextVk is currently shared. Additionally, on all devices except Qualcomm, ANGLE can ignore all other glFlush() calls entirely and return immediately. For Qualcomm devices, ANGLE is still required to perform a full flush (resulting in a vkQueueSubmit), since ignoring the glFlush() reduces the Manhattan 3.0 offscreen score by ~3%. Bug: angleproject:5306 Bug: angleproject:5425 Change-Id: I9d747caf5bf306166be0fec630a78caf41208c27 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2552718 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 64508f44 2020-12-12T18:00:10 Vulkan: Reduce driver uniform data to minimum if specConst is used If specialization constant is used, driver uniform data structure should be reduced to minimum to increase cache locality. Bug: b/175479076 Change-Id: I1fc50666542c6763c60bfe011cde5bc77ccc08e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2588549 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 067a12f0 2020-11-19T16:47:25 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This is a reland of ff38106d62fca2e36ec2db1cd580b546fd53ae43 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/173800146 Change-Id: Ifc36086f4c5d6a44fb5456aa6e31bc8a783bba71 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2579648 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 1788355b 2020-12-08T16:12:34 Vulkan: Add dirty bits instead of direct access FBO state The CL crrev/c/2551541 causes intermittent Bot failure. I believe the problem is that from ContextVk::onMakeCurrent call stack, the object state may not in sync or even not completely specified. So instead of accessing fbo state object here to update mGraphicsPipelineDesc, we should insert dirty bit and let state validation code to handle it. Bug: b/175157604 Change-Id: I5f6b9fd901cc4187068f6161bd12836c8bbf8e87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2580914 Commit-Queue: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 36f74334 2020-12-03T21:26:28 Vulkan: Fix query pause on framebuffer binding change When a render pass is closed, render pass queries are paused. The code that pauses queries however is conditioned to the render pass being open. In ContextVk::syncState, when processing gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING, `onRenderPassFinished()` is called. Later on, when the render pass is actually finished, the queries are not paused. This change moves the logic to pause render pass queries to onRenderPassFinished(). Bug: angleproject:5427 Change-Id: I3a87db2e4543ff698803ac5e154a370e85ac7985 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2573581 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi f691b3b5 2020-12-02T13:11:54 Vulkan: Support PrimitivesGenerated query This query uses the Vulkan transform feedback extension. In GL, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN and GL_PRIMITIVES_GENERATED queries can be independently begun/ended. However, Vulkan requires that queries from pools of the same type can only be active one at a time. This forbids the two GL queries from being handled by two VK queries when they are simultaneously begun. This change makes these queries share their QueryHelper objects. The Vulkan transform feedback queries unconditionally retrieve both results anyway, so this is just a matter of making sure the two GL queries are merged as one when they are simultaneously used. The change fixes a number of issues as collateral: - TransformFeedbackPrimitivesWritten queries when !emulated were not released - Stashed queries were never released - If no render pass is open when a query ends, then getResult(no_wait) ended up waiting Bug: angleproject:5404 Change-Id: I8ce13ea76ffd31b3152ded7c713c6466d0315504 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2573580 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter aafcb504 2020-12-08T09:32:10 Vulkan: Add ensureSubmission to queueSubmitOneOff Some callers of queueSubmitOneOff require that the command being queued to have been sent to the GPU. The new ensureSubmission parameter indicates that behavior and when running with threaded worker will wait for the worker queue to empty before returning. Bug: b/170312581 Change-Id: Ib620fb37f4b9b4431451ccbd10807c0dff1842af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2579041 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Shahbaz Youssefi 251ba5cb 2020-12-03T15:55:47 Vulkan: Fix transform feedback with in-render-pass clears An in-render-pass clear now pauses transform feedback so it wouldn't contribute to it. Since it's not possible to resume the transform feedback in the same render pass (as it needs a memory barrier for its counter buffer), the render pass is broken after the clear. Bug: angleproject:5426 Change-Id: I1eaf8c153d076bd912a4a08c65960c12f00341ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2573579 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b22b1502 2020-12-03T16:25:14 Vulkan: Fix transform feedback spanning multiple render passes When the render pass breaks while transform feedback is active, the subsequent render passes didn't restart transform feedback because of a missing dirty bit. Bug: angleproject:5426 Change-Id: Icee79cbdabbceab96973cea124240ac7ced82d55 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572878 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Ian Elliott 1ad5791d 2020-12-03T22:05:51 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Suspect that this CL may be causing win-angle-rel-32 bot failures Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: b/173800146 Change-Id: I7bc9966ebbe949f3999d7927afa629dd2e3a4187 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572801 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 2c8bc1b7 2020-11-26T16:06:24 Vulkan: Clean up render pass query code In preparation for support of primitives generated queries. Bug: angleproject:5404 Change-Id: Ic123aaff33f8903994ff8fcc9158954ac023ec13 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2562126 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>