src/tests/gl_tests/VulkanPerformanceCounterTest.cpp


Log

Author Commit Date CI Message
Charlie Lao 410d8ba5 2022-12-21T13:27:00 Vulkan: Cleanup ContextVk::hasStartedRenderPass APIs ContextVk has a few hasStartedRenderPass APIs which interpret "start" inconsistently. A RenderPassCommands' life should be notStarted, started, requestEnd, and end (which is equivalent to notStarted). When someone calls onRenderPassFinished on a started renderpass, it does not immediate endRenderPass, but it will set DIRTY_BIT_RENDER_PASS dirty bit so that next draw call will trigger endRenderPass and start a new renderPass. We do not have a name for this state, which adds some confusion. This CL renames the stage between start and onRenderPassFinished to be "active" renderpass, when you have mRenderPassCommandBuffer pointer being valid and you can actively adding draw commands into the renderPass. For this purpose, I haves renamed hasStartedRenderPass to hasActiveRenderPass. This CL also simplifies hasStartedRenderPass implementation to only check mRenderPassCommandBuffer and turned mRenderPassCommands.started as assertion. This CL also changes hasStartedRenderPassWithQueueSerial to actually check mRenderPassCommands.started instead of being "active", so that name reflects what it is actually checking. This CL also changed hasStartedRenderPassWithCommands to hasActiveRenderPassWithCommands to make name and implementation consistent. One added benefit of this is that after this CL we now allow load/store optimization on a started but inactive renderPass as well (for example glInvalidateFramebuffer call after glFenceSync call, or invalidate after FBO blit as demonstrated by MultisampleResolveTest.ResolveD32FSamples tests). Bug: angleproject:7903 Bug: angleproject:7551 Change-Id: I8c8ec4c0d54b9ad0a9e373108dfce6b151c8fe0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4119693 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 77c95de4 2022-11-16T21:12:28 Vulkan: Threaded monolithic pipeline creation With this change, once a pipeline is created out of libraries, a task is scheduled (if necessary) to asynchronously create a corresponding monolithic pipeline. Once the task is complete, the linked pipeline handle is replaced by the monolithic one, gaining back any performance that might have been lost due to the use of libraries. Bug: angleproject:7369 Change-Id: I525fb1e09f8bedc61b9dbef19f9cce7026ff9c53 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031151 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao f17cb883 2022-11-30T17:23:12 Vulkan: Add two tests for per context queue serial work SubmittingOutsideCommandBufferTriggersEndRenderPass: This test is added to test outside command buffer uploads that triggers endRenderPass works properly. CreateMultiSharedContextAndDraw: This test is added to test draw with shared vertex buffer in the shared context group works properly. Bug: b/255414841 Change-Id: I8b4f343fe220a9f0b7c6e042f4663e23ae6f4c9d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4064148 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 7f4caaf5 2022-11-23T15:40:53 Vulkan: Fix VulkanPerformanceCounterTest.SubmittingOutsideCom VulkanPerformanceCounterTest.SubmittingOutsideCommandBufferDoesNotCollectRenderPassGarbage depends on the implementation detail on how we flush and submit commands. The recent change crrev.com/c/4038095 fixes one issue that we are now having one less submission on pixel 6 device. This CL adjust the test to account for that. This CL also changed to set mHasDeferredFlush to true only when there is a started renderpass upon FBO bind. This CL also opt in swiftshader into preferSubmitAtFBOBoundary feature for test coverage and ease of debugging since ARM GPU (which enables this flag) is not been tested on CI. Bug: b/255414841 Change-Id: I295cec33a8ca257a5d5a98604b8c4c0c29e97cdf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4054101 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 68b47e58 2022-11-16T10:46:59 Vulkan: Initial support for VK_EXT_graphics_pipeline_library When available, this change uses VK_EXT_graphics_pipeline_library to create pipelines. Currently, it is only used when graphicsPipelineLibraryFastLinking is available. This restricts the use of this extension to devices where monolithic pipelines are not any more performant than linked libraries. A future change adds support for other implementations by providing async pipeline creation. Bug: angleproject:7369 Change-Id: I1e3b7ac4aa56e75c7d6f4d0d5ea91cb0b862e581 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4031489 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Steven Noonan <steven@valvesoftware.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9b5fff82 2022-10-05T21:56:00 Vulkan: Emulate shader stencil export for MSRTT The MSRTT emulation code had one corner case issue that could lead to performance and memory inefficiencies. That is when stencil needs to be unresolved and VK_EXT_shader_stencil_export is not supported. This change adds a path to emulate VK_EXT_shader_stencil_export and removes this inefficiency. This should help Chromium on older Android devices that lack both this and the recent VK_EXT_multisampled_render_to_single_sampled extensions. Chromium frequently breaks the render pass (crbug.com/1336981), which easily leads to this situation. Bug: angleproject:4836 Change-Id: Ifceec43f7f3807b7e32f4b379edcd4351ae76414 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3935892 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 76f377c5 2022-06-17T16:05:16 Vulkan: Break renderpass when switch from query to non-query getQueryResult will wait for query result to be available, which means a potential CPU bubble if the result is not yet available. On tiler GPUs it will at least wait for renderpass to complete. Usually query enabled draws are very tiny (usually just draw a point to see if it is occluded or not), and query disabled draws are expensive. Some apps do issue a glFlush when switch from query draw to non-query draw, but app like dead_by_daylight does not issue such flush. In order to reduce the bubble, this CL ends renderpass and issue a flush when we switch from query enabled draws to non-query enabled draw so that the result will be available much earlier, this reduce the CPU bubble. This result in dead_by_daylight frame time improves from 5.45ms to 3.5ms (35% improvement). Bug: b/250706693 Change-Id: Ia3a32a9fb336e6f256809b3cad83f61a45415fb1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3931739 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi c19ec948 2022-08-23T10:43:59 Vulkan: Implement imageless framebuffers * Added the attachment image and create info objects to be used for imageless framebuffers created in getFramebuffer(). * New helper class for framebuffers in RenderPassCommandBufferHelper: MaybeImagelessFramebuffer, which includes a framebuffer object, if the framebuffer is imageless, and the image views. This is to make sure that the args for render pass begin info will be correctly set up according to the status of the used framebuffer. * Refactored the collection of attachments in getFramebuffer() into a new function, getAttachmentsAndImagesFromRenderTargets(). It also returns their corresponding ImageHelper* objects used to create the framebuffer (from their image properties). * New struct: RenderTargetInfo; which keeps track of render targets and whether resolve image should be used for the render pass in the form of the enum class RenderTargetImage. * Added a new arg to getFramebuffer(): resolveRenderTargetIn; to use when there is a valid resolveImageViewIn. * Without using the framebuffer cache, we would require to handle the framebuffer destruction by adding it to the garbage instead of releasing it. For example, FramebufferVk::destroy() now adds mCurrentFramebuffer to the garbage. * Added new framebuffer unit tests. * Added tests where two textures with different attributes are bound to the same framebuffer before drawing, one after another. * Added test where a blit occurs from a multisample texture into a non-zero level of a resolve texture, each bound to a separate FBO. * Added a new perf test to compare performance for enabled imageless framebuffers vs disabled. (Credit: cclao) Bug: angleproject:7553 Change-Id: Iacdbd73aaa01cbb0e37abf01ae4892bdfdd4b12f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3827644 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 5d7c4eca 2022-10-02T02:27:27 Vulkan: Don't flush depth/stencil on color blit When syncing the read framebuffer for blit, deferred clears are picked up for the attachments that are not being synced. They are then redeferred so a future command would pick them hopefully as loadOp. This change improves the frame time of Pretty Derby on Pixel 6 by ~23%. Bug: angleproject:7727 Change-Id: Ie7d84c58315cd09204e5229f1ec73605d5a7f639 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3931973 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2debd07d 2022-09-21T11:40:18 Automatically query status of features for tests Now tests can skip based on what features exist, compared to what features are explicitly asked for. For example, a test suite may override-enable a (normally disabled) feature that depends on a hardware capability. With this change, it can be skipped if said hardware capability doesn't exist. As a bonus, tests now correctly skip if the feature is overriden through an environment variable. This change also cleans up VulkanPerformanceCounterTest tests which did the same for a number of specific features. Bug: b/243398683 Change-Id: I84f026e3394eab56fd123e02bee72720c7ed94c6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3909789 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 18f90857 2022-09-09T11:28:00 Vulkan: Use DontCare if attachment is invalidated If an attachment is invalidated, there is no need to preserve the old content. NONE means old content is still preserved, DontCare means discard old content. In this case we do want to discard instead of preserve old content. Bug: b/243711628 Change-Id: I242ac86db6993574b5627d61f7185d155beec0ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3888938 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Yuly Novikov 34332f85 2022-09-13T13:54:14 Fix UninstantiatedParameterizedTestSuite errors on iOS. Some test suites are instantiated only on ES31 or Vulkan, which iOS doesn't support. Bug: angleproject:5417 Change-Id: Iea202934edb3804993dabd38f2629d4992eb2095 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3892013 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Auto-Submit: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 1d04539f 2022-09-06T15:20:32 Fix xfb tests rendering points Some xfb tests render points and verify a coordinate away from the points is unchanged as a means to break the render pass. Due to lack of output to gl_PointSize, these tests are flaky on SwiftShader. Bug: angleproject:7625 Change-Id: I7347516bb755ace87d57df3467c59055f28f1d69 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3877783 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Roman Lavrov 38a38b8d 2022-09-01T17:10:39 Revert "EndXfbAfterRenderPassClosed expectation (0,0) -> (w/2,h/2)" This reverts commit 2dc1c609dea184e5e51a8136df71ae14f4481f52. Reason for revert: Doesn't fix the issue Original change's description: > EndXfbAfterRenderPassClosed expectation (0,0) -> (w/2,h/2) > > Bug: None > Change-Id: I6a8006be39ff8b8208004f533157f27da8e7fe24 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863143 > Auto-Submit: Roman Lavrov <romanl@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: None Change-Id: Ifbb8f12798c9b5bf1f77f997302114263eceaf75 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3868935 Auto-Submit: Roman Lavrov <romanl@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Roman Lavrov 2dc1c609 2022-08-29T15:31:56 EndXfbAfterRenderPassClosed expectation (0,0) -> (w/2,h/2) Bug: None Change-Id: I6a8006be39ff8b8208004f533157f27da8e7fe24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863143 Auto-Submit: Roman Lavrov <romanl@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao c6ad305c 2022-08-25T11:53:46 Vulkan: No depth load/store if depthFunc==ALWAYS/NEVER && mask==FALSE If depthFunc is set to always or never pass with depthMask disabled, and the entire render pass is drawing with that state, then there is no need to load or store depth value. Bug: b/243711628 Change-Id: I71d470bda49abc48a4a6e20895b7e056c33fa33a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3858143 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 7428369a 2022-08-29T17:59:38 Vulkan: Use macros for load/store Op check Use macro instead of inline function for result check so that the correct line number gets print out for the failed check. Bug: b/243711628 Change-Id: I1141f6a63fd01bb9fe0cf5c06b81b378e8acc08e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3864347 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9a258281 2022-08-17T17:47:22 Fix submit-count perf counter test on ARM On ARM, the preferSubmitAtFBOBoundary feature causes extra submissions that need to be taken into account. Bug: chromium:1337538 Change-Id: Id545ee3e65fc943aff51ea3721e9c19bc0afd4a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3835168 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 2c351351 2022-08-07T22:31:40 Vulkan: Don't break render pass on read-only buffer updates When uploading to a buffer that is in use by the GPU, we either acquire a new buffer and copy the contents over, or stage the update and do a GPU copy. Ignoring all other conditions, this decision was made based on whether a small or large part of the buffer is being updated; small updates where staged. However, if the current render pass uses the buffer in read-only mode, the staged update would break it (to apply the update). In this change, this situation is detected and the acquire-and-update path is chosen even for small updates. Bug: angleproject:7534 Change-Id: Ie2c0989449dcc7d03695a003cf6f353920f8fb65 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812566 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 928c5016 2022-08-04T12:28:12 Vulkan: Fix garbage collection vs outside-RP-only flush In https://chromium-review.googlesource.com/c/angle/angle/+/3379231, an optimization was implemented such that the excessive recorded texture uploads would get flushed early and submitted. This caused a use-after-free bug in the following situation: * Draw with pipeline A * Delete A <--- this puts A in the Context garbage list * Upload a lot of data At this point, the flush threshold could pass and the commands recorded outside of the render pass up to this point would be submitted. Associated with this submission was the current garbage, including pipeline A. However, the render pass that uses pipeline A is still not submitted. Now if after some time the render pass is still open, but the "completed commands" are checked (another set of uploads causing another submission, a query status check, etc), the garbage can be cleaned up. When the render pass closes next and is submitted, the implementation attempts to use the pipeline, which is already deleted. In this change, outside-render-pass-only submissions no longer reference the current garbage. This has the side effect that the temporary buffers used for uploading texture data won't be released early. A future optimization may want to separate the garbage list in ContextVk to render pass and outside render pass garbage. Bug: chromium:1337538 Change-Id: I4d31edc53916785d44420f4d6b4b2578ca3996e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812555 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Hailin Zhang 553b1334 2022-07-28T23:33:28 Vulkan: fix default msaa framebuffer resolve issue. Bug: b/239217726 Change-Id: I826aad7495814e0a178a586c4cfd5943278cddac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3793304 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi f000215d 2022-07-26T21:16:14 Vulkan: Optimize transform feedback buffer tracking Prior to this CL, if transform feedback was active at the time of render pass closure, its buffers were cached in ContextVk. Later, these buffers were used to close the render pass if they were used for any other reason (such as vertex attribute). However, this meant that the render pass could close unnecessarily if transform feedback was ended right after the render pass is closed. The closure of the render pass was an awkward place to cache the used transform feedback buffers (because at that point, the buffers are actually no longer used). Instead, this change makes sure that the buffers are cached when transform feedback buffers are first used by the render pass, and the cache is cleared at the end of the render pass. Bug: angleproject:4622 Change-Id: I31c0a1e20d48f2e261e2cf37adb0a46db683e6fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3788309 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 53d40aed 2022-07-15T15:03:25 Vulkan: Destroy descriptorSet cache when BufferHelper destroyed For atomic counter buffers or other cases, dynamic descriptor is not been used. Right now when such buffer is destroyed, the cache is still lingers around. With this CL, when a new cache entry has been created, we record the cache entry in the BufferHelper. When BufferHelper is destroyed, we also immediately destroy the cache entry since the cache will no longer reused. Bug: b/237686097 Change-Id: I26eee96318fbc003e65318c0b8263dc61092f350 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3764044 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao c7459a46 2022-07-15T09:55:03 Vulkan: Destroy descriptorSet cache when BufferBlock destroyed When a new cache entry has been created, we record the cache entry in the BufferBlock. When BufferBlock is destroyed, we also immediately destroy the cache entry since the cache will no longer reused. This CL also removes DescriptorCacheResult from various APIs since it is now redundant with newSharedCacheKey argument. Bug: b/237686097 Change-Id: I14fa8906fdbe7d9226c8e8ecddef2beb05fbaa5c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3756694 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Auto-Submit: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 496bddf3 2022-07-14T20:58:03 Skip mutable texture upload tests through feature * Added a condition in the mutable texture upload tests in VulkanPerformanceCounterTest.cpp, to skip the test if the feature `MutableMipmapTextureUpload` is disabled on that platform. Bug: angleproject:7308 Change-Id: Iff1985cabb463dc82ef15340cf3c485a0b680f0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3765180 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 01092c48 2022-07-12T10:11:22 Vulkan: Destroy descriptorSet cache when shader image is destroyed Similar to texture descriptor set, this applies to images used as shader resource. When a texture is used in a shader resource descriptorSet, we record it. When texture is destroyed, we also destroy that shader resource descriptorSet cache. Bug: b/237686097 Change-Id: I475982fcec45535cc285a4aebca922d01efc7ed2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3758884 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 32c5fd8a 2022-05-13T14:31:03 Reland "Vulkan: Flush texture updates more often" This is a reland of 8bb7c35c2159de2fa9e9a008679c692edd4402a6 * Added a condition to make sure the previous texture is not immutable when performing the optimization. * Fixed the issue where mipmap textures with unequal dimensions were not flushed. * Added related tests. * Added kEnableMutableMipmapTextureUpload, a flag to enable/disable the feature (enabled by default). Original change's description: > Vulkan: Flush texture updates more often > > * Added a pointer to the previous texture in ShareGroupVk so we can > flush the texture updates once we switch to a new texture. > > * We check if mip levels 0 and 1 are conformant in terms of > size, format and number of samples. > > * As a part of size check, we also check depths if the texture > target is either 3D, 2D array, or cube map array. For the former > two, they have to conform to mip scaling similar to width and > height. For the latter, the depth represents layer-faces and does > not change for mipmaps. > > * Added a test to ensure the pointer to the previous texture is > deleted when the corresponding texture is deleted, so the old value > is not accessed by a future mutable texture. > > * Added tests to make sure the mutable texture is uploaded with > the appropriate mip level attributes, and not uploaded in cases of > size/format inconsistencies, incompleteness, and no base level. > > Bug: b/202744914 > Change-Id: I9c2c1af87a8a49e75d3ad25523436b0cd51a7e81 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3606329 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Bug: b/202744914 Change-Id: I2bdbcd0182a57c18c1a18968396251a2e366731b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3646959 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Eddie Hatfield 89e38b57 2022-06-22T15:04:08 Refactor to use ANGLETest vs ANGLETestWithParam Bug: angleproject:6747 Change-Id: I72ad52d0268eae0e1a401f12f3e94cc5efa402f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3719002 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi e50351cb 2022-06-10T22:28:58 Vulkan: Don't close render pass on framebuffer fetch For applications that use framebuffer fetch in the same RP as non-fetch programs, we can save some extra RenderPasses by always creating our RP objects with input attachments enabled. This works almost identically except for needing to use the images in a "GENERAL" layout instead of "COLOR_ATTACHMENT_OPTIMAL". According to partners it is possible to achieve performance parity even with GENERAL layout. To remove any potential negative impacts of using the GENERAL layout, the context enters this always-framebuffer-fetch mode only and as soon as a framebuffer fetch program is created. Applications that don't use framebuffer fetch are thus unaffected. This eliminates 20 render passes in the Genshin Impact trace (out of about 58). On a Pixel 6 the resulting benchmark score speeds up by ~25%. For Real Racing 3, the speed up is ~30%. Based on change by jmadill@chromium.org Bug: angleproject:7375 Change-Id: Ib6c73e95d06229f8545d502b388ee2a55a582323 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3697308 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 97a6e581 2022-05-30T16:50:26 Vulkan: Useful implementation of program binaries ANGLE already serializes the pipeline state for the sake of OES_get_program_binary. This serialization had limited usefulness however, since the Vulkan driver hasn't actually created any pipelines yet (which is a costly part of program creation). Simultaneously, ANGLE deferred Vulkan pipeline creation to draw time, which causes hitching. In this change, a handful of Vulkan pipelines are precreated at link time; those at least that are sure to create different blobs in the pipeline cache (different spec consts or SPIR-V generation). These pipelines are created in the program executable's cache. The cache is then merged into the shared renderer cache (for potential blob reuse by other programs). With this, two goals are achieved: - Most pipelines created at draw time hit the pipeline cache, avoiding costly compilation. - When the program binary is retrieved, the contents of the program executable's pipeline cache is also returned. On reload, the cache is recovered, resulting in faster startup. Bug: angleproject:5881 Change-Id: I46c5451a7d0b16dffd40e44015e094640886880b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3671977 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao c5ee5a9c 2022-06-10T10:29:11 Vulkan: Add test CreateDestroyTextureDoesNotIncreaseDescSetCache This adds a test to demonstrate a usage pattern seen with surfaceflinger (see b/234602034 for detailed reproduce steps). With every iteration of notification shade pop up, after all other optimization, we are still seeing four descriptor sets gets allocated. Surfaceflinger is allocating AHB and texture every time and after usage it gets destroyed. This test uses normal texture instead of EGLImage for easy of debugging on linux/windows platform, but it demonstrated the exact same problem with AHB texture. Bug: b/235523746 Change-Id: I7ca1ff13b61ade1449a56d3afc8a84926ad13850 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700570 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 3dfc8004 2022-06-08T14:24:48 Vulkan: Optimize sync followed by swap Previously, inserting a sync object immediately caused a submission. That was done in https://chromium-review.googlesource.com/c/angle/angle/+/3200274 to be able to wait until the sync object is signaled without having to wait for whatever is recorded after it until a flush naturally happens. Some applications issue a glFenceSync right before eglSwapBuffers. The submission incurred by glFenceSync disallowed the optimizations that eglSwapBuffers would have done, leading to performance degradations. This could have been avoided if glFenceSync was issued right after eglSwapBuffers, but that's not the case with a number of applications. In this change, when a fence is inserted: - For EGL sync objects, a submission is issued regardless - For GL sync objects, a submission is issued if there is no render pass open - For GL sync objects, the submission is deferred if there is an open render pass. This is done by marking the render pass closed, and flagging the context as having a deferred flash. If the context that issued the fence sync issues another draw call, the render pass is naturally closed and the submission is performed. If the context that issued the fence sync causes a submission, it would have a chance to modify the render pass before doing so. For example, it could apply swapchain optimizations before swapping, or add a resolve attachment for blit. If the context that issued the fence sync doesn't cause a submission before another context tries to access it (get status, wait, etc), the other context will flush its render pass and cause a submission on its behalf. This is possible because the deferral of submission is done only for GL sync objects, and those are only accessible by other contexts in the same share group. Bug: angleproject:7379 Change-Id: I3dd1c1bfd575206d730dd9ee2e33ba2254318521 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3695520 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao ee1dd7f4 2022-06-08T13:17:39 Vulkan: Add test for glEGLImageTargetTexture2DOES issue This add a test that repeatedly calling glEGLImageTargetTexture2DOES on the same source EGLImage with the same texture parameters should not causing texture's descriptor set cache to keep growing. This is the usage pattern we are seeing with surfaceflinger. Bug: b/234602034 Change-Id: I38ec0a0b2580b8985c27e8c9f7edf14aa7843023 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3696677 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao d655ad29 2022-05-31T14:20:16 Vulkan: Add tests for FramebufferCache growth bugs When texture attached to FBO gets respecified, we shouldn't keep growing FramebufferCache. When texture attached to fbo get glTexParameteri(GL_TEXTURE_SWIZZLE_R) call with the same value, we should also not destroy/recreate framebuffers (in fact should not recreate VkImageView). We ran into this usage pattern on surfaceflinger. When texture attached to fbo get glTexParameteri(GL_TEXTURE_SWIZZLE_R) call with different value, we should also not destroy/recreate framebuffers (in fact should not recreate VkImageView). We ran into this usage pattern on surfaceflinger. Bug: b/234769934 Bug: b/234602034 Change-Id: I9fc881486f95cc3da843f50fa0a8cdcbfd4fc625 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3681081 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b0d75fb5 2022-05-31T16:55:23 Vulkan: Use 64-bit counters Some upcoming counters don't fit in 32 bits. Bug: angleproject:5881 Change-Id: I2de8a603cabdb5f7417c29d5f37a50899485d6d3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3679488 Commit-Queue: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Min Zhang e56f227d 2022-05-13T08:50:12 Vulkan: Add case: TextureSampleByDrawDispatchDraw This case is used to verify the implicit synchronization when GL executables switch from draw to dispatch. Besides, suppress a VVL on it. Bug: angleproject:7031 Change-Id: Idab68cfd0d4b17685f5eb5b3eec7f2cad12e5877 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3646927 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 03ccd9cc 2022-05-13T16:12:11 Revert "Vulkan: Flush texture updates more often" This reverts commit 8bb7c35c2159de2fa9e9a008679c692edd4402a6. Reason for revert: crashes tests in linux-rel Example: https://ci.chromium.org/ui/p/chromium/builders/try/linux-rel/1012030/overview Also possible flakiness https://anglebug.com/7308 Repro: out/Debug/bin/run_blink_web_tests fast/canvas/OffscreenCanvas-2d-drawImage.html Original change's description: > Vulkan: Flush texture updates more often > > * Added a pointer to the previous texture in ShareGroupVk so we can > flush the texture updates once we switch to a new texture. > > * We check if mip levels 0 and 1 are conformant in terms of > size, format and number of samples. > > * As a part of size check, we also check depths if the texture > target is either 3D, 2D array, or cube map array. For the former > two, they have to conform to mip scaling similar to width and > height. For the latter, the depth represents layer-faces and does > not change for mipmaps. > > * Added a test to ensure the pointer to the previous texture is > deleted when the corresponding texture is deleted, so the old value > is not accessed by a future mutable texture. > > * Added tests to make sure the mutable texture is uploaded with > the appropriate mip level attributes, and not uploaded in cases of > size/format inconsistencies, incompleteness, and no base level. > > Bug: b/202744914 > Change-Id: I9c2c1af87a8a49e75d3ad25523436b0cd51a7e81 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3606329 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Bug: b/202744914 Change-Id: Id51fd4c76d058aa5100ec58ba618098c8f614253 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3645493 Auto-Submit: Roman Lavrov <romanl@google.com> Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Lingfeng Yang <lfy@google.com>
Jamie Madill 21ad9b3c 2022-04-07T09:57:26 Vulkan: Add generic descriptors for DS cache. With the new design, the descriptor set cache keys include all identifying information needed to reconstruct the update descriptor sets calls except the specific resource handles. The places for the resource handles are held by serials intead. When we miss the cache, we no longer need a second step to then construct the update calls, and can build the update calls directly from the key structures in combination with a list of resource handles. Bug: angleproject:6776 Change-Id: If1660a557585a75e9aa2560d6a38c56b62f555c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3484981 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d8d396db 2022-04-07T09:57:25 Vulkan: Add shared descriptor set caches. This allows programs with the same sets of descriptors to share descriptor sets. Currently there is no cache eviction. This CL adds a new "Meta" class to manage the descriptor set caches. Each shared descriptor pool is unique to a descriptor set layout. The descriptor set cache is moved into the pool class. Now every instance of a descriptor pool in ANGLE has easy access to a descriptor set cache as well. Bug: angleproject:6776 Change-Id: I06982e0349f5a87e4578e769fa356ce8e7ab49f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3424660 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 8bb7c35c 2022-03-23T19:14:54 Vulkan: Flush texture updates more often * Added a pointer to the previous texture in ShareGroupVk so we can flush the texture updates once we switch to a new texture. * We check if mip levels 0 and 1 are conformant in terms of size, format and number of samples. * As a part of size check, we also check depths if the texture target is either 3D, 2D array, or cube map array. For the former two, they have to conform to mip scaling similar to width and height. For the latter, the depth represents layer-faces and does not change for mipmaps. * Added a test to ensure the pointer to the previous texture is deleted when the corresponding texture is deleted, so the old value is not accessed by a future mutable texture. * Added tests to make sure the mutable texture is uploaded with the appropriate mip level attributes, and not uploaded in cases of size/format inconsistencies, incompleteness, and no base level. Bug: b/202744914 Change-Id: I9c2c1af87a8a49e75d3ad25523436b0cd51a7e81 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3606329 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Min Zhang 3d55cf0c 2021-12-30T11:27:26 Vulkan: Optimize the vkImage layout when used as GL_image If one vkImage has been used as GL_image in compute shader and as a GL_texture in fragment shader, no dependencies are needed for the fragment shader and other pre-fragment graphics shaders, like vertex/tess/geom. If we only assign the vkImage layout as writable when running GL executables that have Image Textures, we can specify more precise read-only barriers when running read-only GL executables. Bug: angleproject:6862 Change-Id: Iff37fdce13fea637751899253e535bf3f6663200 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3366014 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao d075dfe2 2022-05-03T16:25:26 Vulkan: Reduce kMaxBufferToImageCopySize to 64M Bug: b/230538246 Change-Id: Id2ef9c35f74fb6f526744903402562f9354bfcdb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3625834 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 3e05b93a 2022-04-12T19:39:19 Vulkan: MSAA swapchain resolve based on renderArea * Updated the MSAA resolve subpass so it can only be performed if the render pass is covering the entire area (e.g., not scissored). * Added test to make sure that the subpass resolve does not occur when the render pass does not cover the entire area. Bug: angleproject:6762 Bug: angleproject:7196 Change-Id: Iac3ab4b655dfeb7bff1348cc5e289a77a4dc0b83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584942 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 3eb2bcf7 2022-04-27T16:13:04 Vulkan: Fix syncval errors with DONT_CARE for unused attachments DONT_CARE is a write operation for synchronization purposes. ANGLE doesn't synchronize depth/stencil attachments that are not written to, as it uses the read-only layout. This change makes sure LOAD/STORE_OP_NONE are used instead of DONT_CARE for attachments that are not used, even if they don't have defined contents. This allows ANGLE to continue to not do additional synchronization. Bug: angleproject:5371 Bug: angleproject:5962 Bug: angleproject:6411 Bug: angleproject:6584 Change-Id: I539379aa34f6655f00e798e8c4a5c57f40f7a12d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3612182 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 7d31a47f 2022-04-23T00:19:15 Vulkan: Optimize away eglSwapBuffers for single buffer surfaces For single buffer surfaces, eglSwapBuffers serves two purposes: - Switch to/from single buffer mode - Implicitly issue a glFlush Simultaneously, for single buffer surfaces, glFlush serves three purposes: - Submit the commands - Call queue present (if necessary) - Throttle the CPU In this mode, ContextVk::flush() already redirects to the surface, calling WindowSurfaceVk::swapImpl() which calls back to ContextVk::flushImpl() (to submit the commands), calls queue present and throttles the CPU. If the application calls eglSwapBuffers(), the exact same thing happens (i.e. WindowSurfaceVk::swapImpl() is called to the same effect). Calling swapImpl() leads to an addition of the corresponding submit serial to the "swap history". The CPU throttling code always throttles the CPU to the serial of two swaps ago. Unnecessary calls to eglSwapBuffers() (when there is no command to be flushed) in single buffer mode would thus lead to the CPU throttled to the end of the last submission, effectively turning into a glFinish(). In this change, eglSwapBuffers() in single buffer mode, when not switching to/from this mode, is redirected to glFlush() as it's functionally equivalent. Simultaneously, ContextVk now tracks whether it has any pending commands for submission at all, and skips glFlush() altogether if there are none. Together, this results in the unnecessary eglSwapBuffers() to become no-op. Bug: b/229908040 Change-Id: I0e3b4a8b7eb4f6b0e0ed22260644825fc67dd330 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3603841 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 4aae5815 2022-04-22T13:21:03 Vulkan: Overlay widgets for submission statistics Bug: angleproject:7084 Change-Id: I68e69bda43862f9f2711c25a28dbe4745c19a45c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3602832 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2db718ed 2022-04-21T23:13:02 Vulkan: Skip empty submissions A number of places in ANGLE perform an implicit flush; eglSwapBuffers(), glFenceSync() etc. Sometimes these flushes are unnecessary because there is nothing to submit. Additionally, an application may unnecessarily issue glFlush() with nothing recorded. In this change, empty command buffers are automatically not submitted, optimizing these unnecessary flushes away. Bug: angleproject:7084 Change-Id: Iecb865b6b9ef8045dfecda7b5221874f7031b42e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3600837 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 3b38b379 2022-04-20T10:44:24 Vulkan: Add feature avoid HOST_VISIBLE and DEVICE_LOCAL combination Discrete GPUs device local memory usually is not CPU accessible. This adds a feature flag to control that. Fixed bug in BufferVk that when mapRangeImpl is called from angle internal, unmapImpl was using front end mapping parameters that is incorrect. We have to cache the mapping parameters in the backend to hangle the mapRangeImpl/unmapImpl calls from internal. Fixed the test bug in ComputeShaderTest.BufferImageBufferMapWrite that we are calling glMapBufferRange with GL_MAP_READ_BIT but are actually writing to the map pointer. This should result in undefined behavior per spec. Fixed the test bug in GLSLTest.* that VerifyBuffer calls glMapBufferRange, but was giving incorrect length which result in data only been partially copied. This bug was hidden due to previously all buffers are CPU accessible and there is no copy needed. Fixed the test bug in ReadPixelsPBOTest.* and ReadPixelsPBONVTest.* that calls glMapBufferRangeEXT, but was giving incorrect length which result in data only been partially copied. This bug was hidden due to previously all buffers are CPU accessible and there is no copy needed. Added new skipped syncval messages. Because this CL triggers a copyToBuffer call for some of the buffers and that changes the syncval message signature for the same reasons (i.e, feedback loop or synval does not know the exact range of buffer been used for vertex buffers etc). Bug: angleproject:7047 Change-Id: I28c96ae0f23db8e5b51af8259e5b97e12e8b91f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3597711 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill b2a1f0d2 2022-04-14T07:58:32 Track total vs per-frame descriptor set counters. This will give more consistent measurements for descriptor set caches and descriptor set allocations. Bug: angleproject:6776 Change-Id: I584b8807ad19f8393ae54cc1d88b319c8f7f9f39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584636 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi fcec6904 2022-04-13T14:18:06 Generate feature variable names from display names The json file now only contains the feature display name. The variable name is automaticaly derived. For consistence with Chromium and other Chromium-based projects, the display name is now always snake_case, and that's what's specified in the json files. This also makes camelCase variable name generation trivial (as opposed to the other way around). Feature overrides now accept both snake_case and camelCase names to ensure compatibility with existing scripts. This is done by removing _ and comparing override names with feature names in lower case. Bug: angleproject:6435 Change-Id: I0b6ed2bbf5c312bc4f4be7b3c7d55dbaca2a9886 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3584630 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 3cea7fcc 2022-03-16T16:33:43 Split Context ResourceUseList to RP Commandbuffers * Added mResourceUseList to each command buffer helper in an effort to move mResourceUseList away from ContextVk. * submitFrameImpl() renamed to submitCommands() * Moved the functions acquireResourceUseList() and onRenderPassFinished() in submitCommands() to the submitFrame functions calling it. Bug: angleproject:7103 Change-Id: I2487d5b86ea0a4d504f283aa7128501651317fe0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3531368 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Amirali Abdolrashidi 607d398e 2022-03-14T16:32:21 Vulkan: Optimize resolve of multisample swapchains * Resolves the multisampled image if the last render pass draws into the default framebuffer. * Added test to check the number of resolves in the optimization subpass (credit: Xinyi He) * Added test to check the number of resolves outside the subpass. * Added disabled test to see if the subpass resolve works. Bug: angleproject:6762 Change-Id: I86a8db3387851ab97d5f7a3d8a0ff26961254c14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3523062 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 0ffff9ed 2022-04-05T15:56:23 Vulkan: Perf counters test for glInvalidateSubFramebuffer Bug: angleproject:7183 Change-Id: Id07c6467c746de312d6ba9695bdc98c9460144ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3573182 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 36a051d8 2022-03-28T22:53:38 Vulkan: Move mid-RP color clear to loadOp if content undefined Instead of using vkCmdClearAttachments, if the color attachment has not been written to, modify the loadOp of the currently open renderpass to CLEAR. This is an adaptation of commit cfe5a1735a934cc83133bb6c69d19aa27278a270 The difference with that commit is that, with the prior changes that added tracking of color attachment access in the render pass, this change is greatly simplified by being able to immediately know if clear can be moved to the beginning of the render pass. Bug: angleproject:5048 Change-Id: I72b3613ad08ff869b71aced7e1f4e9be916d7b49 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3557815 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Arthur Eubanks 9a0b306d 2022-03-28T10:33:06 Remove set but otherwise unused variables Recent Clang versions have enhanced -Wunused-but-set-variable which now warns about these. Bug: chromium:1309955 Change-Id: If6a475e9f373b077fa3d9ef6f2274c8d115b5d24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3553570 Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Arthur Eubanks <aeubanks@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 2d54b68e 2022-03-22T17:32:06 Vulkan: Use storeOp=None more opportunistically Previously, storeOp=None was used when the attachment was in "read-only mode" and storeOp=Store. With this change, storeOp=None is used more opportunistically when it's deemed that the attachment was not written to, regardless of if it was put in "read-only mode" (a construct added to support read-only depth/stencil feedback loops). Bug: angleproject:5048 Change-Id: I10832d4e2b97793ea1347a47175cbf8ce9af57d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3556368 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Steven Noonan a03ba732 2022-03-24T23:30:06 Vulkan: add tests for clearing/drawing after invalidate Two tests, to ensure that: - Clear gets treated as a LoadOp instead of as an out-of-renderpass clear, even if draws don't touch color buffers. - Invalidated image gets contents marked as defined after invalidate+clear, so draws to it get a renderpass with LoadOp=Load Bug: angleproject:7127 Change-Id: I78a8bd2100ba941a74755402649ae8edc7978026 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3552090 Reviewed-by: Jamie Madill <jmadill@chromium.org> Auto-Submit: Steven Noonan <steven@valvesoftware.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 53e432fe 2022-03-28T15:18:51 Vulkan: Track LOAD/STORE_OP_NONE in perf counters Bug: angleproject:5048 Change-Id: I52ed67e7a5c173dd1a7202fd6d4a1c484e79ea75 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3556367 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 041c4c6d 2022-03-25T16:30:03 Vulkan: Track color attachment usage like D/S in render pass That is in preparation for optimizing mid-render-pass clears, which requires an answer to the following query: "has this color image been read from / written to so far in the render pass?" With this change, a future CL will also be able to optimize color attachment invalidates, which currently break the render pass unconditionally, the same way depth/stencil is optimized. Bug: angleproject:5048 Change-Id: I3d3ee40d8444e6861c06340d5d52b17f5ee895b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3542989 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3f331fae 2022-03-22T15:23:38 Vulkan: Dirty bits for depth/stencil access and feedback loop In preparation for doing the same for color, the depth/stencil render pass access and feedback loop modes are now updated with ContextVk dirty bits. This change also fixes clear after read-only depth/stencil feedback loop. The render pass wasn't broken in that case. Bug: angleproject:5048 Change-Id: I40f9b49593f9e6f35f42408e41c9d6267edb375e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3542988 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c8f86c21 2022-03-22T17:40:43 A handful of clear-related tests Credit Tim Van Patten <timvp@google.com> Bug: angleproject:5048 Bug: angleproject:5194 Change-Id: I00eccf1049118c3fba3c2c560c781cf09cf23362 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3543732 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 730c1271 2022-01-07T13:41:08 Vulkan: Submit queue more often for texture data Outside command buffers should be flushed more often in order to prevent the texture data accumulation just before the first render pass when they are referenced. * Added a tracker next to copyBufferToImage() for texture size (in ContextVk). When its value passes kMaxBufferToImageCopySize, the outside command buffer operations should be submitted and the tracker would be reset. Currently, the threshold value is set to 1 << 28 = 256M. * Added a variation of submitFrame() to be used in outside command buffer submission. The main difference is that it copies mResourceUseList into GetShareGroupVk() rather than move it. * Refactored the two functions into submitFrameImpl(). * Added a helper function to submit the outside command buffer. * Added explicit copy functions for ResourceUseList and SharedResourceUse. The counter in the copied object is incremented by 1. * Added a test to make sure submitting the outside command buffer does not break the render pass. Bug: angleproject:6354 Change-Id: Ia1d4f857fcbd06934609c94622ccbf675b3b1c72 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3379231 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Jamie Madill 3739a195 2022-03-09T13:56:36 perf tests: Record perf counter metrics. This adds a new command line argument that will allow the user to specify perf counters to record into the test output. Bug: angleproject:4918 Change-Id: Ia7432ff96eadf13ef681f67d2d503d00fd83e06e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3516970 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill a956162c 2022-03-01T13:05:29 Vulkan: Expose performance counters via extension. This CL rewrites the Vulkan perf counters test to work in the angle_end2end_test suite using the newly exposed AMD extension. Note that we implement only a subset of the extension. Instead of generating monitors and starting/stopping them we simply read back all performance counter data at once using the special montior value "0". The CL also enables these tests on SwiftShader. Bug: angleproject:4918 Change-Id: I5d8f6eecb1ccff448657cbdb65b51a225dfb90c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3497538 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 5749ec7d 2022-03-01T02:14:42 Revert "Vulkan: Move mid-RP color clear to loadOp if content undefined" This reverts commit cfe5a1735a934cc83133bb6c69d19aa27278a270. Reason for revert: https://bugs.chromium.org/p/angleproject/issues/detail?id=5048#c7 @timvp That change just caused a regression in my project. I clear the color + depth buffer before drawing, but initially draw only to the depth buffer. It seems that it decided to ignore the color buffer clear as a result of that. Original change's description: > Vulkan: Move mid-RP color clear to loadOp if content undefined > > Instead of using vkCmdClearAttachments, if the color attachment has not > been written to, modify the loadOp of the currently open renderpass to > CLEAR. > > Bug: angleproject:5048 > Test: VulkanPerformanceCounterTest.MidRenderpassClear > Change-Id: Ida47e6ac7d0f29e2c49bdf2e74c1d876a5d7c223 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3381912 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Tim Van Patten <timvp@google.com> Bug: angleproject:5048 Change-Id: Iec5c73632429a80f955f7d659cf670f9cbb6c9b7 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3496662 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten cfe5a173 2022-01-11T19:26:42 Vulkan: Move mid-RP color clear to loadOp if content undefined Instead of using vkCmdClearAttachments, if the color attachment has not been written to, modify the loadOp of the currently open renderpass to CLEAR. Bug: angleproject:5048 Test: VulkanPerformanceCounterTest.MidRenderpassClear Change-Id: Ida47e6ac7d0f29e2c49bdf2e74c1d876a5d7c223 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3381912 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Charlie Lao f996d4d8 2022-02-16T09:27:04 Vulkan: Fix DynamicBuffer cache reuse. There is a regression bug that the DynamicBuffer's BufferHelper's size is no longer the size of entire buffer block's size, but the size of suballocation. This caused buffer reuse logic to screw up since it relies on the size to make the decision to keep or free the mFreeBufferList. This CL fixes this bug by using the buffer block's size. This CL also removes DynamicBufferPolicy since it is not used any more since most of DynamicBuffer usages that triggered that DynamicBufferPolicy implementation have been switched to BufferPool. The remaining DynamicBuffer usage is only for attributes and uniforms which are generally small and per context. Bug: angleproject:6980 Change-Id: I9e013cbd67dd74f5e7fc5bb7d9c9696bd1f69965 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469714 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill 8cb58667 2022-02-16T13:47:22 Vulkan: Add uniform descriptor set caching test. This covers the case where we'd continually miss the cache due to buffer size mismatches. Bug: angleproject:6980 Change-Id: Ia58871f431b6241af52fa0c37ab51952bc1c4f97 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469227 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi a0d558f0 2022-02-16T12:23:29 Vulkan: Fix D/S invalidation for MSAA EGL configs Bug: angleproject:7007 Change-Id: I165ce16e8fdd388ae13aa2e3d05901199706ee24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3469221 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov aad7ddb2 2021-12-30T20:38:03 Skip VulkanPerformanceCounterTest.InvalidateDrawDisable on Linux Vulkan AMD Bug: angleproject:6857 Change-Id: I07484ae2253227d1abad8e554401b4e6da825cb3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3359004 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
angle-autoroll 66c89b0f 2021-10-06T16:28:42 Fix and disable MSVC warnings Needed because some warnings are no longer disabled after http://crrev.com/c/3189512. Also includes https://github.com/KhronosGroup/OpenCL-Headers/pull/179, needed after clang upgrade to llvmorg-14-init-5410-gd0473681 Bug: chromium:1257173 Change-Id: I4f844aa972362c488cb6d37244439e2126f2c1c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3210629 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Mateusz Przybylski 076366cc 2021-10-01T23:42:04 Revert "VertexArray: Don't syncState on Buffer map/unmap." This reverts commit 3d429f597fde950e789ca3684abbabd540157773. Reason for revert: This change is causing crashes in ANGLE stack. Original change's description: > VertexArray: Don't syncState on Buffer map/unmap. > > Map/unmap calls are now treated like contents change events. Similar > to BufferSubData calls. > > Bug: angleproject:6371 > Change-Id: Ie0a4c521ffdedfa723d47eddd21c6f68dde044ac > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3187811 > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> Bug: angleproject:6371 Change-Id: I57480a18f3c70a1bf2a539e3047402c71802655d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3200288 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 3d429f59 2021-09-27T14:27:31 VertexArray: Don't syncState on Buffer map/unmap. Map/unmap calls are now treated like contents change events. Similar to BufferSubData calls. Bug: angleproject:6371 Change-Id: Ie0a4c521ffdedfa723d47eddd21c6f68dde044ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3187811 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill cf8c5678 2021-09-17T13:16:36 Vulkan: Don't sync VAOs after BufferSubData calls. We still need to syncState after buffers that contain converted attributes are updated. Includes a perf regression test. Bug: angleproject:6371 Change-Id: I54227fc43e7b3fe79072da7783dab0177ccb0486 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3182706 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 9158436e 2021-07-31T18:26:16 Vulkan: glMapBuffer(): Create new buffer (Buffer Ghosting) When glMapBuffer() is called, if the buffer is in use but not being written to by the GPU: 1.) Create a new buffer. 2.) Copy the contents of the old buffer into the new buffer. 3.) Map the new buffer and return the pointer. Creating a new buffer prevents ending the renderpass and flushing the commands to allow the in-use buffer to be mapped. This change increases Idle Heroes performance from 40FPS to 125FPS. Bug: angleproject:5971 Test: VulkanPerformanceCounterTest.MappingGpuReadOnlyBufferGhostsBuffer Test: BufferDataTest.MapWriteArrayBufferDataDrawQuad Test: BufferDataTest.MapWriteArrayBufferDataDrawArrays Change-Id: I1d433d179f9f5110a948f191c5aedda5397acac8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3065799 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Peter Kasting 0d06c3cf 2021-07-26T04:30:39 Fix some instances of -Wunused-but-set-variable. Bug: chromium:1203071 Change-Id: I144165ae5ec47aba88658030a6ba3e371bf31ee7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3053616 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@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>
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 bc82325e 2020-11-24T21:58:30 Fix RedGreenGradient to not output 0 for half the image The shader directly used v_position.xy as output color, but for half of the image x and y are negative and the respective channel became zero. This change makes the shader use v_position.xy*0.5+0.5. Additionally, the tests that use this shader are changed to mathematically derive the pixel colors instead of using magic numbers. Bug: angleproject:5395 Change-Id: Ic11c362c22ca725aa173faa5fd6033a02a4303fd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2559265 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov 35df41da 2020-11-23T21:34:13 Skip more tests on Linux AMD RX 5500 XT Remove EGLFeatureControlTest suppression, which crashed due to calling IsVulkan() without an initialized context. angle_perftests: MultisampledRenderToTextureBenchmark.Run/vulkan_multipass_ds angle_white_box_tests: VulkanPerformanceCounterTest.RenderToTextureDepthStencilRenderbufferShouldNotLoad Bug: chromium:1004356, angleproject:5380, chromium:1097750 Change-Id: I38819374242b71fb57c54a9d0fb47b1547dda895 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2556445 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Shahbaz Youssefi 46107d3e 2020-11-18T22:03:22 Vulkan: Delay defining D/S content to endRenderPass Take the following situation: 1. Start RP with D/S undefined: loadOp = DONT_CARE, storeOp = STORE * At this point, onDepthStencilWrite calls image->onWrite, setting depth/stencil contents defined. 2. At endRP, observe depth/stencil is not used: storeOp = DONT_CARE 3. Start another RP with D/S: loadOp = LOAD, storeOp = STORE Because the call to image->onWrite was done at startRP, the contents of the depth/stencil image is marked as defined, and the next render pass is loading these data. This change moves image->onWrite to endRenderPass, and only calls it if storeOp = STORE, taking advantage of all the opportunistic optimizations that try to set storeOp to another value. Bug: angleproject:4836 Change-Id: I9858e5caa6b1f67f841a5c6356e66927356ef469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2548319 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 89653b97 2020-11-11T09:23:18 Suppress VulkanPerformanceCounterTest::DepthStencilTextureClearAndLoad The test VulkanPerformanceCounterTest::DepthStencilTextureClearAndLoad() is flaky on the Windows AMD bots, so suppressing for now. Bug: angleproject:5329 Test: VulkanPerformanceCounterTest.DepthStencilTextureClearAndLoad Change-Id: I546cd18e319c0b73554fb3ce1e70c75be2168015 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532703 Commit-Queue: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 2d964a47 2020-10-30T16:46:30 Vulkan: Defer clears even if following command is scissored Take the following scenario: 1. glClear 2. glScissor(half of framebuffer) 3. glDrawArrays The clear in step 1 is deferred. When FramebufferVk::syncState is called in step 3, the deferred clear was applied using vkCmdClearColorImage because the draw call is scissored. This causes loadOp=LOAD to be used after the clear because the render pass is started too small (the same size as the scissor). This change makes scissored operations also take advantage of loadOp=LOAD with deferred clears. A number of changes are made to this effect: - FramebufferVk::syncState no longer limits collecting deferred clears to no-scissor. - FramebufferVk::startNewRenderPass automatically expands the render area to full size if it's clearing any attachment. - A number of bugs are fixed where FramebufferVk::flushDeferredClears is called with the scissor area. Instead, flushDeferredClears now unconditionally uses the complete render area. Note that these bugs didn't have symptoms as "scissor" and "deferred clears" were mutually exclusive. Bug: angleproject:4988 Change-Id: I24fc3d88bf9c8998869b36c863692d0f0acce994 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2511371 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a0e91016 2020-10-30T10:01:36 Vulkan: Don't break the render pass on scissor change Prior to this change, the render area was decided when the render pass was started, and remained fixed. If a small scissor was initially used, this created a render pass with a small area. If then the scissor region was expanded, the render pass was broken. This change instead expands the render area on scissor change to avoid breaking the render pass. If glInvalidateSubFramebuffer previously successfully resulted in storeOp=DONT_CARE, this optimization may need to undo that. As a result, the invalidate area is stored in the render pass and if the render area grows beyond that, invalidate is undone. Bug: angleproject:4988 Change-Id: I4e8039dec53a95a193a97cb40db3f71e397568d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2508983 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8f36b846 2020-10-29T15:13:55 Vulkan: Optimize glFramebufferSubInvalidate If glFramebufferSubInvalidate() is called with an area that covers the whole framebuffer, behave as if glFramebufferInvalidate() is called. This allows deferred clears to be removed for example, and attachment contents to be marked undefined. Bug: angleproject:4988 Change-Id: Iff3f291ea6c07abccc2740174d0451b432ac5da8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2508977 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 16102e8b 2020-10-17T01:15:05 Reland "Vulkan: Fold deferred clears into current clears" This reverts commit 37c400146e59f718b516eb58e16fa53c8a88bf21. Reason for revert: Need to clear the package cache when bisecting. Original change's description: > Revert "Vulkan: Fold deferred clears into current clears" > > This reverts commit e416c92a81c9ef01d633ec5c05e81c2551b6c5d6. > > Reason for revert: Reverted parent: > https://chromium-review.googlesource.com/c/angle/angle/+/2481612 > > Original change's description: > > Vulkan: Fold deferred clears into current clears > > > > If there are clears prior to a glClear() call, those clears were > > flushed (starting a new render pass) and then the clear call's clears > > would be applied (essentially modifying the loadOps of said render > > pass). > > > > The main downside of the above is that the current glClear() clears > > don't get a chance to be deferred. This was observed in Chrome which > > clears an attachment with an emulated format, then switches > > framebuffers. > > > > Additionally, if the render pass had already been started, the deferred > > clears could have become inlined instead of breaking the render pass. > > Although, it's unlikely for there to be deferred clears when the render > > pass is already open. > > > > This change first identifies which clears need to go through the draw > > path (scissored, masked or as workaround for driver bug). It merges the > > rest of the clears (that don't need the draw path) with the deferred > > clears. It then checks deferred clears and applies them by either: > > > > - vkCmdClearAttachments if mid RP > > - Start a new render pass and use loadOps, if any draw-based clear needs > > to follow. > > - Modify current RP loadOps / defer the clear > > > > Afterwards, the draw-based clears are applied. > > > > Bug: angleproject:4836 > > Change-Id: Id4992c78983b199734508c9d4bb18ed3195c91ec > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2455167 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Reviewed-by: Charlie Lao <cclao@google.com> > > TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: I85733b3594409df9b96e3d5b34933522c97c42cf > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:4836 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2481613 > 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 # Not skipping CQ checks because this is a reland. Bug: angleproject:4836 Change-Id: I702cd510f39ee46feab27d4efbf61ae5da10d4e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2481856 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 37c40014 2020-10-16T22:19:20 Revert "Vulkan: Fold deferred clears into current clears" This reverts commit e416c92a81c9ef01d633ec5c05e81c2551b6c5d6. Reason for revert: Reverted parent: https://chromium-review.googlesource.com/c/angle/angle/+/2481612 Original change's description: > Vulkan: Fold deferred clears into current clears > > If there are clears prior to a glClear() call, those clears were > flushed (starting a new render pass) and then the clear call's clears > would be applied (essentially modifying the loadOps of said render > pass). > > The main downside of the above is that the current glClear() clears > don't get a chance to be deferred. This was observed in Chrome which > clears an attachment with an emulated format, then switches > framebuffers. > > Additionally, if the render pass had already been started, the deferred > clears could have become inlined instead of breaking the render pass. > Although, it's unlikely for there to be deferred clears when the render > pass is already open. > > This change first identifies which clears need to go through the draw > path (scissored, masked or as workaround for driver bug). It merges the > rest of the clears (that don't need the draw path) with the deferred > clears. It then checks deferred clears and applies them by either: > > - vkCmdClearAttachments if mid RP > - Start a new render pass and use loadOps, if any draw-based clear needs > to follow. > - Modify current RP loadOps / defer the clear > > Afterwards, the draw-based clears are applied. > > Bug: angleproject:4836 > Change-Id: Id4992c78983b199734508c9d4bb18ed3195c91ec > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2455167 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> TBR=syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: I85733b3594409df9b96e3d5b34933522c97c42cf No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:4836 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2481613 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi e416c92a 2020-10-06T23:29:02 Vulkan: Fold deferred clears into current clears If there are clears prior to a glClear() call, those clears were flushed (starting a new render pass) and then the clear call's clears would be applied (essentially modifying the loadOps of said render pass). The main downside of the above is that the current glClear() clears don't get a chance to be deferred. This was observed in Chrome which clears an attachment with an emulated format, then switches framebuffers. Additionally, if the render pass had already been started, the deferred clears could have become inlined instead of breaking the render pass. Although, it's unlikely for there to be deferred clears when the render pass is already open. This change first identifies which clears need to go through the draw path (scissored, masked or as workaround for driver bug). It merges the rest of the clears (that don't need the draw path) with the deferred clears. It then checks deferred clears and applies them by either: - vkCmdClearAttachments if mid RP - Start a new render pass and use loadOps, if any draw-based clear needs to follow. - Modify current RP loadOps / defer the clear Afterwards, the draw-based clears are applied. Bug: angleproject:4836 Change-Id: Id4992c78983b199734508c9d4bb18ed3195c91ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2455167 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 2aaeb81d 2020-10-06T17:20:29 Vulkan: loadOp=DONT_CARE + unused D/S => invalidate D/S If depth/stencil is not loaded, and it's not written to during the render pass, then treat it as if it was invalidated so storeOp can be set to DONT_CARE and its corresponding resolve attachment (if any) removed. This is especially useful for MSRTT as a resolve attachment is added at the start of render pass, and this optimization will give it a chance to undo that if depth/stencil was not actually used in the render pass. This situation can arise for example if a render pass is created for the sole purpose of clearing color. This change includes a bug fix for missing depth/stencil on*Access in the UtilsVk blit/resolve path. Bug: angleproject:4836 Change-Id: Ifc8eea3e6ffb3eb4bba19f03d1358f151ec69c44 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2453468 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi df8f71d1 2020-10-09T15:27:28 Vulkan: Don't break the render pass on scissored clears clearImmediatelyWithRenderPassOp is removed and the draw path is used for the scissor. That path was added to avoid creating a large number of graphics pipelines due to the scissor state. This is now done by using dynamic state for scissor in the draw path for clear. Running the following dEQP tests without and with dynamic state for scissor: dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_ops.* the number of graphics pipelines is reduced from 95392 to 16. Bug: angleproject:4617 Bug: angleproject:4836 Change-Id: Ib373d8cd23ca2b67e6fd26aa2a1103f281f7e473 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2463985 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 68bd685a 2020-10-10T22:58:41 Reland: "4 Vulkan content defined CLs." Reland "Vulkan: Avoid content restore by detecting no-op stencil" This relands commit 243d0f899e443cd931c78aba7489382dff79edbb. Reland "Vulkan: Restore at the end of RP if write-after-invalidate" This relands commit e5d52ac3b9a00656acdd912ee8cd62dd14784075. Reland "Vulkan: Invalidate/restore depth/stencil separately." This relands commit 61fa0878964a796f6d3b3c13bc3a3849403ecdbd. Reland "Vulkan: Move content-defined tracking to ImageHelper" This relands commit 2392e6b34c0ddfbfd7b4c3cb67323ba463e11a57. Reason for revert: Caused crashes in Fuchsia x64 and on ARM. Reland fixes content defined for external images. Original CL message: Content-defined tracking was done in render targets prior to this change. This had multiple drawbacks: - When a framebuffer attachment is changed (including the first time it's set), it's unknown whether the contents of the attachment is defined. - Invalidate takes effect at the end of render pass, at which point the render target objects may be gone. Attachment ImageHelpers are however correctly tracked. This change moves content-defined tracking to the ImageHelper itself, and tracks it per subresource. ImageHelper::onWrite() now receives the subresource that is being written, and marks it as having defined content. A future optimization can make use of this change to ImageHelper::onWrite to track "dirty" subresources. This can lead to the removal of unnecessary barriers when same-kind writes are done on different subresources of the image. See http://anglebug.com/3347#c15 Bug: b/167275320 Bug: angleproject:4836 Bug: angleproject:5159 Change-Id: If5c1ae7152657fd7c94db7d55bea4fb9ddf835ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2464825 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill d6b1c17b 2020-10-10T14:29:15 Revert 4 Vulkan content defined CLs. Revert "Vulkan: Avoid content restore by detecting no-op stencil" This reverts commit 243d0f899e443cd931c78aba7489382dff79edbb. Revert "Vulkan: Restore at the end of RP if write-after-invalidate" This reverts commit e5d52ac3b9a00656acdd912ee8cd62dd14784075. Revert "Vulkan: Invalidate/restore depth/stencil separately." This reverts commit 61fa0878964a796f6d3b3c13bc3a3849403ecdbd. Revert "Vulkan: Move content-defined tracking to ImageHelper" This reverts commit 2392e6b34c0ddfbfd7b4c3cb67323ba463e11a57. Causes crashes in Fuchsia x64 and on ARM. Original CL message: Content-defined tracking was done in render targets prior to this change. This had multiple drawbacks: - When a framebuffer attachment is changed (including the first time it's set), it's unknown whether the contents of the attachment is defined. - Invalidate takes effect at the end of render pass, at which point the render target objects may be gone. Attachment ImageHelpers are however correctly tracked. This change moves content-defined tracking to the ImageHelper itself, and tracks it per subresource. ImageHelper::onWrite() now receives the subresource that is being written, and marks it as having defined content. A future optimization can make use of this change to ImageHelper::onWrite to track "dirty" subresources. This can lead to the removal of unnecessary barriers when same-kind writes are done on different subresources of the image. See http://anglebug.com/3347#c15 Bug: b/167275320 Bug: angleproject:4836 Bug: angleproject:5159 Change-Id: I93d9dfe973caa7ce70aefa46b5b7d04a8637efb3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2464822 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 243d0f89 2020-10-08T21:54:45 Vulkan: Avoid content restore by detecting no-op stencil Previously, as long as stencil was enabled, it was considered that it is also being modified. This caused stencil invalidate to be undone in a number of situations, such as: - glEnable(GL_STENCIL_TEST); // with func/ops default - glDrawArrays(); - glInvalidateFramebuffer([GL_STENCIL_ATTACHMENT]); - glClear(GL_DEPTH_BUFFER_BIT); - Close render pass In the above scenario, invalidation of stencil was undone at the end of render pass. In this change, the following cases are considered read-only stencil: - Func = GL_NEVER, stencilFail = GL_KEEP - Func = GL_ALWAYS, stencilPassDepth* = GL_KEEP - stencilFail = GL_KEEP, stencilPassDepth* = GL_KEEP Note that while the above scenario is fixed for no-op stencil, a similar issue persists if stencil was not no-op. The reason stencil invalidate is undone in that case is due to the fact that it's assumed any command after the invalidate call will be a draw call that outputs to stencil, but that is not the case with the glClear call in this example. Bug: angleproject:4836 Change-Id: Ie2ea2d52b7c8ee2394f5456773a7ef434e2b2b16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2461465 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 6c1c3bd9 2020-10-09T11:46:04 Vulkan: Clear depth by shader if depthClamp not supported This will avoid breaking the render pass when clearing depth through clearWithDraw if the depthClamp Vulkan feature is not present. Bug: angleproject:4836 Change-Id: I845fd5074dd95f6896da89f9e119ebc5000a5688 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462719 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi e5d52ac3 2020-10-08T14:26:22 Vulkan: Restore at the end of RP if write-after-invalidate If a depth/stencil attachment is invalidated, but subsequently drawn to in the same render pass, undo the invalidate when the render pass is closed. Adapted from https://chromium-review.googlesource.com/c/angle/angle/+/2386478. Bug: b/167275320 Bug: angleproject:4836 Change-Id: I17a35bfd692ddc403ceaa6ec44b5c4f16ff9eed6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2461464 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi f8070feb 2020-10-09T11:03:29 Vulkan: Use depthClamp to clear depth where available This will avoid breaking render pass if clearing depth in clearWithDraw. Bug: angleproject:4836 Change-Id: I50242d1115efc91059923143f6ae5fd25fb3d36f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462717 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 61fa0878 2020-10-08T11:35:48 Vulkan: Invalidate/restore depth/stencil separately. Depth/stencil content defined is already tracked separately in the ImageHelper. This change exposes this tracking from RenderTargetVk. Bug: b/167275320 Bug: angleproject:4836 Change-Id: Ie6520e7a4ab557eb233c60c6ab0d4a8f8f098bf6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462039 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Shahbaz Youssefi 5081f89b 2020-10-02T01:15:37 Vulkan: Support invalidate of MSRTT attachments Invalidate was previously affecting only the storeOp of the color and depth/stencil attachments. With multisampled-render-to-texture attachments, the storeOp of the resolve attachments were not being affected. This change implements the latter, attempting to remove the attachment altogether if possible. With MSRTT depth/stencil buffers, this makes possible the ability to never write depth/stencil data to memory. Bug: angleproject:4836 Change-Id: I53599e2f4ed6c390dfd03bf226274f6f53f438bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437506 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 887b1346 2020-10-02T01:12:01 Vulkan: Add resolve/unresolve counters With this change, render-pass-related counters are calculated at render pass creation time and stored alongside the render pass handle (and serial) in the render pass cache. On every use, the render pass' counters are accumulated over the global counters. Additionally, this change adds MSRTT resolve and unresolve counters to render pass counters. Bug: angleproject:4836 Change-Id: If15a789e5a7d66c7ea5a2315bc76fe045ce57491 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444099 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>