src/libANGLE/renderer/vulkan/ContextVk.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 4114fe23 2021-11-20T22:05:56 Vulkan: Simplify transform feedback emulation logic In [1], the program is transformed to not output transform feedback logic when transform feedback is inactive. With that change, it's no longer necessary to dedicate a driver uniform to indicate if transform feedback is active. [1]: https://chromium-review.googlesource.com/c/angle/angle/+/3294661 Bug: chromium:1209285 Change-Id: Ica725d0da08e2676f442fe6307962d367b443535 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294702 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 6c894e82 2021-11-04T14:49:41 Vulkan: Replace BufferVk::getBufferAndOffset() with getBuffer() Now BufferHelper class already keeps offset information. There is no reason for BufferVk to have that information any more. Bug: b/205337962 Change-Id: I6e014fb480bfcd5018ef9231b0fb87a50021f179 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266147 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 83a670ab 2021-10-29T09:12:26 Vulkan: Implement BufferPool using VMA's virtual allocator VMA's allocation calls used to be sub-allocating a pool of memory. What we really want is sub-allocate a VkBuffer object. VMA recently added support to expose the underlying range allocation algorithm via APIs, which user can use it to sub-allocate any object. This CL uses that new virtual allocation API to sub-allocate from a pool of VkBuffers. In this CL we only switched BufferVk::mBuffer to sub-allocate from the BufferPool object. Bug: b/205337962 Change-Id: Ia6ef00c22e58687e375b31bc12ac515fd89f3488 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266146 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Lingfeng Yang 83679716 2021-12-14T19:02:48 Vulkan: Dirty vertex buffers if default attrib values changed In the call_break_offline trace, attribute index 4 is disabled then enabled before a draw. This redundant operation is currently not blocked and makes it to the Vulkan backend, resulting in handleDirtyGraphicsVertexBuffers. However, at the same time, we change the default attrib value for index 3. Which makes handleDirtyGraphicsVertexBuffers not redundant. We'll need to take into account cases when other attribute indices are not dirty and yet the default attrib value changes. Bug: angleproject:6802 Change-Id: I4a3ec411aa42f73a209fd0f06976d7ef2d21e027 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3331412 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Lingfeng Yang <lfy@google.com>
Shahbaz Youssefi 90c3038e 2021-12-14T16:46:13 Vulkan: Fix desc set updates with Vulkan SCBs Since Vulkan SCBs are a command buffer in their own, we cannot aggregate desc set updates to be done once after all the binds have been recorded. This change makes sure that desc set updates are issued before bind, but this problem could potentially also be solved with VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, by actually issuing the writes at the end of the secondary CB, just before closing it. Bug: angleproject:6811 Change-Id: I18e150b73a5881258679ba53a2d84acd2fc44edd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3338390 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 5b858acf 2021-12-09T14:22:14 Vulkan: Fix the offset issue in multiDrawIndirect * In MultiDrawElementsIndirect, it resets the index buffer offset (mCurrentIndexBufferOffset) to 0. * Added a unit test for MultiDrawElementsIndirect to make sure that the index buffer offset is reset properly. * Updated the test program in MultiDrawIndirectTest to include a multi-colored mode. * D3D11 and Metal tests regarding the following functions are disabled so more test coverage can be added: * glMultiDrawElementsIndirectEXT * glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE Bug: angleproject:6751 Change-Id: I81bb7b3aa9b6ad8a9283dd50728ec6250c3668ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3330737 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 494a0ec2 2021-12-08T16:07:50 Vulkan: Append the actual buffer size when binding's size is 0 When app calls glBindBufferBase, the size of binding is set to 0. The spec says the actual size should be size of buffer when buffer is been referenced. But when we generate ShaderBuffersDescriptorDesc, we are directly using binding's size. But the actual descriptor set has the buffer's actual size. This causing the ShaderBuffersDescriptorDesc have a false cache hit (because size is always 0) when the actual descriptor set should be different. This CL checks bindging.getSize() and if it is 0, we use the actual buffer size. Bug: angleproject:6792 Change-Id: I3e044dc5ff113b4fae1b5c7d5e78645c6e98edf8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3325024 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 55840e90 2021-12-03T15:24:00 Vulkan: Fix deferred flush vs UtilsVk Take the following scenario: 1. Draw 2. Flush (this is deferred) 3. Get image view (this is retain()ed) 4. Pass view to a draw-based UtilsVk function 5. Flush 6. Delete image view At step 4, UtilsVk may start a new render pass and use the image view from step 3. Since the flush at step 2 is deferred, it will be performed at this step, and so the serial of the image view is set to the previous submission. When step 4 uses this view, it doesn't retain it. Step 5 submits the new command buffer using this image view. At step 6, if the previous submission has finished, it will destroy the view immediately even though it's in use by the new submission. One solution could have been to make sure render pass closure originating from UtilsVk doesn't incur a flush. However, due to the current design where the render pass is immediately recorded in RendererVk's primary command buffer, it's possible that an unrelated context would perform the flush anyway. This change makes sure instead that the render pass is closed before any views are allocated/retained to be used by UtilsVk. Bug: chromium:1272266 Change-Id: I5bdefb34e03c368511c4c174cf7965fda158d2b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3315976 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 006c11d9 2021-11-20T22:12:20 Vulkan: Fix xfb query ASSERT on end It's possible for the xfb query to have never been issued, as it's deferred until a draw call with xfb active is encountered, which may never happen. Bug: chromium:1209285 Change-Id: I893f9f9a06e4b9f2f9da9406affab0be3598fcb4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294701 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi d0287552 2021-11-15T08:51:41 Reland "Vulkan: Implement GL_EXT_multi_draw_indirect" This is a reland of 79f9d163b4227115a3e60e027ec4d7dbe0495f64 * Added drawcount > 1 as a condition to fall back to MultiDraw*IndirectGeneral(). * Expanded the tests to include cases with disabled support for multiDrawIndirect. Original change's description: > Vulkan: Implement GL_EXT_multi_draw_indirect > > * Optimized the implementations of multiDrawArraysIndirect() > and multiDrawElementsIndirect() for Vulkan > * Added helper functions to support drawArraysIndirect() and > drawElementsIndirect() as special cases of multiDraw*Indirect > functions. > * Added the flag to enable the multiDrawIndirect feature > (drawCount > 1). The generic implementation is used if the > flag is disabled. > > Bug: angleproject:6439 > Change-Id: Ibc653d93d355657f828de9c33da22428629e450f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3276044 > Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: angleproject:6439 Change-Id: I96c015855fabc8abbb87320a5ca71a8d92d61954 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3313412 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Jeff Vigil fe42ac4d 2021-11-29T15:45:40 EGL: deferredFlush fix for PRESENT_MODE_SHARED Add work around to deferredFlush for SINGLE_BUFFER Fixes issue with EGL_KHR_mutable_render_buffer and deferredFlush feature. Bug: angleproject:6739 Change-Id: I81f87899f2c92a7e001b6aee2f88ecf7ba0d40a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3308224 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 8e6f38e5 2021-12-02T17:24:32 Revert "Vulkan: Implement GL_EXT_multi_draw_indirect" This reverts commit 79f9d163b4227115a3e60e027ec4d7dbe0495f64. Reason for revert: Breaks dEQP-GLES31.functional.draw_indirect* on Pixel devices: https://blackbox.googleplex.com/dashboard/cts-graphics/target/git_master/oriole-userdebug/3/cts-angle-host-test-arm64-v8a/4 Original change's description: > Vulkan: Implement GL_EXT_multi_draw_indirect > > * Optimized the implementations of multiDrawArraysIndirect() > and multiDrawElementsIndirect() for Vulkan > * Added helper functions to support drawArraysIndirect() and > drawElementsIndirect() as special cases of multiDraw*Indirect > functions. > * Added the flag to enable the multiDrawIndirect feature > (drawCount > 1). The generic implementation is used if the > flag is disabled. > > Bug: angleproject:6439 > Change-Id: Ibc653d93d355657f828de9c33da22428629e450f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3276044 > Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: angleproject:6439 Change-Id: Ia4d54ef3e7652febf4d77fdaf6809f57e8e29127 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3312829 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Mohan Maiya 44d0ef69 2021-11-25T14:37:38 Vulkan: Enhance SamplerDesc for YUV formats In order to uniquely identify a VkSamplerYcbcrConversion, having just the format is insufficient. We need to account for conversion model and color component range. Refactor SamplerDesc by encapsulating YUV related fields into its own YcbcrConversionDesc. Bug: angleproject:6732 Test: Texture2DTestES3.*Yuv*Vulkan Change-Id: I23114c50646232dccde988a52b0649778ad72a90 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3301899 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Peng Huang a5e391d7 2021-11-19T17:35:06 Add GL_ANGLE_vulkan_image extension glAcquireTextures & glReleaseTextures are added for sharing texture ownership with an external API. Bug: chromium:1264439 Change-Id: If46d8d230b4f611768b5ff1187674509e42f01e0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3293921 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
Amirali Abdolrashidi 79f9d163 2021-11-15T08:51:41 Vulkan: Implement GL_EXT_multi_draw_indirect * Optimized the implementations of multiDrawArraysIndirect() and multiDrawElementsIndirect() for Vulkan * Added helper functions to support drawArraysIndirect() and drawElementsIndirect() as special cases of multiDraw*Indirect functions. * Added the flag to enable the multiDrawIndirect feature (drawCount > 1). The generic implementation is used if the flag is disabled. Bug: angleproject:6439 Change-Id: Ibc653d93d355657f828de9c33da22428629e450f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3276044 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Amirali Abdolrashidi 17bf6e98 2021-11-11T20:53:31 Implement GL_EXT_multi_draw_indirect * Added the validation functions for multiDrawArraysIndirect() and multiDrawElementsIndirect() according to the specs. * Added generic implementation for the two functions that can be called by back-ends. * Added unit tests for the multiDrawIndirect functions. * Added flags for back-ends so they can enable the extension. * Minor cleanup in MultiDrawTest.cpp Bug: angleproject:6439 Change-Id: I4e5f1cab05c6de330aef82d115492dcc9d2fad44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3276043 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9de37b58 2021-11-20T21:45:02 Vulkan: Fix draw with emulated xfb without xfb active When transform feedback is not active, make sure the code that captures xfb is not generated, even though it's guarded against with an if. This is because no buffer is bound to the capture buffer, and by avoiding generation of code that references that buffer, SwiftShader will not attempt to access the missing descriptor set. Currently, the actual declaration of the buffer is left in the SPIR-V, which seems to be benign. If that causes issues in the future, the SPIR-V transformer can be modified to remove that variable as well. Bug: chromium:1209285 Change-Id: I83da8d1dea5390ecacc681f8ada9f586932deaa4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3294661 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3128c055 2021-11-12T14:59:46 Vulkan: Add wait semaphores to queueSubmitOneOff For use in follow up change. Bug: angleproject:3966 Change-Id: I5bfac51ef9d47a6df5d52268d3ce4863b848b1d1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3279226 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Lingfeng Yang <lfy@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi eb3ef08e 2021-11-11T17:41:48 Vulkan: Differentiate perf warnings and RP closure events ... and application events, by using different debug source enums, translating to different colors in API debuggers. Bug: angleproject:2472 Change-Id: Ice422c7ae59fb508a10500b9fbed79d4c9664c11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3275840 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi dbc0c646 2021-11-06T01:09:26 Vulkan: Output the reason for RP closure in command buffer To make it easier when viewing the command buffer in a graphics debugger, this change inserts a marker just before closing the render pass that specifies why the render pass was closed. Bug: angleproject:2472 Change-Id: I862e500cd58332d6e199c853315c560fe6a73dc2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3265609 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d2d3a546 2021-11-11T12:22:04 Vulkan: Write perf warnings in command buffer It's much easier to understand what command the perf warning refers to when it's visible in the command buffer using a graphics API debugger. This change creates ANGLE_VK_PERF_WARNING which gives the warning both to the application (through ANGLE_PERF_WARNING) and inserts it in the command buffer. Bug: angleproject:2472 Change-Id: Ie84feed53eca5cda93e1f2bc653fcbf9bcd57b56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3275839 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 5c16f77b 2021-10-01T20:07:09 Vulkan: Add flushCommandsAndEndRenderPassWithoutQueueSubmit() Add flushCommandsAndEndRenderPassWithoutQueueSubmit() to allow ContextVk::flushAndGetSerial() to only issue a single vkQueueSubmit(). Bug: angleproject:6546 Change-Id: Ia3fc2bb93e88583ebd80ee153749dc8ca42245dc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3200673 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 53371cc0 2021-11-01T20:25:17 Vulkan: Use optimalBufferCopyOffsetAlignment optimalBufferCopyOffsetAlignment is the optimal buffer offset alignment in bytes for vkCmdCopyBufferToImage2KHR, vkCmdCopyBufferToImage, vkCmdCopyImageToBuffer2KHR, and vkCmdCopyImageToBuffer. The per texel alignment requirements are enforced, but applications should use the optimal alignment for optimal performance and power use. To improve efficiency, this CL updates ContextVk::mStagingBuffer's alignment to the max of: - minMemoryMapAlignment - nonCoherentAtomSize - optimalBufferCopyOffsetAlignment On ARM, this is not expected to have any affect, since all three values are 0x40, but other platforms may see a benefit. Bug: angleproject:4297 Change-Id: I9185da111e09c5d782eb1dedb10369727cb9bf51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3256007 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 0e20c680 2021-11-08T15:24:09 Sync framebuffer bindings in glInvalidateFramebuffer If a framebuffer binding change is followed by glInvalidateFramebuffer, ANGLE was not syncing the framebuffer binding. - This means that invalidation was being done on the previous framebuffer. - Paired with deferred clears, this was causing ContextVk to start a render pass on the previous, potentially deleted, framebuffer. Bug: chromium:1267027 Change-Id: I092a0c8dd764db9e49258b694c970babb19cf24b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266175 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 79a5dc0a 2021-11-05T23:26:43 Vulkan: Fix spammy best practices message A GPU WRITE->HOST barrier frequently issued when the GPU outputs to a host-visible buffer used the ALL_COMMANDS stage mask causing a best practices message. This message is suppressed in ANGLE, but shows up in RenderDoc and clutters the output. Bug: angleproject:5070 Change-Id: I59aa7f8c7b3bf2788a3f7ae0ab6abdb4d3cd175e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3265606 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten afaa1287 2021-10-26T19:29:44 Vulkan: Don't submit XFB queries when XFB is inactive Consider the following GL commands: glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN) glBeginTransformFeedback() glDrawArrays() glPauseTransformFeedback() glDrawArrays() glResumeTransformFeedback() glDrawArrays() glEndTransformFeedback() glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN) The renderpass is broken for each of the draw calls, leading to pauseRenderPassQueriesIfActive() and resumeRenderPassQueriesIfActive() being called when the RP is stopped/started. This leads ANGLE to generate 3 TransformFeedbackPrimitivesWritten queries when looping through the "active" queries, since no consideration is made for XFB actually being active/unpaused. ARM doesn't support the TransformFeedbackPrimitivesWritten query when XFB is disabled. Instead, the query is never completed and the results are never available. It could probably be argued that this is an ARM bug, and they should just output '0' if XFB isn't active during the query. Regardless, ANGLE shouldn't be issuing the queries when XFB is no active, since it's wasteful. Bug: angleproject:6622 Test: dEQP.GLES3/functional_transform_feedback* Test: TransformFeedbackTest.TransformFeedbackQueryPausedDrawThenResume Change-Id: I380fb60405d7f538b802bb0df72bf609f0bc58e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3246532 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill 4a2446c6 2021-10-19T11:55:17 Vulkan: Implement robust shader outputs. In this CL we change ANGLE to pass the mask of missing shader outputs down to pipeline creation. We then use the color mask bits to block SwiftShader writing to unused outputs. This fixes the undefined behaviour present in Genshin Impact. Note that the other GLES implementations we tested don't seem to modify outputs even if they're unused. It was easier to mask out the color attachments in initialize rather than set up the pipeline desc to mask out the attachments. This was because we manipulate the color mask in a fairly complex way before we initialize the pipeline desc. Bug: angleproject:6566 Change-Id: Ie659fcd511cd286fa573fd25e3e6a0b9e123ebd6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3232435 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao bae19e06 2021-10-26T13:35:57 Vulkan: Avoid unnecessary wait if mapBufferRange indicates read only When we call BufferVk::mapRangeImpl(), both from internal code paths for data reads or due to glMapBufferRange call, we are not passing the access bit to the call. This CL passes the proper access bits to the call and only wait for GPU writes to finish if access is for read only. This CL also adds access bitfield to the BufferVk::mapImpl() API and have various callers pass in the proper access bits as well. Bug: b/203582620 Change-Id: Ica8493c902dbd7b15996266c81ce0fd4dbfc2520 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3245487 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 191c236a 2021-10-14T17:01:45 Vulkan: Remove "current queue serial". Queries, semaphores, and pipelines instead use the normal vk::Resource design to track their lifetimes. Removes the current serial APIs from all classes. Current serials are still tracked internally in the command queue classes. Bug: b/169788986 Change-Id: Idcd2c2a93bc8225c6f3f7c247eb8fcfb76be1030 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3223644 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@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 ca5e6f68 2021-10-27T11:28:08 Vulkan: Fix accessing stale FB cached variable. This would happen when we start a query after deleting a Framebuffer. Bug: chromium:1262091 Change-Id: I595360bf55fe1757779669f168c95be802b70da5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3248142 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 6b315a78 2021-10-26T19:04:06 Revert "Vulkan: Let BufferVk call into VMA for allocation when possible" This reverts commit 894ce75fb2f75e718ce76e466b8938524f65ac07. Reason for revert: crbug.com/1253325 Original change's description: > Vulkan: Let BufferVk call into VMA for allocation when possible > > Previously BufferVk class maintains a DynamicBuffer pool per BufferVk > object. This CL makes BufferVk skip DynamicBuffer pool in most cases and > do its own BufferHelper allocation directly. DynamicBuffer pool is only > used when desired, which is controled by a flag. With this CL, only > UBO/SSBO/AtomicBuffer will still use DynamicBuffer pool if the buffer > has to be allocated more than once. > > Bug: b/195588159 > Change-Id: I3aa08cef10ee9ee9f01f16403c6fbb99b37f4a8a > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2901241 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/195588159 Change-Id: Iecda3baa6bc887fa0caa86ab076994cae7c10f93 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244257 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Tim Van Patten 9ac2409e 2021-10-26T00:55:06 Reland "Vulkan: Flush descriptor set updates during flush*Commands()" This reverts commit 420e77a64e890ad4c585d72789ca59501be3ac75. Reason for revert: The crash is in ProgramExecutableVk::getOrAllocateShaderResourcesDescriptorSet(), which is unrelated to this change. Creating a CL to reland this (the reland button is failing), to try and investigate further. Original change's description: > Revert "Vulkan: Flush descriptor set updates during flush*Commands()" > > This reverts commit 02b73c2fd738b237f1ab3ecd400feec222903a48. > > Reason for revert: Causes test to crash on Linux/Intel: anglebug.com/6591 > > Original change's description: > > Vulkan: Flush descriptor set updates during flush*Commands() > > > > The intent of this CL is to reduce the number of descriptor set updates > > by delaying the work until all of the GLES commands that could trigger a > > re-update have been performed and the command stream is being flushed. > > To achieve this, flushDescriptorSetUpdates() is being moved from > > setupDraw()/setupDispatch() to > > flushRenderPassCommands()/flushOutsideRPCommands(). > > > > This change also exposed an issue where the BufferView handles were not > > being preserved until flushDescriptorSetUpdates() was called. To resolve > > this, flushDescriptorSetUpdates() is also being called during > > BufferViewHelper::release() before the BufferView memory is released. > > > > Bug: angleproject:5706 > > Change-Id: I61e19af9c0fac891aa2115d72391459b80d22f19 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939385 > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Commit-Queue: Tim Van Patten <timvp@google.com> > > Bug: angleproject:5706 > Bug: angleproject:6591 > Change-Id: I9d1ee3fcb3d1aebc86e60896e0065cab847a92b4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233901 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5706 Bug: angleproject:6591 Change-Id: Ibc7e934b82e6cd90e766f43135583f7c45acfe39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244024 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao 894ce75f 2021-05-21T10:59:14 Vulkan: Let BufferVk call into VMA for allocation when possible Previously BufferVk class maintains a DynamicBuffer pool per BufferVk object. This CL makes BufferVk skip DynamicBuffer pool in most cases and do its own BufferHelper allocation directly. DynamicBuffer pool is only used when desired, which is controled by a flag. With this CL, only UBO/SSBO/AtomicBuffer will still use DynamicBuffer pool if the buffer has to be allocated more than once. Bug: b/195588159 Change-Id: I3aa08cef10ee9ee9f01f16403c6fbb99b37f4a8a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2901241 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 66e8faf7 2021-10-20T14:06:08 Remove ProgramExecutable's "isCompute" property. This consolidates the lists of uniforms, ssbos, etc into one. Requires a few checks to change from graphics shader stages into all shaders. Bug: angleproject:6596 Change-Id: Ic8f6bfc4fa295c3bea9f5f1ded11e8fbca1c3164 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233361 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill aac5d678 2021-10-20T11:48:57 Make "isCompute" private to ProgramExecutable. This eliminates uses of "isCompute" is the Vulkan back-end. Instead of checking the state flag, we can use the context of the current command to determine if we're running a compute or a graphics command. This will eventually lead to us being able to compile the program pipeline objects before we run a draw or dispatch command. Changes the driver uniforms descriptor desc to bind to both graphics and compute shader stages to simplify the code. This could have theoretical but low-risk performance implications. Bug: angleproject:6595 Change-Id: Ie30d419b6ece5b33f5066a034d3805fe96519b36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233903 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill bdc633a8 2021-10-20T12:33:42 Pass command type down to ContextImpl::syncState. This mirrors the command type passed to the object sync functions. It will be useful to determine if we're syncing for a draw or a dispatch call. Bug: angleproject:6595 Change-Id: Ia04bd14a3c2dd2eb211c47a6e55f8ddcbfedfaaa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233904 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 420e77a6 2021-10-20T15:02:45 Revert "Vulkan: Flush descriptor set updates during flush*Commands()" This reverts commit 02b73c2fd738b237f1ab3ecd400feec222903a48. Reason for revert: Causes test to crash on Linux/Intel: anglebug.com/6591 Original change's description: > Vulkan: Flush descriptor set updates during flush*Commands() > > The intent of this CL is to reduce the number of descriptor set updates > by delaying the work until all of the GLES commands that could trigger a > re-update have been performed and the command stream is being flushed. > To achieve this, flushDescriptorSetUpdates() is being moved from > setupDraw()/setupDispatch() to > flushRenderPassCommands()/flushOutsideRPCommands(). > > This change also exposed an issue where the BufferView handles were not > being preserved until flushDescriptorSetUpdates() was called. To resolve > this, flushDescriptorSetUpdates() is also being called during > BufferViewHelper::release() before the BufferView memory is released. > > Bug: angleproject:5706 > Change-Id: I61e19af9c0fac891aa2115d72391459b80d22f19 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939385 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tim Van Patten <timvp@google.com> Bug: angleproject:5706 Bug: angleproject:6591 Change-Id: I9d1ee3fcb3d1aebc86e60896e0065cab847a92b4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233901 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4b75345a 2021-10-06T22:47:16 Vulkan: Don't create pipeline with depthWrite if !depthTest depthWrite is ineffective without depthTest. This change makes sure that depthWrite/depthTest combinations of true/false and false/false generate the same Vulkan pipeline. Bug: angleproject:6410 Change-Id: I47e1524379d40dfb956f026903e0affc7f4fc59d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3210628 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Tim Van Patten 02b73c2f 2021-07-14T15:45:47 Vulkan: Flush descriptor set updates during flush*Commands() The intent of this CL is to reduce the number of descriptor set updates by delaying the work until all of the GLES commands that could trigger a re-update have been performed and the command stream is being flushed. To achieve this, flushDescriptorSetUpdates() is being moved from setupDraw()/setupDispatch() to flushRenderPassCommands()/flushOutsideRPCommands(). This change also exposed an issue where the BufferView handles were not being preserved until flushDescriptorSetUpdates() was called. To resolve this, flushDescriptorSetUpdates() is also being called during BufferViewHelper::release() before the BufferView memory is released. Bug: angleproject:5706 Change-Id: I61e19af9c0fac891aa2115d72391459b80d22f19 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939385 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e637e4c9 2021-10-18T13:54:00 Vulkan: Optimize updating blend state in pipeline desc Updating blend funcs and equations always updated all 8 slots. Now that's only done for the attachments that are present. Bug: angleproject:6298 Change-Id: I58fa7e4dfa27d05fef54cc9d56c7b2aa5ef43dd8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3202550 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi ddedcdaf 2021-10-14T23:35:45 Vulkan: Recycle vkAcquireNextImageKHR semaphores This change optimizes CPU performance by recycling semaphores used for ANI instead of creating and deleting them every frame. Bug: angleproject:6580 Change-Id: I151ea227870ed7b8bd123cbf629a65723c4696d2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3225085 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 123ba58d 2021-10-14T11:56:35 Vulkan: Remove "last submitted serial". This fixes race conditions with the async command processor. Instead of querying specific serial numbers, we ask the command queue to either wait for idle, or return the answer to "are you busy" directly. Bug: b/172704839 Change-Id: I06a8268d9b58d8c33b783af00ca74979ee158316 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3223641 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Lingfeng Yang 9ba5dcf6 2021-10-07T06:56:14 Vulkan: Fix inconsistency in half render area width/height The half render area rotation matrix should be removed. DrawableArea is constant over rotations. The frag coord rotation matrix is still needed because the frag coord generated by GPU is still rotated. Test: DISPLAY=:0 out/Debug/angle_deqp_gles3_rotate90_tests Using test config with: linux nvidia debug vulkan prerotation prerotation270 Test: Cuttlefish SwANGLE ./cts-tradefed run cts -m CtsDeqpTestCases -t dEQP-GLES3.functional.shaders.builtin_variable.fragcoord_xyz Bug: angleproject:6504 Change-Id: I37a6308fdb7586200b19a6138affc78c2c329a96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212427 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 27e7c4dd 2021-10-01T13:43:57 Vulkan: Submit commands when Sync objects are initialized This CL calls ContextVk::flushImpl() after the sync object (VkEvent) has been created and initialized, so it has a valid Serial when it's waited on later. This change allows us to remove any tracking of pending sync objects, since all sync objects will be flushed and submitted by the end of SyncHelper::initialize(). Bug: angleproject:6464 Test: MultithreadingTest.CreateFenceThreadAClientWaitSyncThreadBDelayedFlush Change-Id: I47e7ced452727b434ed974368311fb3439a107c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3200274 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 27a98cf4 2021-10-04T23:39:16 Vulkan: Allow debug labels inside render pass Debug groups and events were previously recorded to the outside-RP command buffer. With this change, they are inserted in the RP command buffer if render pass has started, or outside-RP command buffer otherwise. This creates a more accurate view of groups the application creates. Bug: angleproject:4597 Change-Id: If165bb88e3e66219bad2fe4acc1cc4653c97fb1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3204591 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 2f1d503b 2021-09-16T21:49:14 Vulkan: Fix Vulkan secondary command buffers This change abstracts initialization, begin/end, reset and recycle of command buffers such that both Vulkan and ANGLE secondary command buffers are supported. Bug: angleproject:6100 Change-Id: I8c79764ac98b599fda08fe45cf8c4f0a6573f0f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2987873 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 84bf49a5 2021-09-27T15:20:22 Vulkan: Fixed an issue with primitives generated query The primitives generated query does not work with rasterizer discard, as such rasterizer discard is disabled with the beginQuery call and re-enabled with the endQuery call. The issue is that previously rasterizer discard was not being disabled until ContextVk::resumeRenderPassQueriesIfActive in some cases. This led to cases where primitives generated query did not work. The fix is to insure all beginQuery calls disable rasterizer discard when primitives generated query is active. Added the following end2end test to cover the failure: TransformFeedbackTestES32.MultiPrimitivesGeneratedVsRasterizerDiscard Bug: angleproject:5557 Tests: KHR-GLES32.core.tessellation_shader.tessellation_invariance.invariance_rule* Change-Id: I7e1a0a0bc4a3100349c2c5dbdbe6becd1e0dda29 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3193100 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d9882db5 2021-04-16T21:47:25 Vulkan: Destroy unused resources in a timely manner Deletion of garbage that's eligible for immediate cleanup is currently delayed until the next submission. Fix this by checking if garbage can be freed immediately and deleting it right away if it's not used. Some missing retain() calls needed to be added to semaphore operations in order to avoid freeing resources in use by a memory barrier. Based on a change by spang@chromium.org Bug: angleproject:4628 Change-Id: I034c24d7631c973b4546952f7718a0cd4114763f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2832002 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2d79918f 2021-09-16T16:43:53 Vulkan: Pass command pool around Preparatory work for re-enabling support for Vulkan secondary command buffers. The command pool being passed around is not yet used. Additionally, the work to allocate, initialize, reset and recycle command buffers has been refactored to a helper class for better abstraction. The CommandBufferHelper class now holds a pointer to the pool it was allocated from for clean up. Each ContextVk has its own command pool, where Vulkan secondary command buffers are allocated from. The command pool that CommandProcessor had was unused and is removed by this change. Bug: angleproject:6100 Change-Id: I0d4fa6a76ef06e88779145ffe9c613518a8eb390 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3167213 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Ian Elliott 44935e79 2021-09-15T15:23:10 Change top-level AGI debug marker to not show parameters Per AGI usability request. Bug: b/195784227 Change-Id: I674848944e9bc9eb9da1369c977b9d7d624a0788 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3163480 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 0a592aa4 2021-09-01T19:00:24 Vulkan: Add warning when a fallback texture format is used. Emit a performance warning message when a fallback texture format is been used for sampling. Emit a performance warning when we have to do data copy during format fallback transition. Bug: b/196456356 Change-Id: Ifbe66069e506597dbacfefda10e699a8e9f320d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3139239 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 cf24931a 2021-08-17T10:48:23 Vulkan: Add ImageHelper::getActualFormat() This is preparation for future CLs. In the future vk::Format may not tell you what actual format is. This CL adds a new method of ImageHelper::getActualFormatID() and ImageHelper::getActualFormat() so that we can use these two APIs and avoid using vk::Format, thus reduce reliance on vk::Format. Bug: b/196456356 Change-Id: Ic50e664e033feb5e066f40269c33cffe96024172 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3100319 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi e70a1444 2021-08-05T12:49:21 Vulkan: Fix draw FBO1 followed by resolve FBO2 When syncing the framebuffer for blit/resolve, the render pass was not closed. This would be done later when necessary, except that onFramebufferChange called from FramebufferVk::syncState attempted to adjust the render area of the render pass (as it considered it open). If FBO2 is larger than FBO1, this would cause the render area of the previous render pass to become larger than the framebuffer size. This change makes sure that onFramebufferChange considers the render pass closed no matter what. Test is based on patch from steven@valvesoftware.com Bug: angleproject:6244 Change-Id: Iaec04232cfd2af04ba2564fd2de1dd5f08a40df6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076620 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
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>