src/libANGLE/renderer/vulkan/vk_cache_utils.h


Log

Author Commit Date CI Message
Mohan Maiya 5c8bf081 2021-06-08T13:12:24 Vulkan: Add support for YUV internal format extension 1. Add a function to upload YUV image data to textures 2. Modify stageSubresourceUpdate method to account for YUV images 3. Create VkSamplerYcbcrConversion when initializing ImageHelper 4. Update hasImmutableSampler to account for native YUV format support 5. Skip initializeNonZeroMemory for YUV formats Bug: angleproject:5773 Test: Texture2DTestES3.TexStorage2D*Yuv*Vulkan* Change-Id: I270f04bbf903cf2bf19f100eb95f32953d491c39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2947767 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Cheryl Wei 45965e72 2021-06-17T10:21:26 Vulkan: Translate border color's channel by image view format ANGLE implementes some formats as other formats,such as ALPHA8 to R8, this caused some tests failed due to missing border color's channel translation,this change add a new textureBorderLoadFunction to translate channels of border color by image view format. Bug: angleproject:6046 Change-Id: I94ce719b4db3724ffd3dc862b51a412b5d9f3cce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2972328 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5b314268 2021-06-15T17:37:45 Vulkan: Support OVR_multiview and OVR_multiview2 Multiview is supported in Vulkan simply by specifying the number of views in the render pass, and creating the appropriate image views. A number of changes to the way image views and render targets are stored are made to support those that don't cover the entire range of layers. One particular detail that is not implemented in this change is the use of queries in combination with multiview. Vulkan specifies that N queries are actually produced (N being the number of views) which must be summed by the application, but this is not currently done. Bug: angleproject:6048 Change-Id: I1d4a9894c232d3a93d7a97c9fa0eedc334e57469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2967625 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 9bad7a19 2021-06-15T23:39:52 Vulkan: Unpack RenderPassDesc Upcoming multiview support needs to add 2~3 more bits to this struct, but this struct is already fully packed. As the combination with emulated multisampled render to texture is not planned, some bits used for MSRTT can be aliased with multiview. However, that makes the packing of this struct even more unwieldy. Since only tens of render passes are expected per frame, increasing the size of the render pass cache key should not have a dramatic effect. Bug: angleproject:6048 Change-Id: I5c9a0d155f23a37e2787b38525d3ce721b54ec1e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2966218 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Cody Northrop 851fbedb 2021-06-10T21:27:01 Vulkan: Switch viewport and scissor to dynamic state Heavily based on http://crrev/c/1316888 Some apps are creating a large number of viewport combinations and are running out of graphics memory. This CL drops their graphics pipeline use from tens of thousands to tens. Performance testing shows little impact to application traces. Bug: b/190026813 Bug: angleproject:3143 Change-Id: Ib7415be1128f8fedae4a7ca72e067b2815201223 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954925 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya dd312cc6 2021-05-21T08:49:48 Reland "Vulkan: Add support for EXT_texture_border_clamp" This is a reland of 4b92e089c01e94730fe26c4c743d76d6c935088d Initializes mPadding to 0 in SamplerDesc::update Original change's description: > Vulkan: Add support for EXT_texture_border_clamp > Add support for GL_EXT_texture_border_clamp. This is implemented by > using VK_EXT_custom_border_color. > > Bug: angleproject:3577 > Test: dEQP-GLES31.functional.texture.border_clamp* > Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: angleproject:3577 Change-Id: I8684242c4bce6e1a006dbe926defaa495fcc2282 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2911571 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Yuly Novikov 44fabb7b 2021-05-21T00:51:06 Revert "Vulkan: Add support for EXT_texture_border_clamp" This reverts commit 4b92e089c01e94730fe26c4c743d76d6c935088d. Reason for revert: breaks "Linux MSan Tests" bot https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20MSan%20Tests/28489/overview Original change's description: > Vulkan: Add support for EXT_texture_border_clamp > > Add support for GL_EXT_texture_border_clamp. This is implemented by > using VK_EXT_custom_border_color. > > Bug: angleproject:3577 > Test: dEQP-GLES31.functional.texture.border_clamp* > Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: angleproject:3577, angleproject:5996 Change-Id: I6b62f1a4a43fcfe2d0df2c73de24db83606ce430 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2911533 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Mohan Maiya 4b92e089 2021-05-12T09:20:24 Vulkan: Add support for EXT_texture_border_clamp Add support for GL_EXT_texture_border_clamp. This is implemented by using VK_EXT_custom_border_color. Bug: angleproject:3577 Test: dEQP-GLES31.functional.texture.border_clamp* Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9e8fea5b 2021-05-13T07:04:05 Vulkan: Fix desc set cache bug with xfb offset Prior to this change, the transform feedback buffer offset was not stored in the descriptor set key, so if the offset changed, stale descriptor sets could be used. Bug: angleproject:5963 Change-Id: I3dec4ab9fa82092a65e9a75bdd19c5f2cf49521c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2894513 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill ccc0fbaa 2021-03-24T17:56:38 Vulkan: Related fixes for buffer descriptor set cache. Includes some stats counter gathering and a few related refactors and cleanups. Also includes a new overlay widget. Bug: angleproject:5736 Change-Id: Ida8d2cd815c5b598c6a442dd9bbfdf51e9c05180 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2785431 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 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 efc53d0f 2021-04-03T21:30:15 Vulkan: Refactor to descriptor offset array. This is in preparation for using dynamic offsets for other sets than the default descriptors. Bug: angleproject:5736 Change-Id: I546e688ad57a35b380f8d7f303ffc0c62773ac18 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2804813 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi d1462228 2021-03-09T11:25:36 Vulkan: Use VK_EXT_multisampled_render_to_single_sampled Additionally, makes the emulation path not require independentResolveNone. This was only used to select the NONE resolve mode when the attachment format doesn't have either of depth or stencil aspects, but it's ok to specify the same resolve mode for both aspects even if one aspect is missing. Bug: chromium:1088005 Change-Id: Ifc37cbf5331145179c5927853b996a0d62b871ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743666 Reviewed-by: David Reveman <reveman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 572fd801 2021-03-22T16:14:34 Vulkan: Rename Uniforms/XFB descriptor desc. The new name is more consistent with the other names. Refactoring change only. Bug: angleproject:5736 Change-Id: Idc47fef29040e3a422267795c4536163a6f8eb4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2779953 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b717952e 2021-03-18T10:39:34 Vulkan: Use packed enum map for descriptor set index. This simplifies a lot of the data structure indexing in the program executable class. Also renames the "DriverUniforms" and "InternalShader" index into a single "Internal" index. Bug: angleproject:5736 Change-Id: I2a51d8b14d5b16b438dbe636f77b11bbc045ba9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2773321 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 81dcf078 2021-03-08T11:21:31 Reland "Vulkan: Support EXT_sRGB_write_control" This is a reland of 6073af536cf627742696823edc82c9b0a481a8bc with 2 changes - 1. Don't enable the extension even in nonConformant mode 2. Don't enable VK_KHR_image_format_list for swiftshader Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075 Change-Id: I8e149d196a39c3c4769bfa8690792f3c53831299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2762647 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Peng Huang b27740f3 2021-03-09T16:15:15 Revert "Vulkan: Support EXT_sRGB_write_control" This reverts commit 6073af536cf627742696823edc82c9b0a481a8bc. Reason for revert: crbug.com/1186140 Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075,chromium:1186140 Change-Id: Ib0d4d60fe7434fb950f99db2c210aab9af7d2d0e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743663 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Peng Huang <penghuang@chromium.org>
Mohan Maiya 6073af53 2021-03-08T11:21:31 Vulkan: Support EXT_sRGB_write_control Implement support for EXT_sRGB_write_control. This extension requires VK_KHR_image_format_list to be supported. The spec requires this functionality to work with glBlitFramebuffer as well but support for that will be added in a follow up change. As such, this extension is only exposed in non-conformant mode. Bug: angleproject:5075 Tests: SRGBFramebufferTest.*Vulkan* Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 907a3cee 2021-02-17T08:07:45 Vulkan: Add support for EXT_shader_framebuffer_fetch_non_coherent EXT_shader_framebuffer_fetch_non_coherent is implemented using subpass input attachments. The extension will be enabled in a follow up change that adds required changes to the Vulkan translator. Bug: angleproject:5454 Test: FramebufferFetchNonCoherentES31.*Vulkan Change-Id: Ic73c66a476c4a21db5269431166a198841f1dc0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598059 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b912eec5 2020-11-27T11:08:41 Vulkan: Support GL_EXT_tessellation_shader. Shader translator changes done in http://crrev.com/c/2633936 Adds a new DIRTY_BIT_PATCH_VERTICES state to Context. Supportes state query and transform feedback. 4 test suppressions remain as follow-up fixes. Adds a new varying packing mode for a simple Vulkan rule set. Based on work by Mohan Maiya (m.maiya@samsung.com). Test: dEQP-GLES31.functional.tessellation.* Bug: angleproject:3572 Change-Id: I4cad2cca30adb754fd12c83027673906541f566a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568234 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Stephan Hartmann d21d682d 2021-01-11T12:59:53 libstdc++: fix incomplete type for FramebufferCache libstdc++ does not allow incomplete type for T2 with std::pair<T1,T2> and fails with: .../../src/libANGLE/renderer/vulkan/vk_cache_utils.h:1570:64: required from here /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_pair.h:215:11: error: std::pair<_T1, _T2>::second has incomplete type 215 | _T2 second; /// @c second is a copy of the second object | ^~~~~~ https://chromium-review.googlesource.com/c/angle/angle/+/2580111 added class FramebufferCache with incomplete type in |mPayload| to vk::FramebufferHelper. Changing include order is not an option. However, FramebufferCache is only used in FramebufferVk and we can make it local there. Bug: chromium:957519 Change-Id: I5fbdca23adbb9f4aecc266988c02fb0d051504cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2621473 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 98b56e60 2020-12-12T16:28:21 Vulkan: Accumulate internal cache stats in renderer The CacheStats of all internal caches are accumulated by the renderer. In order to see the hit ratios of all caches, the following GN args must be enabled: is_debug = true angle_enable_perf_counter_output = true Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: Iaca3249192e9e4e130d8291b7759c459d79b06ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2588430 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 46eaba7f 2020-12-12T10:31:26 Vulkan: Add support for internal cache hit and miss counts Add a CacheStats class that provides cache hit and miss bookkeeping. All internal caches make use of this class to keep track of its stats. This provides a means to profile cache hit ratios a.k.a Vulkan object reuse for any application. Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: I44eeb0c2b9b291ec1cdd156fb2be4a5fe80d2848 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2580111 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 56330564 2020-12-10T00:46:04 Vulkan: Support layered framebuffers This feature is introduced by geometry shaders, where all the layers of a texture can be attached to a framebuffer. The geometry shader would use gl_Layer to decide which layer the primitive should be rendered to. Bug: angleproject:3571 Change-Id: Ib2ae8e227b226295f9e2f62f6b230839070bc95c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2582711 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 067a12f0 2020-11-19T16:47:25 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This is a reland of ff38106d62fca2e36ec2db1cd580b546fd53ae43 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/173800146 Change-Id: Ifc36086f4c5d6a44fb5456aa6e31bc8a783bba71 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2579648 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten c859c0ac 2020-11-24T17:21:38 Batch replace std::unordered_map with angle::HashMap in src/ There are a few places that will remain std::unordered_map due to build or run-time errors, which will need to be evaluated more closely to determine if they should remain std::unordered_map or if there is another Abseil data structure that would be more efficient while still working correctly. Bug: angleproject:4873 Change-Id: Ib04253e3ad6398e63f4cc2bfe12c0f9e57cb112b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2558873 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Ian Elliott 1ad5791d 2020-12-03T22:05:51 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Suspect that this CL may be causing win-angle-rel-32 bot failures Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: b/173800146 Change-Id: I7bc9966ebbe949f3999d7927afa629dd2e3a4187 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572801 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jamie Madill 720b85e6 2020-12-01T20:45:29 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit b1917fe1a314709cd9f7f53b2923d6be0e8bbf6c. Reason for revert: Not the root cause. See bug. Original change's description: > Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" > > This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. > > Reason for revert: Speculative revert to clear up AMD. See bug. > > Bug: chromium:1154356 > > Original change's description: > > Vulkan: Use specialization constant for halfRenderAreaWidth > > > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > > shader via specialization constant, thus allow compiler to consolidate > > the calculation into one MAD instruction. > > > > Bug: b/173800146 > > Change-Id: Id66301278e3389e2582369b695825e632bccecee > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Tim Van Patten <timvp@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Idab612bcad4f179857c41ffc4bf8fa2355fae946 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: b/173800146 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568244 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: chromium:1154356 Bug: b/173800146 Change-Id: I5b86bbee8600c6597620f31d8d7b08ca8b3d2d57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568246 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b1917fe1 2020-12-01T20:42:36 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Speculative revert to clear up AMD. See bug. Bug: chromium:1154356 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Idab612bcad4f179857c41ffc4bf8fa2355fae946 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/173800146 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568244 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao ff38106d 2020-11-19T16:47:25 Vulkan: Use specialization constant for halfRenderAreaWidth halfRenderArea is used by fragment shader to adjust gl_FragCoord for rotation and yflip compensation. This CL bakes halfRenderAreaWidth into shader via specialization constant, thus allow compiler to consolidate the calculation into one MAD instruction. Bug: b/173800146 Change-Id: Id66301278e3389e2582369b695825e632bccecee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi a5da17cd 2020-11-26T17:09:37 Vulkan: Remove vk:: inside namespace vk Bug: angleproject:5404 Change-Id: I51df1ad69a65b17621a3cbe4e5d55621cc9ae6ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2562683 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Anders Leino 4e913d34 2020-11-02T10:44:51 Vulkan: Work around Nvidia depth clamping bug In GL ES, depth is always clamped to [0,1]. The same is true in Vulkan, but not for implementations affected by Nvidia bug 3171019. This patch implements a workaround. The workaround introduced test failures on Linux with Nvidia Quadro P400 and driver version 418.56, so it's only applied conditionally, and as a result the test failure expectations are not removed completely. Bug: angleproject:3970 Change-Id: I0d9f855d7f3df72fea4af9f9b134ae3177cf820d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514377 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 130597e1 2020-11-23T18:59:02 Vulkan: Use PackedScissor struct to reduce GraphicsPipelineDesc size We are running out of space in GraphicsPipelineDesc. According to gpuinfo, the max reported viewport size is 32768. This CL changes scissor's x/y/w/h from uint32_t to uint16_t, which saves two uint32_t for other usages. Bug: b/173800146 Change-Id: Icf2d8ba8ea8a8c412ecef2059401a8d831c410e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2557218 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 2ffff6d0 2020-11-12T10:56:06 Vulkan: Support image buffers This change does not support reinterpreted formats yet. Additionally, despite lack of support for RGB32 formats, EXT_texture_buffer is exposed by this extension. Those formats don't support the STORAGE_TEXEL_BUFFER feature on any known hardware. Bug: angleproject:3573 Change-Id: I85f45eb23f6a0aa533488bb98d9f226d59af4d76 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2534395 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 86d7e4d8 2020-11-10T15:55:34 Vulkan: Support texture buffers Texture buffers are placed in the same descriptor set with the rest of the textures. However, the different code paths that handle textures have special cases for texture buffers as they create a different descriptor type (texel buffer instead of combined image sampler). Image view serials are used to track the buffer view serials as well so the texture descriptor cache can handle texture buffers as well. This CL is missing storage texel buffer support. Bug: angleproject:3573 Change-Id: Iff80ca22ff9b9957a0c9a3c7aaada1fa54b24ec8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532653 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao b22f8e8e 2020-10-29T15:50:39 Vulkan: Add specialization constants for surface rotation This plumbing through the specialization constant for surface rotation from ContextVk to pipeline program creation. It has not been used yet, so expecting no real functional change. This CL also converts lineRasterEmulation to use the same specialization constant path as surface rotation. Bug: b/171750979 Change-Id: Ic08c4f8bb576424d1752015e874d0977a58d78bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2508837 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 55934550 2020-11-05T07:13:39 Vulkan: Don't refresh image views unnecessarily If the underlying ICD supports VK_KHR_image_format_list extension we will have created both the linear and sRGB image views, reuse them instead of refreshing them. Bug: angleproject:3609 Bug: angleproject:4561 Bug: angleproject:5281 Change-Id: Ie34f08b3554a07f94911bebf925e38d702bc3c36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2518387 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 3fcf17e6 2020-11-02T12:51:35 Vulkan: Bug fix in sRGBDecode logic When a sampler's GL_TEXTURE_SRGB_DECODE_EXT state was toggled between GL_DECODE_EXT and GL_SKIP_DECODE_EXT VkImageViews of the TextureVk object were not being updated. Add sRGB_decode state as part of ImageViewSubresourceSerial so we retrieve the correct VkImageView from the texture cache. Bug: angleproject:3609 Tests: angle_end2end_tests --gtest_filter=SRGBTextureTestES3.SRGBDecodeSamplerParameterToggle*Vulkan Change-Id: I897e461957d408b5a5b4f03fefc05f2e9684c7b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514900 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 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>
Courtney Goeltzenleuchter f51e99fb 2020-10-13T11:38:28 Vulkan: Remove serial from RenderPassHelper We don't delete RenderPass's so no need to keep a serial. This simplifies things for coming threading code. Bug: b/169788986 Change-Id: I2577b17bc1f6af163725389589d7cd62d09eea13 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2468538 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
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>
Charlie Lao df6b7298 2020-10-12T13:39:09 Vulkan: Use StoreOp_None_QCOM for read only depth stencil buffer For read only depth stencil buffers, there is no need to store depth or stencil value. But we can not use DontCare for storeOp because vulkan core spec says DontCare indicates data is undefined after this. VK_QCOM_render_pass_store_ops extension introduces a new store op that will leave data defined but skip the store. This CL utilize this if the extension is available. Bug: angleproject:5055 Change-Id: I104f3d01eb342a2d0cc900f342430e901bde1bff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462604 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 4c6903a4 2020-10-12T13:39:09 Vulkan: Expand PackedAttachmentOpsDesc from uint16_t to two uint16_ts This is preparation for crrev.com/c/2462604. We run out of bits in the struct PackedAttachmentOpsDesc. This expands it from 16 bits to 32 bits (two uint16_t), gives us a lot more room for current and future needs. Bug: angleproject:5055 Change-Id: I492cbd18c3b71b76b5b48652094409e76c5721b1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2465615 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@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 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>
Charlie Lao 22ed1e59 2020-10-05T17:59:27 Vulkan: Remove depth stencil access out of RenderPassDesc Vulkan spec says that image layout is not counted toward render pass compatibility: "Two render passes are compatible if their corresponding color, input, resolve, and depth/stencil attachment references are compatible and if they are otherwise identical except for: Initial and final image layout in attachment descriptions Image layout in attachment references" This CL removes the depth stencil access mode information out of RenderPassDesc structure. It is essentially partially reverted the change from crrev.com/c/2354280 Bug: b/170134600 Change-Id: Iada4d89c3249489b47db3046952e7cb10f252891 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2451597 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev d5fa6ea9 2020-04-29T04:13:54 Vulkan: Implement OES_draw_buffers_indexed Bug: angleproject:4394 Change-Id: I7db9c695c233b2daf740acc654b1b2e546a8b681 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2172739 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mohan Maiya 9f5eb0b8 2020-10-05T08:18:05 Vulkan: Add OES_sample_shading extension support Support OES_sample_shading extension if the underlying Vulkan ICD supports sampleRateShading. Bug: angleproject:3587 Tests: dEQP-GLES31.functional.sample_shading.* Change-Id: I1b324c1ad3ea3b2157d3cbe0abcdf7085aa4231b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444213 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi c5494728 2020-10-02T00:55:28 Vulkan: Free up 2 bits in PackedAttachmentOpsDesc These bits will be used to aid in invalidation of multisampled-render-to-texture attachments. Bug: angleproject:4836 Change-Id: Ib2b438386f8cd8c057bc0ef16144b9d2ddbc1594 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444097 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 2f3d18f2 2020-10-01T05:58:44 Vulkan: Fix unresolve disagreement between FB and RP FramebufferVk::updateRenderPass reset the render pass description, but not the framebuffer description. This caused a disagreement between the two regarding which attachments need to be unresolved. Later, FramebufferVk::startNewRenderPass could miscalculate whether a new framebuffer needs to be generated based on changes in unresolve attachments. For example: - say in the first render pass color needs to be unresolved. Both RP and FB desc would remember this (each being keys for their respective caches). - A following operation triggers syncState such that FB desc changes (for example rebind of attachment), which cleared RP desc but not FB desc's unresolve attachment state. - If the next render pass does not require an unresolve (for example due to a clear or invalidate), then the framebuffer is not recreated because according to RP desc at the start and end of FramebufferVk::startNewRenderPass there has been no change in unresolve mask. * At start there's no unresolve because of syncState clearing it. * At end there's no unresolve because there's no need for unresolve. - In the end, the framebuffer used for the first render pass would be used for the second render pass as well. Note that: * The first render pass included an unresolve, i.e. two subpasses. * The second render pass requires one subpass according to its RP desc. It's quite easy to accidentally have the framebuffer correctly recreated (based on the reset RP desc) before FramebufferVk::startNewRenderPass. Note that since syncState has called updateRenderPass, FB desc has necessarily changed, and mFramebuffer is nullptr, so any call to FramebufferVk::getFramebuffer would recreate the framebuffer. Both clear and invalidate call FramebufferVk::getFramebuffer. The issue is reproducible in situations where clear/invalidate has been called before the framebuffer is modified, and then draw is issued after the modification. An ASSERT is added to catch discrepencies between RP desc and FB desc to catch bugs even when the issue doesn't manifest itself as a VVL error. Bug: angleproject:4836 Change-Id: I8a0d116402a6c298377d03e0908baa942019ccd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2442379 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 01641c7a 2020-09-30T15:25:28 Vulkan: Fix UtilsVk clear in non-zero subpass Mid-render-pass clears (through UtilsVk) run on the current subpass, which in the presence of multisampled-render-to-texture unresolve would be subpass 1. The graphics pipeline for that draw call should set the correct subpass index. Bug: angleproject:4836 Change-Id: Iba4a03ea96a63b0f5d09c27e5283ff8a8b534e05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2441509 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 43163491 2020-09-22T11:45:06 Vulkan: Unresolve depth/stencil MSRTT attachments Using the same shader that unresolves color, this change allows depth/stencil to be unresolved as well. In turn, this allows the depth and stencil loadOp/storeOp of the implicit multisampled image associated with a multisampled-render-to-texture renderbuffer to be set to DONT_CARE. Stencil unresolve depends on VK_EXT_shader_stencil_export. In the absence of this extension, the stencil aspect is not unresolved and must continue to use loadOp=LOAD and storeOp=STORE. This is not ideal, but the expected use-case of depth/stencil MSRTT renderbuffers is that they get invalidated, so that load and store wouldn't happen in practice. Bug: angleproject:4836 Change-Id: I9939d1e15e10fa8ed285acdd6fe6edb42c59054f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2427049 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao ae24f28a 2020-09-22T17:33:32 Vulkan: Move mReadOnlyDepth out of FramebufferDesc The depth read only or not should not affect VkFramebuffer creation. RenderPasses with just depthstencil layout differences are considered compatible. This CL moves this out of FramebufferDesc into FramebufferVk. Bug: b/168953278 Change-Id: I5bd05b262b7b3b0dc70f9fb8fc4a3db5e7082916 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425032 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao d59bccb5 2020-09-23T10:20:35 Vulkan: updateRenderPassDesc may lose color attachment data FramebufferVk::updateRenderPassDesc() is resetting entire mRenderPassDesc, which may lose color unresolve attachments. This CL makes sure that when we toggle depth stencil buffer's read/write access, we do not reset the whole mRenderPassDesc. Instead we only update the depth stencil attachment's access. Bug: b/168953278 Change-Id: Ia9df2d8ac81ebf2da8a360ba1293faf6c14b2738 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2426468 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi a76b6836 2020-09-17T22:40:42 Vulkan: Support MSRTT depth/stencil resolve VK_KHR_depth_stencil_resolve is used by this change to resolve depth/stencil multisampled-render-to-texture renderbuffers. This extension is not widely supported yet. If it's not present, the depth/stencil resolve operation is silently ignored and the renderbuffer acts as a normal multisampled one. This is not correct, but our primary user (Chrome), and most applications don't care for the resolved depth/stencil data. In fact, it's recommended for the depth/stencil attachment to be invalidated after rendering. Exposing EXT_multisampled_render_to_texture even in the absence of depth/stencil resolve allows the majority of the applications to still take advantage of MSRTT color attachments. Bug: angleproject:4836 Change-Id: I6ba4187344a0c9330d2c77bdc5e2c6fc5483c299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2417645 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Geoff Lang f0b02054 2020-08-06T20:55:05 Add a Vulkan feature to compress float32 vertex formats. Use the vertex conversion pipeline in VertexArrayVk to detect static vertex data and convert float32 vertices to float16. This feature is useful for determining if an allication is vertex bandwidth bound and seeing what gains could be had by using smaller attributes. This feature could be implemented in ANGLE's frontend but new infrastructure for converting and storing the converted attributes would need to be added to gl::VertexArray. Our backends already have the functionality needed to handle unsupported attribute formats and this can be repurposed for compressing vertex formats. Bug: b/167404532 Bug: b/161716126 Change-Id: I9a09656a72e8499faa4124adf876d7261c8341c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2342285 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 49f01a53 2020-09-18T11:38:14 Vulkan: Add features to modify sampling parameters Add features to optionally increase the LoD offset of all sampling operations or disable linear filtering. These can be used to compare performance without recompiling ANGLE. These features could be potentially implemented in the frontend it is more difficult because the features are not available at texture initialization time. Bug: b/167404532 Change-Id: Ifcf56fbcf130c24c54834737733bbffa5ade3959 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2411475 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten ed899835 2020-09-11T21:21:55 Vulkan: Allocate descriptor pools with layouts Descriptor set layouts and pools are very tightly coupled, since their binding types and counts must match to ensure the number of available descriptor sets within a pool remains accurate. To enforce this, the descriptor pools will now keep a copy of the VkDescriptorSetLayout that the pool was created for, which is verified when a descriptor set is allocated from the pool. If the handles don't match, an ASSERT() will fire. Bug: angleproject:5033 Test: CQ Change-Id: I4faf82c24f31052e57b656c968788bb0c131b619 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2407282 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi f39e0f01 2020-09-07T23:07:37 Vulkan: Use subpass to unresolve render-to-texture attachments GL_EXT_multisampled_render_to_texture allows singlesampled textures to be used with multisampled framebuffers in such a way that the final resolve operation is automatically done. In Vulkan terminology, the render-to-texture GL attachment is used as a Vulkan subpass resolve attachment with an implicit (ideally-)lazy-memory multisampled image as the color attachment. This extension expects that if the texture is drawn to after the automatic resolve, the implicit multisampled image would take its fragment colors from the singlesampled image. In other words, the opposite of a resolve operation should be automatically performed at the start of the render pass. This change refers to this operation as "unresolve". The goal of this extension is to allow tiling GPUs to always keep multisampled data on tile memory and only ever load/store singlesampled data. The latter is achieved by using a subpass resolve attachment and setting storeOp of the multisampled color attachment to DONT_CARE. This change achieves the former by using an initial subpass that uses the resolve attachment as input attachment, draws into the multisampled color attachment and sets loadOp of said attachment to DONT_CARE. Bug: angleproject:4881 Change-Id: I99f410530365963567c77a7d62fc9db1500e5e3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2397206 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 8d4331ee 2020-09-16T00:42:08 Vulkan: Free up 5 bits in RenderPassDesc Leveraging the fact that there are only a handful of depth/stencil formats, the last element of RenderPassDesc::mAttachmentFormats can contain other information in addition to the depth/stencil format ID. The FormatID enum is rearranged such that depth/stencil formats are placed first, as a result occupying values in [1, 7]. These values take up 3 bits in an element of RenderPassDesc::mAttachmentFormats (which could be the last element if all color draw buffers are attached). As a result, the upper 5 bits of the last element of RenderPassDesc::mAttachmentFormats is unused. It is intended for these bits to be used in the implementation of multisampled-render-to-texture depth/stencil renderbuffers. Bug: angleproject:4836 Change-Id: I0786e0712539cdbbf5494ec83aeee1dd93f936dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2413165 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 06b4fb92 2020-09-11T21:24:46 Vulkan: Fool proof packed attachment index to vulkan and from OpenGL ANGLE packs FBO attachments from OpenGL and uses packed attachments to create VkFramebuffer and renderpass. When we use attachment index into the attachment array, we must be very careful to use packed index for vulkan objects. It is easy to make mistakes here and introduce hard to debug bugs. This CL defines a PackedAttachmentIndex class that uses that to index into vulkan attachments and pass around APIs so that compiler would catch the error when wrong index is used. This also introduces PackedClearValuesArray that stores clear value in packed attachment index so that it is impossible to mix it with ClearValuesArray that stores clear value in GL attachment index. Bug: b/167301719 Change-Id: I68680522c60beeb5096e5211eaef89da28c7097e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2410366 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao e4e2a016 2020-09-01T11:23:09 Vulkan: Use color mask to handle draw buffer disabled case When draw buffers set to GL_NONE, instead of remove the attachment from renderpass which breaks renderpass, we force vulkan's per buffer color mask to false while keep the disabled draw buffer attached. This CL also always create FrameBuffer with all color attachments regardless it is enabled or not. Bug: b/167301719 Change-Id: Ice9fca9aacf774a47d13b749f822b222cc050174 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2389007 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1bd71b48 2020-09-08T13:54:33 Make gl::DrawBufferMask a BitSet8 This shrinks the size of the mask for use in cache key classes. Bug: angleproject:4881 Change-Id: I87c234832c61e6a663c609b7f6da5d69977b21c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2399182 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 957079aa 2020-09-03T16:20:55 Vulkan: Free 8 bits in RenderPassDesc These bits will be used in a follow up change to determine which color attachments need to take their value from a corresponding resolve attachment in an initial subpass. Bug: angleproject:4881 Change-Id: I76b6b3339fe209f93dd259ca087d84ecaa3004b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2397205 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi cba9bbbe 2020-09-02T09:55:31 Vulkan: Fix resolve-with-subpass retaining resolve attachment The temporary resolve attachment used to optimize blit was not removed from the framebuffer and render pass descriptions, resulting in subsequent draws to be resolved again. Bug: b/159903491 Change-Id: I9a9c90d25cb07ba9a25999f808b164f9085387d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2390441 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Tim Van Patten 85ddcc93 2020-08-24T14:22:22 Vulkan: Convert ProgramExecutableVk::mDescriptorSets to std::array Currently ProgramExecutableVk::mDescriptorSets is a vector, but it's size is bound so it can be a std::array (DescriptorSetLayoutArray). To ensure the size grows correctly in the future, the various descriptor set indexes are also being converted from independent constexpr uint32_ts into the enum DescriptorSetIndex. Bug: angleproject:4898 Test: CQ Change-Id: I7ae8ff3455bcfb61e24b73bd16cc3f8cf9873087 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372664 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jamie Madill e689d316 2020-08-14T22:51:03 Vulkan: Don't end RenderPass on DS feedback loops. Instead of always switching the Framebuffer to mask out depth/stencil loops we now switch the RenderPass to a "read-only" depth/stencil mode. Reduces the RenderPass count in Manhattan from 18->15. There are still a couple extra RenderPasses inserted that we can get rid. We can merge a few RenderPasses by retroactively changing a started RenderPass to "read-only" when there are no prior recorded depth writes or clears. Also adds a test to count the number of RenderPasses ANGLE generates in DS feedback loop situaions. Bug: angleproject:4959 Change-Id: I1855a45959655fc27ccd47a3469c1c672fc8fd9e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2357973 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten dff47d5f 2020-07-14T19:10:12 Vulkan: Optimize MSAA using subpass resolve attachments If a user is performing a blit to resolve a multisample color buffer into a single attachment, ANGLE can use subpass resolve attachments to resolve directly into the destination buffer as part of the render pass. This allows the data to remain in tiler memory and reduce the extra bandwidth required to write the multisampled data back to perform the copy. This work also requires restoring/reopening a render pass if it has been finished already, assuming the finished render pass was started and for the framebuffer that is the source for the blit command. Other objects that were created when the render pass was started need to be updated as well, such as the source FramebufferVk's resolve attachment, the CommandBufferHelper's vk::Framebuffer and vk::RenderPassDesc, etc. While this is better than performing vkCmdResolveImage(), there is still another major part of optimizing MSAA using resolve attachments not implemented here: discarding the multisampled image rather than writing it to GMEM, which requires the user to invalidate the read FBO after the blit. This CL was verified with AGI to make sure there are no explicit blits to resolve the multiple sampled image. Bug: b/159903491 Test: FramebufferTest_ES31.*Blit* Test: VulkanPerformanceCounterTest_ES31.MultisampleResolveWithBlit Change-Id: I320a26088d8f614a295e7feec275d71310391806 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2298663 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill d286daf1 2020-08-16T23:53:31 Vulkan: Track RP's read/write access for depth/stencil. This generalizes the read tracking into read/write. Knowing the write access can let us determine if we can switch a RenderPass to a read- only mode. And switching to read-only will let us combine some RenderPasses in Manhattan. Bug: angleproject:4959 Change-Id: Ic97547e84fef4a2670437677000d4525006ef69f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2358771 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Jamie Madill 594e0e14 2020-08-15T16:35:55 Vulkan: Add DS ReadOnly mode to Framebuffer/RP caches. Allows ANGLE to create Framebuffers and RenderPasses with a read- only depth/stencil layout. Also allows us to transition our Images to this new DepthStencilReadOnly layout. Internal code redesign. No functional change to our command stream. Bug: angleproject:4959 Change-Id: I9b80063bdaec8f5d6c89037e0618c85e1c11b78d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2354280 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill d201ed8b 2020-08-02T16:29:35 Vulkan: Track used Images in RenderPass. Adding a simple ImageSerial tracking map in our RenderPass allows us to know when we do or do not need to close the RenderPass on a new Image access. This simple tracking scheme improves Manhattan performance by up to 25% on Android. The improved perf comes from reducing our RenderPass count (23->18 RenderPasses in our capture scene). Adds a FastUnorderedSet class to manage the used RP Image serials. Updates the Query helpers to explicitly flush the RP before inserting queries. Bug: angleproject:4911 Change-Id: I0c34fc8e307514ebdf3e81e08d8e5aedb70ebe8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2334346 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 25b0de6b 2020-08-01T13:45:11 Vulkan: Squash Texture+ImageView Serial and improve caching. Previously we regenerated TextureSerial on Texture state changes such as base/max level changes. This caused ANGLE to update descriptor sets even though it was using the same image view handles. This change instead uses an ImageViewSubresourceSerial which includes both a serial for the ImageView and a 32-bit packed subresource range. The CL speeds up NBA2k because ANGLE no longer writes new descriptors for Texture max level changes. Local testing showed up to a 40% speedup. Also adds a regression test with a counter for the number of descriptor set writes in a frame. This change will also be useful in upcoming changes that track Image serials in the RenderPass. Bug: angleproject:4911 Change-Id: I66249634aa56288079acf2c0eb8aa3391103533c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333396 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill b9b5fa55 2020-08-02T00:17:20 Vulkan: Redo Sampler Serials. Instead of refreshing sampler serials every time the SamplerVk or TextureVk has a state change we can give a VkSampler a unique serial. The serial is unique to this VkSampler and repeated state changes will fetch the same Serial from the SamplerCache. This allows for more cache hits. We store the the new Serial together with the VkSampler in a SamplerHelper class and store references to a SamplerHelper in SamplerVk and TextureVk instead of the VkSampler directly. In a follow-up change we will improve image view caching by also improving how we store serials for ImageViews. Bug: angleproject:4911 Change-Id: I9168c2700e383bca796cca925b38cfd30132d982 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333988 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill adc250c3 2020-07-31T21:11:05 Vulkan: Refactor ImageViewHelper serials. Instead of storing a dictionary of serials to specific image views we now store a single 32-bit serial combined with subresource info. The serials combined with a subresource info (level/layer) gives a unique identifier for each ImageView in the ImageViewHelper for the descriptor set cache and the Framebuffer cache. Also moves ImageView serial allocation to initialization and release. This means we no longer need to use "getAssign" methods and instead we use a few init methods to ensure the serials stay allocated. Bug: angleproject:4911 Change-Id: Ia6af76ae16b3ff5d4a83974bde05cc704064b079 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2333395 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 22e6fc03 2020-07-31T15:58:28 Vulkan: Move Resource Serial gen into Renderer. Putting Serial allocation in the Renderer allows the Helper classes to manage allocating its own Serial. The init functions for ImageViewHelper only have access to a vk::Context/RendererVk, not a ContextVk. This will be updated in a future CL. Re-uses the Serial Type X-Macro to do more code generation. Serial allocation now uses an atomic because of its now Renderer shared location. Bug: angleproject:4911 Change-Id: I2d5d3d0bbf613d5468de795a700f66164291bc79 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2332884 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi dcc56215 2020-07-19T01:12:09 Vulkan: Implement GL_EXT_multisampled_render_to_texture This change allows the use of resolve attachments in the Vulkan backend. GL_EXT_multisampled_render_to_texture is implemented using this feature. The infrastructure for specifying resolve attachments is designed with eventual support for GL_EXT_multisampled_render_to_texture2 in mind as well as optimizations to glBlitFramebuffer() and multisampled backbuffers. Proper support for glRenderbufferStorageMultisampledEXT is still missing from this change. All tests use this for the depth/stencil attachment and don't read back the data. Currently, the depth/stencil attachment is created as a normal multisampled image. Bug: angleproject:4836 Change-Id: I110a7f63312ae61a657b6094adf7d97c92bd5843 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2304170 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 8765b46a 2020-07-15T17:10:35 Vulkan: Make mDefaultUniformStorage per ContextVk Right now the dynamic buffer for default uniform is per program. Most of time the buffer is unused. That is a huge waste of memory (and these memory are wired memory). This CL moves the mDefaultUniformStorage from per ProgramVk to ContextVk so that we all share with each other. Bug: b/161391337 Change-Id: I1fe8523b2b2dbc39bec3509a3432e38e34bd5713 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2274870 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 964c4089 2020-07-21T14:08:21 Vulkan: fix RenderPassDesc::mColorAttachmentRange This variable tracks the index range of color attachments. A previous change (d8ce865b5fd113d8e0cec4368a9a192a524566a1) made the range inclusive so it can fit in 3 bits, but that's incorrect as it's no longer possible to specify a range where no color attachments are present. This change partially reverts d8ce865b5fd113d8e0cec4368a9a192a524566a1 to restore the previous semantics of RenderPassDesc::mColorAttachmentRange. Bug: chromium:1107884 Change-Id: I08da2568b5e63a48a672edd499a8b6653060eadb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2310578 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d8ce865b 2020-07-19T00:20:17 Vulkan: Make room in RenderPassDesc for resolve attachments Data in RenderPassDesc is packed better to make room for resolve attachments (9 bits made available; 8 for color and 1 for depth/stencil). mColorAttachmentRange contains values in [0, 8). The right side of the range is made inclusive (i.e. [0, 7]) so it will fit in 3 bits. The number of samples is always a power of 2, and below 128 (for the foreseeable future), so its log is stored instead in 3 bits. This change doesn't add support for resolve attachments yet, but is split off the one that does to simplify it. Bug: angleproject:4836 Change-Id: I2856286d5239499d0ab0c78b8154881c003309bc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2306515 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi cd5489ad 2020-07-19T00:05:21 Vulkan: Faster FramebufferDesc compare Objects of this class are used as keys to a hash map and contain 10 serials. Prior to this change, operator== would compare all 10 serials. This change tracks the maximum index set and only compares up to that many serials. To make sure this maximum index stays low in the presence of depth/stencil attachment, this class stores the depth/stencil attachment's serial before the color attachments. The update API of the class is improved so this implementation detail is not leaked. This is in preparation for supporting resolve attachments, which would add another 8 serials to the class. With this change, the performance of cases that don't use resolve attachments won't be affected. Bug: angleproject:4836 Change-Id: Ia4874ab79163901fb86f5bee4120e9f19babdc09 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2306514 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao cc551385 2020-06-29T10:25:45 Vulkan: Add cache for default uniform descriptor set Instead of free and allocate a descriptor set whenever buffer changes, add it into the descriptorset cache. Every time you get the buffer, we also look in the cache first to see if there is a descriptorset for that buffer or not. If yes, we use the cached descriptor set instead of allocate one. Bug: b/159457348 Change-Id: I64c252dfe22db66ea8188415e1b384af371b82ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2273698 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 67980f13 2020-07-08T08:51:02 Vulkan: add Buffer/Texture/ImageViewSerial class In a few places we need a unique ID to represent that object and use that to compute hash key. Right now we are using Serial for that purpose but it creates confusion with QueueSerial which we are using Serial to track GPU progress. This CL changes these usage of Serial to TextureSerial, SamplerSerial, ImageViewSerial type so that compiler can perform type checking. It also adds BufferSerial in preparation for next CL. Bug: b/159457348 Change-Id: I8e2da69c2029e4ddbcf163981ae46f85e19f751b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2287426 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Courtney Goeltzenleuchter f61272fb 2020-06-17T11:38:37 Add support for VK_KHR_sampler_ycbcr_conversion This adds ability for applications to import Android Hardware Buffers (AHBs) as OpenGL images which in turn can be sampled from and/or written. This was specifically tested with the common use case of importing a buffer created by an media decoder and using that as a texture source to include that video content on the screen. Tested with: - Angry Birds 2 video player (for ads) requires YUV conversion. - Basic Media Decoder example: https://github.com/android/media-samples/tree/master/BasicMediaDecoder Bug: b/155487768 Change-Id: I9255450f81aa4daa2aace7205d4f6c3f225abcca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2175103 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tobin Ehlis cfbf769d 2020-06-22T10:14:02 Vulkan:Level/Layer hash fix-up Simplify has function for level/layer of imageView and add asserts to make sure that there won't be hash collisions. Bug: angleproject:4651 Change-Id: I8ab86a4f3d7aa668ad2c08e61bd5fd57744fcd12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2257265 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
Courtney Goeltzenleuchter 2919dc6e 2020-06-15T18:39:39 Add immutable samplers to descriptor set layout To support YUV conversion we need to track the use of immutable samplers in the descriptor set layout. Bug: b/155487768 Change-Id: Ic7dc6a08551f5125c4a519b5cfada312f95ab914 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2225423 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Tobin Ehlis 34ca1ac7 2020-06-16T12:05:12 Vulkan: Fix FramebufferVk cache Migrate Serial from Image to ImageView. Imageviews are what are utimately used in FramebufferVk, so move the Serials into the ImageViewHelper class. Since that class also knows the level/layer of the imageView, we can revert to using a single Serial per ImageView instead of the AttachmentSerial that included the layer and level. ImageViewHelper caches Serials per layer/level combo. Bug: angleproject:4651 Change-Id: I3741d7d03523eada84295cb712c1cc1e6e3c3867 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2248203 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Antonio Maiorano 4f343f3e 2020-05-13T14:11:51 Reland "Add support for GL_CHROMIUM_texture_filtering" This is a reland of 38780ae3921d2570316119a881adfb9520e7e296 modulo the changes to disable VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT, as this was causing problems. With this landed, the extension will not work on SwiftShader until we find a way to allow this extension through the validation layers. Bug: b/146423360 Bug: b/154620295 Change-Id: Ie09fc507c01a47be3bb227bc78771660170ba5d3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2199639 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tim Van Patten 3b82fdcf 2020-05-12T23:44:07 Revert "Add support for GL_CHROMIUM_texture_filtering" This reverts commit 38780ae3921d2570316119a881adfb9520e7e296. Reason for revert: Breaks SWANGLE-VK: 05-12 23:42:28.612 22836 22861 D libEGL : dlopen_ext from APK (libEGL_angle.so) success at 0x79f4485a10 05-12 23:42:28.617 22836 22861 D libEGL : dlopen_ext from APK (libGLESv1_CM_angle.so) success at 0x79f4485eb0 05-12 23:42:28.619 22836 22861 D libEGL : dlopen_ext from APK (libGLESv2_angle.so) success at 0x79f4485c60 05-12 23:42:28.624 14223 14223 D StatusBar: disable<e i a s b h r c s > disable2<q i n > 05-12 23:42:28.633 14014 14057 V DisplayPowerController: Brightness [0.19986142] reason changing to: 'automatic', previous reason: 'automatic [ dim ]'. 05-12 23:42:28.635 22836 22861 D vulkan : searching for layers in '/data/app/~~0AfWfBsFEO78tqKlnanevg==/org.khronos.gl_cts-NOs3SGclHqlbcqe-08gHrw==/lib/arm64' 05-12 23:42:28.635 22836 22861 D vulkan : searching for layers in '/data/app/~~0AfWfBsFEO78tqKlnanevg==/org.khronos.gl_cts-NOs3SGclHqlbcqe-08gHrw==/base.apk!/lib/arm64-v8a' 05-12 23:42:28.632 22836 22836 W .khronos.gl_cts: type=1400 audit(0.0:218): avc: denied { ptrace } for scontext=u:r:zygote:s0 tcontext=u:r:untrusted_app_25:s0:c512,c768 tclass=process permissive=0 b/77925912 app=org.khronos.gl_cts 05-12 23:42:28.636 14014 14034 I EventSequenceValidator: Transition from ACTIVITY_LAUNCHED to ACTIVITY_FINISHED 05-12 23:42:28.637 22836 22861 F SwiftShader: external/swiftshader/src/Vulkan/libVulkan.cpp:425 vkCreateInstance TRACE_ASSERT: pCreateInfo->pNext sType = 1000247000 --------- beginning of crash 05-12 23:42:28.637 22836 22861 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 22861 (.khronos.gl_cts), pid 22836 (.khronos.gl_cts) Original change's description: > Add support for GL_CHROMIUM_texture_filtering > > Chromium enables a custom extension, GL_CHROMIUM_texture_filtering, when > using SwiftShaderGL, to enable high precision filtering. This change > makes it so ANGLE also handles this same extension when using the > SwiftShaderVK backend, by enabling the new > VK_GOOGLE_sampler_filtering_precision custom extension. > > Bug: b/146423360 > Bug: b/154620295 > Change-Id: I69cafc1ccf5970a3d220ac7e13ec3c8fdd4a9643 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2185822 > Commit-Queue: Antonio Maiorano <amaiorano@google.com> > Commit-Queue: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=geofflang@chromium.org,jmadill@chromium.org,amaiorano@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: b/146423360, b/154620295 Change-Id: I803d7a7baac81cf178b59c4bf2789346ec1d3f87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2197168 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Tim Van Patten <timvp@google.com>
Antonio Maiorano 38780ae3 2020-05-06T16:05:02 Add support for GL_CHROMIUM_texture_filtering Chromium enables a custom extension, GL_CHROMIUM_texture_filtering, when using SwiftShaderGL, to enable high precision filtering. This change makes it so ANGLE also handles this same extension when using the SwiftShaderVK backend, by enabling the new VK_GOOGLE_sampler_filtering_precision custom extension. Bug: b/146423360 Bug: b/154620295 Change-Id: I69cafc1ccf5970a3d220ac7e13ec3c8fdd4a9643 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2185822 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill fbc2f063 2020-04-24T13:00:11 Vulkan: Refactor AttachmentOpsArray. Will allow for more flexibly setting ops when we defer clears. Bug: angleproject:4517 Change-Id: I7d9116bc92e90eb41a1030fea242eadf1cc74562 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2165629 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 492ec932 2020-04-21T13:38:41 Vulkan: Track allocated sampler counts. Helps to diagnose perf bugs where resources are over-allocated. Also can be useful to evaluate caching strategies. Bug: angleproject:4517 Change-Id: I48df5a09fbc394fa0b1712fa8cf28a179665e6e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2159293 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tobin Ehlis <tobine@google.com>
Jamie Madill 6fc0066a 2020-04-21T17:40:54 Vulkan: Add a sampler cache. This uses a packed sampler description to re-use samplers for multliple VkImages. The samplers will persist for the lifetime of RendererVk. In the future we could look at doing cache eviction for large object counts. Reduces the active VkSampler cache in Manhattan from over 1200 to 9. Also should reduce the number of VkSamplers used with Chrome. Bug: angleproject:4491 Change-Id: Idca00e4ed8cb660a0865281544aaa57cf884bbdb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2160771 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 03c18fbd 2020-04-13T16:01:01 Vulkan: Skip load if depth/stencil value are undefined EGL1.5 spec says depth/stencil data are undefined after swap. This CL will track the depth/stencil data and mark it as undefined and skip the load if it is undefined. Bug: b/153885625 Change-Id: Ifb3d88d442da547fa78c1eae091cbae08a20d0ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2148179 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 8c67c079 2020-04-16T14:42:15 Vulkan: store ImageLayout in PackedAttachmentOpsDesc The layout in the PackedAttachmentOpsDesc only have 5 bits, not enough for raw VKImageLayout enums. This change will store vk::ImageLayout which are ANGLE defined and packed for 5 bits and able to handle the extension bits of VKImageLayout. Bug: b/153885625 Change-Id: Ida268a974094188d8aeee39c61019eef30a60507 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2153845 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill dd00f16b 2020-04-02T14:04:44 Vulkan: Fix FBO cache when updating disabled attachments. Fix this by consistently checking if the attachment is enabled when we update the serials. Also includes a regression test and more ASSERTs. Bug: angleproject:4540 Change-Id: I154d23cad71f1674d893390f923f45c643a58925 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2134409 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Tobin Ehlis <tobine@google.com>
Tim Van Patten abaa3573 2020-02-20T10:23:02 Vulkan: Only calculate variable locations once Variable locations and descriptor set/binding values are calculated multiple times: - Compiling GLSL->SPIR-V - Creating the Vulkan pipeline layout - Updating descriptor sets These values should instead be calculated once and reused throughout since they won't change without recompiling the shader program. Bug: angleproject:3570 Change-Id: I5d8767b3b2e2f741aade7fec9991eea53ee2eb98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2067101 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 4fb3c28f 2020-03-19T19:10:45 Vulkan: Fix Framebuffer cache depth/stencil issue. The DrawBuffers resetting logic didn't update the depth/stencil serial. Fix this and add a regression test that would crash in this situation. Note that the Manhattan benchmark could trigger this under some cases. Bug: angleproject:4322 Bug: angleproject:4490 Change-Id: Ie4b24efeb5991ecaa85bf8f964f77476bd6f167d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2111333 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>