src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp


Log

Author Commit Date CI Message
Mohan Maiya 60f694c6 2025-09-10T11:55:58 Vulkan: Bugfixes in preferGlobalPipelineCache 1. per-program pipeline cache was being unconditionally initialized during warmup 2. mergeProgramPipelineCachesToGlobalCache should be disabled when preferGlobalPipelineCache feature is enabled Also, prefer use of global pipeline cache for Samsung. Bug: angleproject:386749841 Change-Id: Ifd66ef8c6d10b8a5ffd3c002239e8747f469ba47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6936119 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Xiang Wang e77725a4 2025-09-02T12:14:55 Add VkFormat id to descriptor cache key's imageSubresourceRange This is to fix the bug when two shaders are modifying the same texture buffer but with different formats, the old buffer view with "incompatible" format can be reused. Bug: b/443105853 Change-Id: Ic3b2202a7d1d408fbbf826414bfcf2b1df4c3a15 Test: GLSLTest.TextureBufferWritesUsingDifferentFormats Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6916350 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 166c9e23 2025-09-05T12:52:38 Vulkan: Separate barrier data into its file vk::Renderer includes a modified copy of kImageMemoryBarrierData. When using VK_KHR_unified_image_layouts, even more of this data is modified based on device features. Leaving kImageMemoryBarrierData in vk_helpers.cpp runs the risk that it's accessed directly instead of using the copy in vk::Renderer. Bug: angleproject:422982681 Change-Id: I7e288ef0ac519c53842214fe934ba7b2474e1f9c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6927350 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi ebf29178 2025-09-05T12:15:23 Vulkan: Rename ImageLayout to ImageAccess This enum really describes how the image is accessed, including what VkImageLayout it should be in for that access. With VK_KHR_unified_image_layouts, it makes little sense to call this enum ImageLayout anymore, given how almost all of them will have VK_IMAGE_LAYOUT_GENERAL. Bug: angleproject:422982681 Change-Id: Id0ea107d339457e90b7a167292b75211eb42f803 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6918518 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Tom Sepez 25390156 2025-08-21T00:13:19 Suppress unsafe buffers on a file-by-file basis in src/ [1 of N] In this CL, we suppress many files but stop short of actually enabling the warning by not removing the line from the unsafe_buffers_paths.txt file. That will happen in a follow-on CL, along with resolving any stragglers missed here. This is mostly a manual change so as to familiarize myself with the kinds of issues faced by the Angle codebase when applying buffer safety warnings. -- Re-generate affected hashes. -- Clang-format applied to all changed files. -- Add a few missing .reserve() calls to vectors as noticed. -- Fix some mismatches between file names and header comments. -- Be more consistent with header comment format (blank lines and trailing //-only lines when a filename comment adjoins license boilerplate). Bug: b/436880895 Change-Id: I3bde5cc2059acbe8345057289214f1a26f1c34aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6869022 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 677d8281 2025-08-25T15:59:46 Vulkan: Pass ContextVk to view-creation functions In preparation for moving the ycbcr conversion cache to the share group. This change is a no-op. Bug: angleproject:440364873 Change-Id: I0c18062259b07813dd04ec02650bb6fab48947ad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6879204 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya 890b5d8f 2025-07-07T13:06:54 Vulkan: Encapsulate more descriptor set logic in ProgramExecutableVk - ProgramExecutableVk handles SharedDescriptorSetCacheKey updates - Inline most update*DescInfo methods - Add dedicated methods to handle uniform and storage buffers to remove some branches from frequently used code paths Bug: angleproject:426412564 Tests: UniformBufferTest31.UniformBufferBindingRangeChangeWith*FBF Change-Id: I54b8ae2bd8778231e4d187b2cfd30f4d71de7f3b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6733546 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya 30a1cbc9 2025-07-03T13:00:05 Vulkan: Separate out descriptor set for uniform buffers Bug: angleproject:426412564 Change-Id: Icdbb1e634fc543714d1e3b9cdba0530d400cb153 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6705153 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya d44244ca 2025-07-03T11:36:37 Vulkan: Simplify default uniform WriteDescriptorDescs ProgramExecutableVk fully encapsulates interaction with DescriptorSetDescBuilder with https:://crrev.com/c/6702410 which allows us to keep WriteDescriptorDescs members private. Remove mDefaultUniformWriteDescriptorDescs and reuse mDefaultUniformAndXfbWriteDescriptorDescs for both emulated and extension based XFB codepaths Bug: angleproject:426412564 Change-Id: Icf76440b6efbda93eb8d48c36591a99ccd1a5750 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6705152 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya ce289330 2025-07-01T19:41:46 Vulkan: Simplify descriptor set management - Descriptor logic is contained in ProgramExecutableVk and doesn't leak into ContextVk - Reduces CPU overhead by not having to constantly copy and resize the DescriptorSetDescBuilder - Simplifies decoupling of descriptor set of uniform buffers from that of other shader resources Bug: angleproject:426412564 Change-Id: Ic0926d0d466ea21f611c2b2c7b844e0bb9027c1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6702410 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 2fd033d0 2025-05-22T04:21:11 Vulkan: Optimize updates to uniform buffers ... when only the offset is modified. Most of the work done when handling dirty uniforms can be skipped since the buffer bindings haven't changed Bug: angleproject:386749841 Tests: UniformBufferTest31.UniformBufferBindingRangeChange*Vulkan Change-Id: Ic811bd71f0f2993f88ce9bcf93f9e8e46dfc6d99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6581359 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya 58f21f8f 2025-05-29T07:53:02 Vulkan: Optimize ProgramExecutableVk::bindDescriptor(...) Cache valid descriptor set indices in a bitset, this helps eliminate branches within loops and makes for more readable code Bug: angleproject:386749841 Change-Id: I06fbf529ceb6c8ece9313b3b5e9edd6c6b63542b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6601733 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Yuxin Hu 6542fea9 2025-05-07T17:28:45 Vulkan: Fix SpirV Error in Tessellation Control Shader When feature varyingsRequireMatchingPrecisionInSpirv is enabled, in the generated SpirV, if the shader output varying precision needs to be adjusted, we create a new shader varying to replace the original shader output varying, and save the original shader output varying to the replacement shader output varying at the end of the function. However, this does not work for tessellation control shader, because the SpirV generated will perform following equivalent peudo code: layout (vertices=3) out; in mediump float tc_in[]; out mediump float tc_out[]; highp float original_out[]; void main() { original_out[gl_InvocationID] = tc_in[gl_InvocationID]; // some other code in between tc_out = original_out; } The last line will attempt to write to all indice of tc_out. However, according to the spec, "each tessellation control shader invocation may write only to those outputs corresponding to its output patch vertex. Tessellation control shader must use the special variable gl_InvocationID as the vertex number index when writing to per-vertex output variables." This change fixes the problem by keeping the precision of tessellation control shader output as it is, and adjust the precision of tessellation evaluation shader input instead. Bug: b/42266751 Change-Id: I398545e2cbbf703c716d6738f1ba278baac4171f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6521225 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Amirali Abdolrashidi 6ba47bed 2025-05-13T12:44:06 Vulkan: Use GS input prim type for warmup pipeline For graphics pipeline creation, the primitive topology should be set in the input assembly state create info (unless for dynamic state). This can come from the primitive mode in ProgramExecutableVk (prepareForWarmUpPipelineCache()). Currently, the patch mode is used if there is a tessellation shader, and triangle strip otherwise. However, if there is a geometry shader without tessellation, this can lead to a VVL error on certain platforms if the primitive mode for the pipeline does not match the input primitive type for the geometry shader. * Updated the primitive mode in the above function for the case of geometry shader without tessellation shaders, to be set to the input primitive type of the GS. * This will be used later for graphics pipeline initialization for the input assembly state info (in case of vertex input). * (GraphicsPipelineDesc::initializePipeline()) * Removed the following VVL suppression: VUID-VkGraphicsPipelineCreateInfo-pStages-00738 Bug: angleproject:303219657 Change-Id: I8d804fd87438033071261a5002a4155e6d62d27c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6541872 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi a3b20796 2025-04-25T13:12:08 Vulkan: Add flag to prefer renderer pipeline cache * Added the following feature: preferGlobalPipelineCache * The renderer's pipeline cache will be used to create pipelines, including for warm-up. * mPipelineCache in the program is not saved when this flag is enabled. * Currently enabled for NVIDIA and AMD. * Impact on captured trace (w/ compiling inactive shaders) * Decrease in peak system memory usage on Windows/NVIDIA: * ~7600 MB -> ~3900 MB * Decrease in peak RES memory usage on Linux/NVIDIA: * ~7100 MB -> ~3600 MB Bug: b/411442610 Change-Id: I04929569f0f8d59a77c52505072faa0244ef1393 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6495155 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Shahbaz Youssefi f355e2b3 2025-04-15T18:58:25 Vulkan: Remove preferDriverUniformOverSpecConst This was practically true for every vendor on Android (where rotation matters). For Qualcomm, it was also true due to a bug in version checking and didn't seem to be causing any concerns. Where pre-rotation is supported, it is better to enable this feature to avoid excessive pipeline creation. This change removes the feature and makes sure ANGLE always uses uniforms for rotation instead of spec consts. While technically this may have an adverse effect on platforms that never need pre-rotation, the ability is retained for all vendors since pre-rotation is finding its way into more platforms and would likely eventually be needed everywhere anyway. Bug: angleproject:42265878 Bug: angleproject:42262166 Change-Id: I4b64c04da46db08cfdd44b60789b66d93d8e8b17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6459025 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Igor Nazarov f798b0d2 2025-04-04T08:17:57 Vulkan: Remove enablePreRotateSurfaces feature Removed to simplify the code and to avoid the problem for which `presentSubOptimalReturnedOnTransformChange` feature was added. Platforms without the per-rotation support always have `VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR` as the `currentTransform`, so the code will perform the same as when the feature was disabled. Add `warmUpPreRotatePipelineVariations` to explicitly control per-rotation pipeline warm up. Bug: angleproject:42262166 Change-Id: I44f6c221c11105f01f62f62622987b1955bc58aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6433586 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Shahbaz Youssefi dae3c851 2025-03-14T11:44:53 Vulkan: Bake non-shader state into linked pipeline When using VK_EXT_graphics_pipeline_library, previously ANGLE would create three pipelines libraries: * The Shaders library was created based on the GL program's shaders + a few static states. This typically hit the program's own pipeline's cache that was warmed up during link. * The VertexInput and FragmentOutput libraries were created at draw time, which used the global pipeline cache At draw time, immediately after creating the non-Shaders libraries, the three libraries were linked into the final pipeline to be used by the draw call. This caused an inefficiency; because the non-Shaders libraries were created independently from the Shaders library, they had to be compiled pessimistically, for example because they could not be optimized to take into account the precision of the fragment shader's outputs or whether any value is const (typically alpha being set to one). Given the creation of VertexInput and FragmentOutput libraries is typically quite fast (the former being no-op and dynamic state anyway), this change removes the need for creating those libraries, and directly specifies the vertex input and fragment output state when creating the final pipeline out of the Shaders library. In this way, the same fragment output state can be tailored to the exact shaders it is being used with and incur a smaller overhead. In this change, the linked pipeline is cached in the GL program's pipeline cache, which is never synced to the blob cache as producing it is assumed to be fast already. Bug: angleproject:42265839 Change-Id: I8496ea37771555522bdc9de94043a1b56fa5967e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6354205 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1a0c9db3 2025-02-27T10:43:00 Vulkan: Disable monolithic pipeline creation with GPL As it violates OpenGL ES rules. This change also removes Vulkan perf counter tests that attempt to verify that warmed up programs hit the cache... this fails in non-trivial ways especially with graphics pipeline library due to: - Warm up tasks being async, they may finish after the test reads the perf counters to set expectations - Some drivers report a cache miss when fast-linking libraries... but likely they don't even look at the cache (so both hit and miss would have been inaccurate) - There is no 100% guarantee that the warmup really leads to a draw-time cache hit. Things are made worse by https://chromium-review.googlesource.com/c/angle/angle/+/5421594 because we don't necessarily even wait for the warm up tasks if ANGLE's view of the pipeline description doesn't match what was used for warm up (even if internally to the driver some of the state does not affect the binary blobs). Bug: angleproject:42265839 Change-Id: Iaf96e4f64e2187abc666ff07fe1304d7474a0e86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6309696 Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Hailin Zhang bd8bc105 2025-02-19T18:08:32 vulkan: disable pipeline cache data serialization for nvidia device. we still see the big cache data issue after driver version 520. rename hasEffectivePipelineCacheSerialization to skipPipelineCacheSerialization. Bug: b/358380399 Change-Id: Idd8354f95c3eb4c2e58678a4cf50c8b6af20f371 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6284126 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Hailin Zhang <hailinzhang@google.com>
Charlie Lao 65343c4c 2025-02-27T11:23:04 Vulkan: Improve ConvertImageLayoutToVkImageLayout() This CL removes supportsMixedReadWriteDepthStencilLayouts feature flag. This feature flag was introduced when ANGLE only requires vulkan 1.0. But now we require vulkan 1.1 and this is part of vulkan 1.1 core spec. So it is no longer needed and wasting CPU cycles to check this every time ConvertImageLayoutToVkImageLayout() is called. With supportsMixedReadWriteDepthStencilLayouts removed, convert from ImageLayout to VkImageLayout no longer needs renderer parameter. The layout information in kImageMemoryBarrierData is never modified by renderer at run time. So the renerer arguments has been removed in a lot of places, avoids another pointer de-reference. Bug: b/384839847 Change-Id: I5a89a890c0c0a1f99d2fdc1b2a85baf7de5c28bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6310839 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 055123f8 2025-02-27T10:45:56 Vulkan: Don't maintain SharedCacheKeyManager for BufferBlock Dynamic descriptor type uses the underlying BufferBlock in the descriptorSet. There could be many BufferHelper objects sub-allocated from the same BufferBlock. And each BufferHelper could combine with other buffers to form a descriptorSet. This means the combination for BufferBlock could potentially be very large, in thousands with some app traces like seeing in honkai_star_rail. The overhead of maintaining mDescriptorSetCacheManager for BufferBlock could be too big. In this CL I have chosen to not maintain mDescriptorSetCacheManager in the BufferBlock. The only downside is that when BufferBlock gets destroyed, we will not able to immediately destroy all cached descriptorSets that it is part of. They will still gets evicted later on if needed (see evictStaleDescriptorSets for detail). After this CL, running with all app traces we have, the max vector size of SharedCacheKeyManager::mEmptySlotBits is no more than 2, versus ~70s before the CL. Bug: b/384839847 Bug: b/293297177 Bug: b/237686097 Change-Id: I7c7c91cd0aeacba4145575ac4270b713bf38b742 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6310837 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 2ba1f129 2025-02-11T15:27:16 Vulkan: Avoid storage reallocation in UpdateDescriptorSetsBuilder UpdateDescriptorSetsBuilder::mDescriptorBufferInfos and mDescriptorImageInfos will keep grow to a few hundreds of entries and that grow will end up with data copy and patching mWriteDescriptorSets. There is no requirement that entire vector of mDescriptorBufferInfos andmDescriptorImageInfos must be continuous. The only requirement is that when allocDescriptorBufferInfos(count) is called, the count of entries must be continuous. This CL uses a queue of vectors so that when we need to allocate new storage we just add another vector and allocate out of the new vector. This avoids all related data copy. Similar thing applies to mWriteDescriptorSets. The only thing I added for mWriteDescriptorSets is that I try to grow the first vector big enough to hold all of the entries for next submission to minimize the vkUpdateDescriptorSets call. Bug: b/293297177 Change-Id: Ief417ace8c8f7b477a1962505e9487bf31bae2ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6253675 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya eaf06ea7 2025-02-06T13:58:07 Vulkan: Bugfix in resolvePrecisionMismatch(...) Early-return if a varying is not active in either the front or back shader Bug: angleproject:386749841 Test: GLSLTest.MismatchedInactiveVarying* Change-Id: Ie0c6dfd6616afcb94bec043d36d4f8188df8abb3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6239031 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Austin Annestrand 95635ef0 2025-01-23T16:30:41 CL/VK: Implementation of Compute Pipeline Cache. Implemented ComputePipelineCache, hash map from OpenCL and OpenGL compute state vectors to compiled pipelines. Implemented ComputePipelineDesc, a tightly packed description of the current compute state. Compute Pipeline State includes the specialization constants, Pipeline Options (Protected, Robust). Updated-by: Austin Annestrand <a.annestrand@samsung.com> Bug: angleproject:391672281 Change-Id: I88944dc169d194d1b2c75747769d7346b041fa75 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6191437 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com>
Charlie Lao fbd230f5 2025-01-23T12:59:06 Vulkan: Split ErrorContext into ErrorContext and Context ErrorContext continue to be context for error handling. vk::Context is added to serve as common base class for ContextVk and CLContextVk. Bug: angleproject:390443243 Change-Id: Ifac0b1d2d714ce610693ce60a35459c6c9cddf1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6191438 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c1214ec2 2025-01-22T14:22:56 Vulkan: Rename Context to ErrorContext In preparation for adding another Context (derived by GL and CL contexts), which includes logic that pertains to command recording (such as barrier tracking). Bug: angleproject:390443243 Change-Id: Idf495b62e63fb9aa901a2f16447fdaf3c2acd90b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6191248 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao a5016e31 2025-01-17T17:50:27 Vulkan: Fix typos found by gerrit spellchecker Bug: angleproject:360274928 Change-Id: Idbffd7a4609f28d161bd0a11ace817856dcd750c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6182930 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi fc4fc174 2024-12-10T22:01:28 Vulkan: Prevent crash with D/S FF without D/S attachment The spec says that the values for gl_LastFragDepth/StencilARM are undefined if there is no depth/stencil attachment. This "just" works on tiling GPUs, because reading input attachments simply translates to reading _something_ from the tile memory. For ANGLE, the situation is a little more complicated. ANGLE has to bind descriptors for input attachments (because non-tilers read from the input attachment descriptor instead of using the knowledge that input and color/depth/stencil attachments are one and the same thing in tile memory). When a depth/stencil attachment is missing, there is no image to bind to the descriptor set. ANGLE cannot skip binding an image to the descriptor set, because OpImageRead (translated from subpassLoad()) attempts to access the input descriptor; skipping this causes an internal crash in SwiftShader for example. ANGLE cannot bind a bogus image as input attachment, as Vulkan requires that input attachments are also color/depth/stencil attachments. ANGLE _could_ bind a bogus image as input attachment and also as depth/stencil attachment. This is rather risky, as it then also has to be careful to make sure that depth/stencil attachment is never actually used (i.e. it affects the depth/stencil state, load/store ops etc). In this change, the shader itself is modified to remove references to the depth/stencil input attachments if the attachment is missing. This is rather inefficient, as it means the pipeline warmup will not produce a usable pipeline, but it's accepted as a workaround for something apps shouldn't really be doing. Bug: angleproject:376572258 Change-Id: I0de68252b61615cb82cba7d1730699aadf41e92f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6085368 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 7adbb3e8 2024-11-26T17:06:07 Vulkan: Remove explicit destroy calls Since now SharedPtr will automatically call destroy(device) when last reference goes away, there is no need for explicitly calling destroy(device) any more. Bug: angleproject:372268711 Change-Id: I208b17cf7e090babd51d6f337c20fdfd74c75b6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6052886 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Robic Sun f51170b3 2024-11-21T16:30:40 Enable GL_KHR_texture_compression_astc_hdr Vulkan supports GL_KHR_texture_compression_astc_hdr, so this extension can be enabled in Angle. Bug: angleproject:379186304 Change-Id: I438a120c3f884a7eefcd883ad71abf68f81cb473 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6038457 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 6c1021ec 2024-11-22T16:48:45 Vulkan: Switch DescriptorSetLayout to use AtomicSharedPtr SharedPtr has better semantics and safer to use. This CL removes direct exposure of RefCounted object and also allows me to delete BindingPointer class in later CL. Bug: angleproject:372268711 Change-Id: I08a0dff3efcf794be843a4a548b9f2609bb9a5e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6044328 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 2dc072ec 2024-11-22T16:14:52 Vulkan: Switch PipelineLayout from AtomicBind* to AtomicSharedPtr AtomicSharedPtr/SharedPtr has better semantics and safer to use. This will allow deleting BindingPointer in later CL. Bug: angleproject:372268711 Change-Id: Ife20f68b2277a1913b06be0de153770214ac964a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6044326 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 87d61997 2024-11-21T14:20:55 Vulkan: Switch ShaderModule to use SharedPtr This CL gets rid of many vk::RefCounted<vk::ShaderModule> usage which is risky due to it allows you to direct manipulate reference count. Switch to vk::SharedPtr manages the reference counting automatically. Bug: angleproject:372268711 Change-Id: I14f5c509bcbd9ea7d17101637e033652a68710a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6039117 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 21d747de 2024-11-20T11:54:15 Vulkan: Use vk::SharedPtr for SharedDescriptorSetCacheKey This CL switches SharedDescriptorSetCacheKey from using c++ std::shared_ptr to our internal version of vk::SharedPtr. Also get rid of an extra pointer indirection that SharedDescriptorSetCacheKey is a reference counted of actual cache key instead of std::unique_ptr of cache key. Bug: angleproject:372268711 Change-Id: Id9af5070d24f67711d6decc3a30a260b8d4062d9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6036302 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao ce53aff0 2024-11-05T16:57:57 Vulkan: Add per descriptorSet LRU cache eviction Before this CL, the descriptor set cache eviction is at the pool level. Either the entire pool is deleted or not. It is also not LRU based. This CL adds a per descriptor set cache eviction and reuse evicted descriptorSet before allocating a new pool. This eviction is LRU based so that it is more precise. The mCurrentFrameCount is passed into various API so that it can make eviction decision based on the frame number. In this CL, anything not been used in last 10 frames will be evicted and recycled before allocate a new pool. Since eviction is based on individual descriptor set, not by pool, ProgramExecutableVk no longer needs to track the DescriptorSetPool object. mDescriptorPools has been removed from ProgramExecutableVk class. As measured by crrev.com/c/5425496/133 This LRU linked list maintenance does not add any measurable time difference, but reduces total descriptorSet pool count by one third (from 75 down to 48). running test name: "TracePerf", backend: "_vulkan", story: "batman_telltale" Before this CL: cacheMissCount: 200, averageTime:23998 ns cacheHitCount: 1075445, averageTime:626 ns descriptorSetEvicted: 0, descriptorSetPoolCount:75 Average frame time 3.9262 ms After this CL: cacheMissCount: 200, averageTime:23207 ns cacheHitCount: 1025415, averageTime:602 ns descriptorSetEvicted: 102708, descriptorSetPoolCount:48 Average frame time 3.9074 ms BYPASS_LARGE_CHANGE_WARNING Bug: angleproject:372268711 Change-Id: I84daaf46f4557cbbfdb94c10c5386001105f5046 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5985112 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 2b8d6bbe 2024-11-01T11:23:35 Vulkan: Use UpdateFullTexturesDescriptorSet when cache missed DescriptorSetDescBuilder::updateDescriptorSet() relies on the cache key to build descriptorSet. UpdateFullTexturesDescriptorSet() builds descriptorSet directly from state, it does not use cache key. Test shows UpdateFullTexturesDescriptorSet is much faster than updateActiveTexturesForCacheMiss and updateDescriptorSet pair. This CL removes updateActiveTexturesForCacheMiss() function and uses UpdateFullTexturesDescriptorSet for cache miss case. The timing code is added around the cache miss functions to measure the time. Old: asphalt_9 average 7,554 nanosec gl_driver2_off: 20,354 nanosec batman_telltale: 12,992 nanosec New: asphalt_9 average 916 nanosec gl_driver2_off: 1,839 nanosec batman_telltale: 3,437 nanosec Bug: angleproject:372268711 Change-Id: I176d67ed732c3fe3a18a079df7c4973aa926087a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5984893 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao fbe34df7 2024-10-29T16:19:29 Vulkan: More texture descriptorSet code cleanup Removed unused argument `pipelineType` from updateActiveTexturesForCacheMiss(). Removed unused argument `context` from getReadImageView() Rename getBufferViewAndRecordUse() to getBufferView() since there is no "record use" happening. Moved UpdateFullActiveTexturesDescriptorSet() function from vk_cache_utils.cpp to ProgramExecutableVk.cpp anonymous name space, since it is only used in this file. Bug: angleproject:372268711 Change-Id: Ib7240c1063f727fb52588234e79fba349f9aff9e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5977481 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 5c26ffea 2024-10-29T11:11:38 Vulkan: Optmize descriptorSet cache disable code path Right now the way it works is that it first computes the cache key and then use the cache key to look in the cache. If cache misses, then it builds descriptorSet out of the cache Key. This might make sense if cache is enabled. If cache is disabled then no need to go through the middle man. This CL skip all the cache key build up entirely and directly build descriptorSet out of context state. In this CL, updateFullActiveTextures() and updateDescriptorSet() are merged into one function UpdateFullActiveTexturesDescriptorSet() which updates VkWriteDescriptorSet directly. Bug: angleproject:372268711 Change-Id: I7ba0c60a23b967d1ac903020d04022405c29e354 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5972508 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 2df8d32b 2024-10-25T13:49:40 Vulkan: Tag DescriptorSets properly with every command buffer When descriptorSetCache is disabled, there is a bug that the current descriptorSet is not properly tagged with current ResourceUse. Right now when we get a descriptorSet (from cache or reused or allocated new), we retain to the current command buffer. But if we submit command buffer and get a new command buffer, and draw with the same program/buffer/textures, we will be reusing the current bound descriptorSets, but it is not retained with new command buffer. In theory, we have the same bug for pool eviction as well when cache is enabled. It's just very hard to hit due to pool eviction occur very rare. But with cache disabled, this is very easy to hit with multiple tests. In this CL, the retainResource call is moved from ProgramExecutableVk::getOrAllocateDescriptorSet() call to ProgramExecutableVk::bindDescriptorSets() call. Since bindDescriptorSets is always get called when we get a new descriptorSet, and is always get called when a new command buffer is allocated, this covers all usage case. And even better, with this change we are able to remove commandBufferHelper from arguments of quite a few functions. Bug: angleproject:372268711 Change-Id: I1f21a3e7e9ea34e2842e54025b5eb930dbf6c593 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4743599 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao d0a0fd1a 2024-10-17T14:50:51 Vulkan: Skip pool eviction when cache is disabled When cache is disabled, every time a new descriptorSet is allocated and bind to program, the previous descriptorSet will be added to the tail of garbage list, and the new descriptorSet is retrieved from the head of the garbage list, if its GPU usage has been completed. This means there will never have a situation that significant amount of descriptorSets are needed, therefore no need for pool eviction. One possible situation is that at one point you need a lot of descriptorSets and then after a while you only need small amount of descriptorSets. In that case we could delete the excessive unused descriptorSets. But since they are all allocated from a pool, as long as there is still one descriptorSet in the pool is used, you still can't destroy the pool. This means eviction is really not much useful when cache is disabled. Bug: angleproject:372268711 Change-Id: Id77b181b64e122f576ee43d11c39dc75bd681dcf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5941126 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 08c1724f 2024-10-11T14:29:00 Vulkan: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I63fd78314fa7ebccbf366c252e309a9c0f09c8c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938150 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 65fcf9c4 2024-10-26T10:53:18 Vulkan: Remove redundant dependent feature checks Since [1], when a feature is overriden, the dependent features automatically take the override into account. Tests no longer need to account for dependent features, neither does the logic in the code. [1]:https://chromium-review.googlesource.com/c/angle/angle/+/4749524 Bug: angleproject:42266725 Change-Id: I5440aba4a89cffbe710e26ad7de4cfee783e9bdf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5967414 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 9a4c7495 2024-10-15T13:05:28 Vulkan: Add feature flag to enable descriptorSet cache So that we can disable it to compare the performance difference. Bug: angleproject:372268711 Change-Id: I02da254e5d58815741080634a2dd005617aa7432 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5936135 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 31c80bbf 2024-10-17T10:56:16 Vulkan: Avoid redundant work in updateFullActiveTextures ContextVk keeps mActiveTexturesDesc, which gets updated by UpdatePreCacheActiveTextures(). This is only used for cache lookup. When there is a cache miss, we end up call updateFullActiveTextures() which recomputes DescriptorSetDesc again, which is redundant work. This CL removes mActiveTexturesDesc from ContextVk. UpdatePreCacheActiveTextures has been changed to be a DescriptorSetDescBuilder method so that it can directly update the mDesc. updateFullActiveTextures has been renamed to updateActiveTexturesForCacheMiss which avoid mDesc calculation. updateFullActiveTextures is still kept for now which will be used in next CL when cache is disabled. Bug: b/372268711 Change-Id: Ic9a0cdaa7cefca5f72b599d26d079cef14888f07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905766 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao dd54eeec 2024-10-11T13:26:46 Reland "Vulkan: Track GPU progress for individual DescriptorSet" This is a reland of commit 292102944add2ab30f4aa12a971cac456cc7726b with the fix of garbage being added back to garbage list. Original change's description: > Vulkan: Track GPU progress for individual DescriptorSet > > Right now ProgramExecutableVk keeps VkDescriptorSet object, and > DescriptorSetHelper is created when a cache entry becomes invalid. > Further, DescriptorSetCache keeps the cache of {VkDescriptorSet, > RefCountedDescriptorPoolHelper} pair. So we are having three different > type of objects at different stages of life: VkDescriptorSet, > DescriptorSetHelper, and {VkDescriptorSet, > RefCountedDescriptorPoolHelper. This CL makes DescriptorSetHelper at > creation and at cache and at garbage. With this change, you have a > reference counted DescriptorSetHelper object (i.e, DescriptorSetPointer) > during entire life cycle and is passed around between cache and program > as is. This CL is preparation for the future CL where we may disable > cache for descriptorSet. The descriptorSet will be added to garbage list > and reused constantly without go through the cache code. We need to > track the individual descriptorSet with ResourceUse so that it won't > reuse until GPU is finished. This CL is making DescriptorSetHelper a GPU > tracking object so that it will still just work when cache is disabled. > > Bug: angleproject:372268711 > Change-Id: I1cfb77cc5069b202d870388fd8809e265cdca90b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5918586 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:372268711 Change-Id: Ic920f99cc78cde1e94690bdbee3b885844fa155b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5954701 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 45cc47af 2024-10-22T21:41:22 Revert "Vulkan: Track GPU progress for individual DescriptorSet" This reverts commit 292102944add2ab30f4aa12a971cac456cc7726b. Reason for revert: Causing bot failure in later CLs Original change's description: > Vulkan: Track GPU progress for individual DescriptorSet > > Right now ProgramExecutableVk keeps VkDescriptorSet object, and > DescriptorSetHelper is created when a cache entry becomes invalid. > Further, DescriptorSetCache keeps the cache of {VkDescriptorSet, > RefCountedDescriptorPoolHelper} pair. So we are having three different > type of objects at different stages of life: VkDescriptorSet, > DescriptorSetHelper, and {VkDescriptorSet, > RefCountedDescriptorPoolHelper. This CL makes DescriptorSetHelper at > creation and at cache and at garbage. With this change, you have a > reference counted DescriptorSetHelper object (i.e, DescriptorSetPointer) > during entire life cycle and is passed around between cache and program > as is. This CL is preparation for the future CL where we may disable > cache for descriptorSet. The descriptorSet will be added to garbage list > and reused constantly without go through the cache code. We need to > track the individual descriptorSet with ResourceUse so that it won't > reuse until GPU is finished. This CL is making DescriptorSetHelper a GPU > tracking object so that it will still just work when cache is disabled. > > Bug: angleproject:372268711 > Change-Id: I1cfb77cc5069b202d870388fd8809e265cdca90b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5918586 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Yuxin Hu <yuxinhu@google.com> Bug: angleproject:372268711 Change-Id: I4d3c34058d100112a098144276b52c0faf8d593a No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5955529 Auto-Submit: Charlie Lao <cclao@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Charlie Lao 29210294 2024-10-11T13:26:46 Vulkan: Track GPU progress for individual DescriptorSet Right now ProgramExecutableVk keeps VkDescriptorSet object, and DescriptorSetHelper is created when a cache entry becomes invalid. Further, DescriptorSetCache keeps the cache of {VkDescriptorSet, RefCountedDescriptorPoolHelper} pair. So we are having three different type of objects at different stages of life: VkDescriptorSet, DescriptorSetHelper, and {VkDescriptorSet, RefCountedDescriptorPoolHelper. This CL makes DescriptorSetHelper at creation and at cache and at garbage. With this change, you have a reference counted DescriptorSetHelper object (i.e, DescriptorSetPointer) during entire life cycle and is passed around between cache and program as is. This CL is preparation for the future CL where we may disable cache for descriptorSet. The descriptorSet will be added to garbage list and reused constantly without go through the cache code. We need to track the individual descriptorSet with ResourceUse so that it won't reuse until GPU is finished. This CL is making DescriptorSetHelper a GPU tracking object so that it will still just work when cache is disabled. Bug: angleproject:372268711 Change-Id: I1cfb77cc5069b202d870388fd8809e265cdca90b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5918586 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 4bdcdf0d 2024-10-16T11:44:49 Vulkan: Switch RefCountedDescriptorPoolBinding to use SharedPtr This mostly a clean up. RefCountedDescriptorPoolBinding is replaced with DescriptorPoolPointer, which is defined as SharedPtr<DescriptorPoolHelper>. It has more intuitive semantics to use. Bug: angleproject:372268711 Change-Id: I0397111b5228e896c1d226e00930851319d955a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938947 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao c52e8493 2024-10-11T14:21:19 Vulkan: Switch DescriptorPoolPointer to use SharedPtr To make the reference counting easier to maintain, SharedPtr class is added to automatically tracking the reference counting and object creation/destruction. Right now we have BindingPointer class doing similar things except it does not automatically manage the object create/destroy, which makes it less robust as well as redundant code to manage object life cycle. The other problem with BindingPointer is that it does not work with normal assign/copy operator which made it hard to read and use. SharedPtr uses exact same API semantics as std::shared_ptr, which makes the reference counting very easy to use. The main difference of SharedPtr and std::shared_ptr is that it does not use any atomic or lock since it assumes user only uses it under thread safe environment, which ANGLE's backend is. This CL also changes mDescriptorPools to mDynamicDescriptorPools to make it clear that it is dynamic descriptor pool not the descriptor pool. This is also preparation CL for the next CL where we will use SharedPtr to manage DescriptorSetHelper life cycle, which otherwise a bit complicated to manually manage. Bug: angleproject:372268711 Change-Id: I1033d9bf259bbc075a9b374d8a28e1f67d889873 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5926183 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 323187d9 2024-10-11T13:48:51 Vulkan: Fix color attachment limit with framebuffer fetch ANGLE incorreclty assumed that the input descriptor limit is at least as big as the color attachment limit. This is not true on Intel/windows where 8 color attachments are available but only 7 input descriptors. With this change, the color attachment limit is dropped to 7 in such a case so that framebuffer fetch can continue to be supported. Bug: angleproject:372873263 Change-Id: If836563b47399a23b293b74815f6bccb21aaf47c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5919759 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a1584f49 2024-10-11T21:17:32 Vulkan: Qualify framebuffer fetch with "Color" In preparation for depth/stencil framebuffer fetch, many framebuffer fetch symbols are affixed with Color to indicate that they pertain to color framebuffer fetch logic. Bug: angleproject:352364582 Change-Id: I86000ada5e6ef47387dec0b6a3fca589d816cdc2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5926593 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 1608d0be 2024-10-10T16:53:15 Vulkan: Isolate framebuffer fetch no-RP-break optim from DR Prior to [1], changes to framebuffer fetch usage by shaders caused a render pass break. This was due to a limitation of render pass compatibility rules. It also caused other headache, such as needing to clear the render pass cache, recreating pipelines etc. [1]:https://chromium-review.googlesource.com/c/angle/angle/+/3697308 In [1] an important optimization was implemented for tiling GPUs where ANGLE permanently switched to framebuffer fetch mode on first encountering framebuffer fetch use. From that point on, ANGLE would always make every render pass framebuffer fetch compatible. In reality, the render pass break was unnecessary, which became apparent with dynamic rendering (for example that whether the render pass includes input attachments has no bearing on a pipeline that doesn't use input attachments at all). In [2], dynamic rendering kept the render pass break + permanent switch behavior for simplicity. [2]:https://chromium-review.googlesource.com/c/angle/angle/+/5637155 This change untangles the optimization done for legacy render passes from dynamic rendering, allowing dynamic rendering to start every render pass without framebuffer fetch and enable it later if a framebuffer fetch program is used. This is in preparation for supporting depth/stencil framebuffer fetch, where a perma-switch is troublesome (for example in combination with read-only depth/stencil feedback loops). Bug: angleproject:352364582 Change-Id: I31221cf22a28d58b9b2bf188e9c0b786cd0fe3d2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5923120 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 62f33a5c 2024-10-09T16:06:54 Vulkan: Make retainResource for descriptorSetPool consistent Right now the cache hit and cache miss case are handled differently. This CL makes it consistent. Now Caller of DynamicDescriptorPool::getOrAllocateDescriptorSet will handle this retainResource call regardless of cache hit or miss. Bug: b/372268711 Change-Id: I11e47ab9e56a24eb68a0231c5e553ab6b8833c82 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5921640 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Matthew Denton 7e462c22 2024-09-17T15:32:41 WGPU: Implement SetUniform() enough so GetUniform() works Lays out a shadow buffer for basic uniforms per-shadertype in std140, which is close to matching WGPU's layout. This does not actually pass the buffer to WGPU as a uniform buffer. GetUniform() just reads from the shadow buffer. This is copied from the VK backend and so some code is deduplicated. Bug: angleproject:42267100 Change-Id: I727dc9e09a7ccabbb617f148dd68590469883b07 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5867444 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Igor Nazarov 703c5960 2024-07-24T17:02:28 Vulkan: PPO must warmup pipeline cache according to GPL support This commit caused regression: https://chromium-review.googlesource.com/c/angle/angle/+/5366173 `ProgramPipelineVk::link()` uses Complete subset for warmup regardless of the GPL support. However, `ContextVk::createGraphicsPipeline()` will respect the GPL support. Before the above change, PPO was respecting GPL for warmup. This change removed `subset` parameter from the `getPipelineCacheWarmUpTasks()` not only to avoid copy-paste logic, but also to ensure consistency with `waitForGraphicsPostLinkTasks()`. Bug: angleproject:8601 Change-Id: Iab5df1b55921649a8f98a34bb07d8e6a145bfd4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5738153 Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 7691cea7 2024-07-22T13:46:14 Vulkan: Remove seamful cubemap emulation Practically, the Vulkan backend is never expected to run on ES2 hardware. It _may_ for WebGL, but seamful cubemap emulation was disabled for webgl anyway. Bug: angleproject:354729454 Change-Id: Iafa20fbdbe232c4df4c777b12e7698ef7a87cf24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5730143 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1db80b88 2024-07-10T12:47:42 Reland "Vulkan: Use VK_KHR_dynamic_rendering[_local_read]" This is a reland of commit c379ff48043a47e444c388c45270db40d3172d50 Original change's description: > Vulkan: Use VK_KHR_dynamic_rendering[_local_read] > > Bug: angleproject:42267038 > Change-Id: I1f4eb0f309992a9c1c287a69520dadf5eff23b26 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637155 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:42267038 Change-Id: I083e6963b5421386695e49a9872edbb2016c9763 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5691342 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 7d461b21 2024-07-10T14:11:53 Revert "Vulkan: Use VK_KHR_dynamic_rendering[_local_read]" This reverts commit c379ff48043a47e444c388c45270db40d3172d50. Reason for revert: Regresses CPU perf and memory when _not_ using DR Original change's description: > Vulkan: Use VK_KHR_dynamic_rendering[_local_read] > > Bug: angleproject:42267038 > Change-Id: I1f4eb0f309992a9c1c287a69520dadf5eff23b26 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637155 > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Reviewed-by: Charlie Lao <cclao@google.com> Bug: angleproject:42267038 Change-Id: I3865f0d86813f0eeb9085a92875a33bd449b907f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5691337 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c379ff48 2024-06-10T22:01:57 Vulkan: Use VK_KHR_dynamic_rendering[_local_read] Bug: angleproject:42267038 Change-Id: I1f4eb0f309992a9c1c287a69520dadf5eff23b26 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637155 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Igor Nazarov 7d61980e 2024-06-26T18:39:53 Vulkan: Rename DescriptorSetLayoutDesc update() to addBinding() The `update()` method is never actually used to update the exiting bindings (but rather to add new ones), this change renames the method to `addBinding()` and adds few ASSERTs for clarity. Also, after recent changes in `DescriptorSetLayoutDesc` class, some changes made by `update()` method are irreversible. It is possible to have different descriptions that will produce same layout if use `update()` to rewrite the existing structure. Bug: angleproject:8677 Change-Id: If85eb2b271bc06843ee9326c024d73801d3da091 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5676345 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 5703bd61 2024-06-14T14:12:41 Vulkan: Further optimize ProgramExecutableVk::resetLayout 1. Handle compute pipelines similar to how we handle graphics pipelines 2. Track valid compute pipeline permutations Bug: angleproject:8297 Change-Id: I58200517e5a44a2b3092777ea24d1529ceee00f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5634574 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 8ae91859 2024-06-13T15:38:11 Vulkan: Optimize ProgramExecutableVk::resetLayout Instead of iterating through all elements of caches and programinfo, track valid permutations of ProgramTransformOptions. Bug: angleproject:8297 Change-Id: I7676f153f696bf8c4fb268792c667fdac12f827c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5629578 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao 295ff607 2024-06-05T14:49:33 Vulkan: Precompute stageMask of kImageMemoryBarrierData Right now every time we need a pipelineStage in kImageMemoryBarrierData, we are doing a bitwise AND with mSupportedVulkanPipelineStageMask. This get called multiple times from barrier call. This CL adds mImageLayoutAndMemoryBarrierDataMap that has already precomputed all stageMask, thus avoid run time bitwise OR. This CL also precomputes the bufferWritePipelineStageMask so that flushImpl can be use it without construct every time. Bug: b/345279810 Change-Id: I878bd31c967cd217477061976f07df13b043fa7f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5601073 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Igor Nazarov 68a899c2 2024-06-04T12:02:06 Vulkan: Remove shaderProgramOut from initGraphicsShaderPrograms - Remove `shaderProgramOut` from `ProgramExecutableVk` `initGraphicsShaderPrograms()` method, because in all instances argument was `nullptr` (unused). - Update `ProgramInfo::getShaderProgram()` to return reference instead of pointer. This removes confusion, causing unnecessary ASSERTs that checked result for `nullptr`. Note: CL that removed last use of `shaderProgramOut`: https://chromium-review.googlesource.com/c/angle/angle/+/5408796 Bug: angleproject:8297 Change-Id: Idf9fb1c3fd42e90dd385f48a5714ea2751f0c7db Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5596549 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov d0280f09 2024-06-03T13:21:06 Cleanup Program Executable post link task wait Frontend changes: - Add `ASSERT` into `ProgramExecutable::waitForPostLinkTasks()` to check that `mPostLinkSubTasks` must be empty after backend wait. - Add `UNIMPLEMENTED` into `ProgramExecutableImpl` `waitForPostLinkTasks()`, because this method is only required if backend fills `postLinkSubTasksOut` in `LinkTask`, and frontend must not call this method if `mPostLinkSubTasks` are empty. Vulkan backend changes: - Add public `ProgramExecutableVk::waitForComputePostLinkTasks()` with ASSERT to only allow usage with Compute executable. This change avoids confusion calling `waitForPostLinkTasksIfNecessary()` with `nullptr` in case of the Compute pipelines, which will always wait. - Rename `waitForPostLinkTasksIfNecessary()` to `waitForGraphicsPostLinkTasks()`, add ASSERT to only allow usage with Graphics executable, and change optional pointer to the `GraphicsPipelineDesc` to the reference. - Add `WaitableEvent::AllReady()` check into `ProgramExecutableVk` `waitForGraphicsPostLinkTasks()` when going to skip waiting, in order to process tasks (by calling wait) when all tasks are ready. Without this change, post link task may never be processed, causing repeated `GraphicsPipelineDesc` comparisons. - Replace `GraphicsPipelineDesc` hash comparison in `waitForGraphicsPostLinkTasks()` with `keyEqual()` call. This method is around 7 times faster, however effect on the overall performance will likely be unmeasurable. Changed for clarity. - Remove unnecessary `mWarmUpGraphicsPipelineDesc` reset from: `ProgramExecutableVk` initializer list (has default constructor), Compute warmup (already clean after constructor), wait post link tasks (not used when no tasks). - Other minor changes. Bug: angleproject:8297 Change-Id: I7d790da6712be013243083e314af75f82e73886d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5592474 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Roman Lavrov 5e66f6e4 2024-06-03T09:27:44 Vulkan: Make setUniformMatrixfv a free function Same as https://crrev.com/c/5588853 but for matrices const gl::ProgramExecutable and non-const output variables, makes it clear that it only updates: mDefaultUniformBlocks mDefaultUniformBlocksDirty Bug: angleproject:8666 Bug: b/335295728 Change-Id: Ie5a5d527bf314309860fc7ca193c2a32013e7872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5592968 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 9137d9a9 2024-05-31T12:28:04 Vulkan: Make setUniformImpl a free function const gl::ProgramExecutable and non-const output variables, makes it clear that it only updates: mDefaultUniformBlocks mDefaultUniformBlocksDirty Bug: angleproject:8666 Bug: b/335295728 Change-Id: I8851eb500c3e09e896d02c0f83b700cde2a1bbf1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588853 Auto-Submit: Roman Lavrov <romanl@google.com> Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Roman Lavrov 818915a9 2024-05-27T10:53:35 PPO: Propagate dirty uniforms via mPPOProgramExecutables This eliminates the need for ProgramUniformUpdated notification Update mDefaultUniformBlocksDirty rather than just add a check to hasDirtyUniforms, as mDefaultUniformBlocksDirty can then be used elsewhere (for example, calcUniformUpdateRequiredSpace) Also adds ProgramExecutable.mIsPPO flag for an easy check for PPO without inspecting mPPOProgramExecutables Bug: angleproject:8666 Bug: b/335295728 Change-Id: I7725d02460104997df5c89a54d0e5ef3c3079946 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5569184 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov 7c5d2b81 2024-05-21T16:22:53 Vulkan: Add WarmUpTaskCommon::mExecutableVk initialization Change is only for safety, because uninitialized member is not used in the current code. Bug: angleproject:8601 Change-Id: I65fa912119bc9c33a6248c5616388bde4d33b223 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5573393 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 1202055c 2024-05-09T11:25:38 Vulkan: Updates to perf counters 1. don't reset pipeline cache hit / miss counters after every frame 2. bugfix in LinkTaskVk::getResult(...) 3. accumulate counters in WarmUpTaskCommon::getResultImpl(...) Bug: angleproject:8297 Change-Id: I39d7e1a438d78e2e353c5cf8246fb24fb3cfefea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5529942 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Jose Dapena Paz 47fc356b 2024-04-09T11:20:07 GCC: move warm up tasks out of anonymous namespace GCC anonymous namespace is set per file. So forward declaring in the anonymous namespace of .h will not be valid in the .cpp file. Bug: chromium:40565911 Change-Id: I10bd94f035761602d69e59a94dfde5dc774a6776 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5475346 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 36ae4553 2024-04-21T05:18:17 Vulkan: Remove unnecessary member from ProgramExecutableVk Bug: None Change-Id: I896cd67c0ca41d146d8f1cd5494404bbd30b8264 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5469555 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand d4abe622 2024-04-03T17:46:38 CL/VK: Implement enqueue NDRangeKernel & Task Adding support for: clEnqueueNDRangeKernel clEnqueueTask Bug: angleproject:8631 Change-Id: If57002be3ea00a55215e89ca47ab8fe9a422c6e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5406614 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Roman Lavrov 4109a90e 2024-04-16T17:31:11 LinkedUniform: avoid frequent GLenum -> index conversion Certain functions such as getElementComponents() are frequently called in driver_overhead benchmark, causing repeated GLenum -> index conversion of the uniform type which shows up in profiling (driver_overhead_2 trace) Change LinkedUniform.pod.type to LinkedUniform.pod.typeIndex storing the UniformTypeInfo index with conversion helpers. Bug: b/335295728 Change-Id: Iae5cd58f4e2703589d23b8e52991fc4b97c5fb08 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5458741 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi bc53f360 2024-04-10T16:08:23 Vulkan: Improve pipeline warmup hit rate without GPL When VK_EXT_graphics_pipeline_library is not in use, warmup would practically always hit a perf warning about it mismatching the graphics desc of the current draw call. This is because the color mask is not set appropriately, which is what this change does. Bug: angleproject:8297 Change-Id: Ie84660e493baf4370c09f43d50d57fc911bd1390 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5445483 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya c1397510 2024-04-07T21:05:34 Vulkan: Fix data race in WarmUpGraphicsTask std::unordered_map doesn't support simultaneous read and write. Cache placeholder PipelineHelper in WarmUpGraphicsTask and std::move the newly created PipelineHelper when warm up is complete. Bug: angleproject:8297 Change-Id: I1cc4b3cd48147d0080666d5669d61de006c2252d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5431830 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya d1bffdb6 2024-04-09T08:22:18 Vulkan: Bugfix in WarmUpComputeTask 1. An early return caused compute warm up tasks to not be scheduled 2. There are usecases where a program is marked separable post-link. Perform waitForPostLinkTasksImpl unconditionally during save(...) Bug: angleproject:8297 Tests: ProgramBinaryES31Test.SeparableProgramLinkedUniforms* Change-Id: I499f397b938677b4fcdb486001e0a75e202aaf5d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5439732 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya ba208b45 2024-04-06T21:08:15 Vulkan: wait for post-link tasks in resetLayout Wait for post-link tasks before resetting ProgramExecutableVk. Otherwise mGraphicsProgramInfos, which post-link tasks use to create pipeline, can be prematurely invalidated. Bug: angleproject:8297 Tests: Texture2DTestES3YUV*DisableProgramCaching Change-Id: Ib84cebad252777ae4c37cb32c455c326911416a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5430927 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 49e63e07 2024-04-03T13:22:30 Vulkan: Selectively wait for WarmUp tasks If the GraphicsPipelineDesc used by a draw call differs from the one being used by the WarmUp tasks there is no need to wait for their completion. Bug: angleproject:8297 Change-Id: Ibbf3ee710036936060990455bb8657d83c7b6faf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5421594 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya ad13fec3 2024-03-30T15:31:49 Vulkan: warmUpGraphicsPipelineCache(...) shouldn't set state The prepareForWarmUpPipelineCache(...) method would have already setup all necessary state for the warm up task. Make that intent explicit by calling into a method that sets no state. Bug: angleproject:8297 Change-Id: I959d8591045ff05ddb2a410fd0e0eda8dd692d37 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5408796 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 924b40dc 2024-04-04T18:44:21 Selectively wait for post-link tasks in the frontend The frontend waits for post-link tasks only for a relink or in syncState when `disableProgramCaching` feature is not enabled. Bug: angleproject:8297 Change-Id: If7a3b8a10a2d01f82fd2bebac5c8f378be56e19e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5427001 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 06472a7e 2024-04-04T21:07:02 Extend ProgramExecutableImpl API waitForPostLinkTasks(...) will be called into by the frontend. Backends can now choose to defer or avoid waiting for post-link tasks. Also, move warmUp task code to ProgramExecutableVk in the Vulkan backend Bug: angleproject:8297 Change-Id: Ia8a0682923e2f8c6287d62a606eed7f481cda08f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5427000 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 6d569003 2024-03-17T13:15:21 Vulkan: Deduplicate merge to Renderer's pipeline cache Decouple warmUp*PipelineCache(...) and the merge of ProgramExecutableVk::mPipelineCache into Renderer's global cache. This allows the last link subtask to perform the merge once instead of doing so in each subtask. Also, remove AtomicShared datatype and use AtomicRefCounted directly Bug: angleproject:8601 Change-Id: If27831d7d132a3b8644c425072169cf2e9a4bc69 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5376409 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya 21d124c4 2024-03-16T10:06:02 Vulkan: Remove support for pipeline cache control For current and upcoming uses for pipeline caches the benefits of having an externally synchronized pipeline cache is minimal at best. Remove support for that and have all caches be internally synchronized by the Vulkan driver. Bug: angleproject:8601 Change-Id: Ic5d9740934641f61b527094aa301e27302b02a57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5375102 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 553e3c80 2024-03-15T08:40:42 Vulkan: Async compile pipelines with different surface rotations Add prepareForWarmUpPipelineCache(...) method to ProgramExecutableVk that sets up the required common state for warmup tasks. On platforms that support worker threads enqueue a warmup task per surface rotation. Bug: angleproject:8601 Change-Id: I22c0d664736ef682d4207c1e08163f79ac79f7d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5366173 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 60aaf4a0 2024-03-14T12:58:56 Vulkan: Move renderer to namespace vk This class is agnostic of EGL. This change moves it to namespace vk for use with the OpenCL implementation Bug: angleproject:8564 Change-Id: I57f7807d6af8b3d5d7f8efbaf8b5d537a930f881 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5371324 Reviewed-by: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya b2773c11 2024-03-01T11:24:44 Vulkan: Bug fix in immutable sampler pipeline layout recreation An immutable sampler is tied to a sampler index and changing sampler uniform location value should force a recreation of the pipeline layout Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Tests: Texture2DTestES3.TexStorage2DMultipleYuvSamplersSwitch*Vulkan Change-Id: I82aaed332d7f87f11a2fd4923cfc004403ff0bd2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3657480 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 545e3f6e 2024-03-01T23:27:03 Vulkan: Decouple RendererVk from egl::BlobCache The new vk::GlobalOps class abstracts access to egl::BlobCache. This is a step towards decoupling RendererVk from egl::Display for direct use with OpenCL. Bug: angleproject:8564 Change-Id: I7b3910254430df74b889759639da1749735584a7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5332082 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 8346addb 2024-02-06T15:40:31 Contain X11 includes and free usage of common terms This change undoes workarounds where some terms were avoided so there is no clash with X11 (such as Success, Bool and None). In particular, this helps us make sure we never include the X11 headers in such an unconstrained manner as to clash with our code. Bug: angleproject:8520 Change-Id: I53d9657c5a33164064d2c80a206b96fd52f607f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5273491 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Shahbaz Youssefi c6fbf93d 2024-01-19T09:57:12 Vulkan: Fix input attachments leaking into uniform list To communicate the existence of input attachments added to the shader, the translator was adding `ShaderVariable`s for each to the list of uniforms exported from the shader. This was incorrect, as this list is visible to the application through `glGetActiveUniform`. Additionally, this was unnecessarily causing these uniforms to go through program link. Reserving SPIR-V ids for these uniforms, all that is needed from the translator is the mere existence of these input attachments. This change removes the addition of uniforms, and instead exports a bitset. Elsewhere, that bitset is consulted and reserved SPIR-V ids are used. Bug: b/320563594 Bug: angleproject:5792 Change-Id: Id93846cbc3996248f391fd2d5a65af1e48d6d46e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5215089 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 572323cc 2024-01-11T16:20:02 Fix program link after backend rejects program binary If ANGLE believes the program binary is fine, it populates the program executable. If the backend then rejects the program binary, the executable was not reset. After the rejection, ANGLE proceeds to redo the program link, in which case it fails in various ways (ASSERT failures, incorrect data etc) as it tries to accumulate info on top of the previous executable. Bug: angleproject:8471 Change-Id: Ia4d626f5f9643c39a81062da3d5d58aa4c6be762 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5189152 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3680a5dc 2023-11-17T13:51:07 Vulkan: Let program warmup continue passed link The warmup task does not actually affect the link results, so there is no reason to wait for it when the application queries the link status. This change allows the warm up task to continue in parallel until the program is used at draw time. This allows the warm up to be more efficient when the link itself is not parallelized. For applications that create programs in the middle of every frame, it's still likely best to disable warm up (as the following immediate draw will already effectively do the warm up). Note that currently the warm up code in the Vulkan backend is not completely thread-safe, and so the program still blocks on that task before the first draw can happen (or the program is modified in any way). Bug: angleproject:8417 Change-Id: I0877fef39a0585c3279e32699ce817d4643d7cd6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5037538 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi dd8432b5 2023-11-14T14:39:45 Remove angle::Result::Incomplete from shader/program paths angle::Result is not an error code, and having Incomplete made it very unclear what the purpose of this class is. A follow up will remove it entirely. Bug: angleproject:8414 Change-Id: Ica8271b9f7d8868671c7658161e50a53ef23c681 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5028091 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 7cacb537 2023-09-26T11:27:49 Limit the uncompressed data size when decompressing blobs. If the data in the blob cache is invalid for any reason, ANGLE will take the last 32 bits of it an interpret it as a size for decompressing the blob. Add some reasonal upper bounds on the decompressed data size so that if the data is invalid it will simply fail decompression instead of allocating giant buffers. Bug: chromium:1485277 Change-Id: Ifb807f5ea836b692f37734b20789f5daefcca5c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4887599 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Charlie Lao 8fcd4a50 2023-09-19T14:08:14 Cleanup POD struct usage to make them more consistent In recent months, I have made many CLs to wrap various data structures into a trivially copy-able struct. Some of them uses different terminology. This CL replaces all of these to use a consistent name "pod" in the struct, and "mPod" in a class. This CL also turns ActiveVariable methods into macros to remove the code duplication. This CL also moves ProgramInput/ProgramOutput struct implementations from Program.cpp to ProgramExecutable.cpp Bug: b/275102061 Change-Id: Ia2a4210a9ea633f3d323bebe674ee74f8b90b363 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4877335 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
Charlie Lao 9ca025d2 2023-09-18T15:50:48 Flatten BufferVariable/ShaderVariableBuffer/InterfaceBlock struct InterfaceBlock inherits from ShaderVariableBuffer, ShaderVariableBuffer is not a trivially copyable struct, this made InterfaceBlock not trivially copyable. InterfaceBlock is being used by some app traces for uniform blocks. BufferVariable inherits from sh::ShaderVariable which is very complicated and not trivially copyable. This CL flattens all of these three structs to simple structs without inheritance, and wraps all trivially copyable data into one POD struct, thus load/save are cheaper. Bug: b/275102061 Change-Id: I96f89176ce3d3131cb1d3ea3280c3c36c257560f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4874610 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi eb0d5997 2023-09-15T16:41:13 Move set/get uniform machinery to ProgramExecutable This is done because some uniforms are internally added by the compiler (draw ID, base vertex, and base instance) and are automatically set **on the installed executable**. This change fixes scenarios where a draw is done after a program has failed a relink, and therefore is unable to correctly set the uniforms (as it does not have access to the executable that is installed). It also fixes draws that use those uniforms in a PPO. Bug: angleproject:8297 Change-Id: Id74b4984b88aa09b5b81be1c91412d6c91711136 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4864693 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 65220256 2023-09-18T12:29:59 Add ProgramOutput struct for ProgramExecutable::mOutputVariables Right now ProgramExecutable::mOutputVariables is a vector of sh::ShaderVariable. ShaderVariable. itself is not a POD struct and can't memcpy. And most of variables are not needed for mOutputVariables. This CL adds a custom struct for mOutputVariables so that we only store what we actually needed and data can be memcpy. Bug: b/275102061 Change-Id: I045d0618b6dab5f8d58afe40e55147d12987cf61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4862977 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b4852ef9 2023-02-08T14:18:06 Vulkan: Drop support for Vulkan 1.0 Bug: angleproject:7959 Change-Id: Ib673679ea1a503af22b37092dbff1ee1fd34fba6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4233092 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>