src/libANGLE/renderer/vulkan/TextureVk.cpp


Log

Author Commit Date CI Message
Mohan Maiya b3d85cce 2024-09-30T14:28:35 Vulkan: Consolidate write colorspace override states ColorspaceState struct is now used to cache write colorspace related states to determine the colorspace of Vulkan draw image views. ImageViewHelper methods are called during initialization and when colorspace related states are toggled dynamically which in turn process these states and determine the final write colorspace. We can now fully support rendering to EGLImages, with colorspace overrides, via texture or renderbuffer EGLImage targets Bug: angleproject:40644776 Tests: ImageTest*Colorspace*Vulkan MultithreadingTestES3.SharedSrgbTextureMultipleContexts*Vulkan ReadPixelsPBOTest.SrgbUnorm*Vulkan Change-Id: I2be2cd3b5b2b4ac8ecb803c34cde2b846cbd1cbe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5901256 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Mohan Maiya b38cc7fa 2024-09-30T12:43:09 Vulkan: Consolidate read colorspace override states ColorspaceState struct is now used to cache read colorspace related states to determine the colorspace of Vulkan read image views. ImageViewHelper methods are called during initialization and when colorspace related states are toggled dynamically which in turn process these states and determine the final read colorspace. Bug: angleproject:40644776 Tests: ImageTest*Colorspace*Vulkan SRGBTextureTest.SRGB*TextureParameter*Vulkan SRGBTextureTestES3.SRGBDecodeTexelFetch*Vulkan Change-Id: I16b3666cd80865936b826dc0738fc9210dabeda9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5901255 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao d147a2ca 2024-10-04T10:45:55 Vulkan: release descriptorSets from TextureVk::refreshImageViews When texture has to refresh its imageViews, the existing descriptorSet cache will become obsolete (because the cache key contains view's uniqueSerial). This CL proactively releases all cache so that we don't keep these invalid cache any more. Bug: b/368566032 Change-Id: I82a221b8b8fd072ee3a52b11264addba385526d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5908772 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu eaffa034 2024-09-24T20:56:04 Revert "Vulkan: Consolidate colorspace override states" This reverts commit bffcd235ba6c031603d798daaa98f1cf9a3f3e46. Reason for revert: Breaks Android test `org.skia.skqp.SkQPRunner#UnitTest_DMSAA_dst_read`. Details: https://b.corp.google.com/issues/369388539. Original change's description: > Vulkan: Consolidate colorspace override states > > ColorspaceState struct is now used to cache colorspace related states > and used to determine the colorspace of Vulkan image views. > ImageViewHelper methods are called during initialization and when > colorspace related states are toggled dynamically which in turn process > these states and determine the final read and write colorspaces. > > We can now fully support rendering to EGLImages, with colorspace > overrides, via texture or renderbuffer EGLImage targets > > Bug: angleproject:40644776 > Tests: ImageTest*Colorspace*Vulkan > MultithreadingTestES3.SharedSrgbTextureMultipleContexts*Vulkan > SRGBTextureTest.SRGB*TextureParameter*Vulkan > SRGBTextureTestES3.SRGBDecodeTexelFetch*Vulkan > ReadPixelsPBOTest.SrgbUnorm*Vulkan > Change-Id: I1cc2b5bd834b519b83deab4d80a2fcaabeb271d6 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5841290 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Charlie Lao <cclao@google.com> > Commit-Queue: mohan maiya <m.maiya@samsung.com> Bug: angleproject:40644776 Change-Id: I5bf6cf2ed0c8ec22fc02d8c3da92673ee85fe002 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5888506 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Mohan Maiya bffcd235 2024-09-13T14:58:00 Vulkan: Consolidate colorspace override states ColorspaceState struct is now used to cache colorspace related states and used to determine the colorspace of Vulkan image views. ImageViewHelper methods are called during initialization and when colorspace related states are toggled dynamically which in turn process these states and determine the final read and write colorspaces. We can now fully support rendering to EGLImages, with colorspace overrides, via texture or renderbuffer EGLImage targets Bug: angleproject:40644776 Tests: ImageTest*Colorspace*Vulkan MultithreadingTestES3.SharedSrgbTextureMultipleContexts*Vulkan SRGBTextureTest.SRGB*TextureParameter*Vulkan SRGBTextureTestES3.SRGBDecodeTexelFetch*Vulkan ReadPixelsPBOTest.SrgbUnorm*Vulkan Change-Id: I1cc2b5bd834b519b83deab4d80a2fcaabeb271d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5841290 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Amirali Abdolrashidi e38d25b1 2024-06-21T18:22:32 Vulkan: Implement EXT_clear_texture * Added new functions to TextureVk to clear the image. * clearImage() * clearSubImage() * Both implemented via clearSubImageImpl(), with the former a special case of the latter. * For multisample or renderable images, stagePartialClear() from ImageHelper is called to add the update. * For single-sampled non-renderable images, a buffer is filled with the pixel data and applied to the image as a buffer update. * Added new update type: ClearPartial * Used for renderable textures. This includes multisample textures. * LOAD_OP_CLEAR is used in a render pass to perform the clear. * UtilsVk::clearTexture() * (Uses ClearTextureParameters) * Uses the following functions to get the VkClearValue from the input data and format: * GetVkClearColorValueFromBytes() * GetVkClearDepthStencilValueFromBytes() * ClearPartial updates can also be superseded and removed similar to Buffer updates. * Updated UtilsVk::startRenderPass() to accept a VkClearValue* as an input arg. If used, the render pass will use LOAD_OP_CLEAR. * Enabled the feature "clearTextureEXT" on Vulkan. * Added new unit tests in ClearTextureEXTTest for various formats and pixel sizes. * Added related multisample tests in FramebufferTest.cpp. * FramebufferTest_ES31.ClearTextureEXT* * Disabled some of the new tests failing using OpenGL. * Disabled stencil-only-related tests on Pineapple. Bug: angleproject:42266869 Change-Id: I89c631d68a4ed63d9991abe1783333255ade20dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5778348 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Mohan Maiya 1b4d6185 2024-09-12T09:18:46 Vulkan: Cleanup sRGB related code Image and image view code is littered with sRGB related enums, even in places that don't deal with sRGB. Remove sRGB related parameters from initLayerImageView and getLevelLayerDrawImageView methods, which now assume default values. Add dedicated methods that allow overriding sRGB state values. Also introduce ColorspaceState struct that consolidates all sRGB related states, this will be used in follow up changes to track and infer colorspace of image views Bug: angleproject:40644776 Change-Id: Ifb366db48043e376f9ff6c30c852c44dd96562a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5860808 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Igor Nazarov 74816e9e 2024-08-29T15:58:22 Vulkan: Cleanup RenderTargetVk release/destroy methods Current implementation of `release()` and `destroy()` methods does not actually invalidate state of the object. All they do is manage the Framebuffer cache. The `release()` method renamed to `releaseFramebuffers()` to match its behavior. Added new `releaseImageAndViews()` method that calls `releaseFramebuffers()` and also null the pointers in order to catch invalid usage in ASSSERTs (for example: usage of `SurfaceVk::mColorRenderTarget` after swapchain recreation but before ANI processing). `destroy()` is updated to also call `reset()`. `releaseFramebuffers()` is only used in `TextureVk` class. In case of `releaseImageViews()`, arrays are cleared, so there is no point calling `releaseImageAndViews()`. In case of `refreshImageViews()`, render targets may be reused, since all pointers remain valid. `RenderbufferVk` and `WindowSurfaceVk` are using new `releaseImageAndViews()` and updated `destroy()` methods. Other changes: - Replace clearing of RT arrays in `TextureVk::setImageHelper()` with ASSERTs. - Fix ASSERT in `TextureVk::releaseImageViews()`, but it seems that this code path is impossible. Bug: b/234769934 Change-Id: I431d25b81dd4dd343149c12e680e5c997aa18436 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5822575 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Charlie Lao e4aab5cc 2024-08-13T14:54:19 Vulkan: Reuse the same conversion buffer by adjusting offset In some usage case where app calls bufferSubData and then calls glVertexAttribPointer to source vertex from different offset, we could still just reuse the existing VertexConversionBuffer instead of create a new one. The benefit with this is that all previous converted data are still valid, thus reduce the overall conversion, and reduce the number of conversion buffers and saves memory. Bug: b/357622380 Change-Id: Ifcf626427e2ed500d6ab617541b78a60839d9acd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5785670 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao 86508e20 2024-08-16T14:56:37 Vulkan: Make VertexConversionBuffer a class And wrap the cache key (i.e, formatID/stride/offset) into a CacheKey struct so that we can easily add more data members. This CL also changes ConversionBuffer from struct to class to have better encapsulation. No functional changes is expected here. Bug: b/357622380 Change-Id: Ieecf5c922b95a940137c8e54657ef3f458c55fc9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5793921 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 087afc91 2024-08-10T20:40:53 Vulkan: Prefer fallback to renderable texture than CPU copy When a texture copy is done, the transfer path is preferred. If transfer is not possible, ANGLE falls back to a draw-based copy. However, if the format is not renderable, ANGLE falls back to CPU copy. Instead, this change makes ANGLE try to fall back to a renderable format before giving up on the draw-based copy. Bug: b/351872449 Change-Id: I3d09dd88cc0b7feb5e92e58c4f19380973eb5e94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5775592 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Le Hoang Quyen 1bfe5c57 2024-07-30T15:58:47 Metal: partially implement EXT_multisampled_render_to_texture. Implement by implicitly attaching a multisampled texture to the render pass. The content will be preserved across render passes by loading/storing to the implicit multisampled texture. However this won't work if the single sampled texture is used in multiple render passes with different glFramebufferTexture2DMultisampleEXT's sample counts. For that to work we need to implement unresolve step to load the resolve texture's texels into the implicit multisampled texture. That will be implemented in a separate CL. Bug: angleproject:42261786 Change-Id: I12be75af17ce5b98266946846417d0a43fcba455 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746180 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@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>
Charlie Lao 8c546d35 2024-06-25T12:49:40 Vulkan: Limit VkEvent for usage matters for Manhattan31 only If we use VkEvent to track all image operations causes performance regression on some app traces, including manhattan10 trace. This mainly because of CPU overhead comes with VkCmdSetEvent, mostly inside vulkan driver. These app traces likely not benefit from VkEvent because the specific bubble (false dependency) does not manifest on these app traces, but the CPU overhead takes a performance toll on it. In order to strike a balance between benefit and overhead, this CL removes most of VkEvent usage and only leaves the ones that matters for manhattan31. The only we still keeps are generateMipmap, dispatchCompute, texture sampling. We can always add more if more beneficial usage cases comes up and no regression in other traces. Bug: b/336844257 Change-Id: I346fe70bc33e57edf04e933a2db0f79738c4481d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5654737 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 8b1daa18 2024-06-24T14:22:22 Vulkan: Fix MSRTT failure from undef addnl format In TextureVk::initImage(), for formats that do not have an SRGB equivalent, such as some D/S formats, additionalViewFormat becomes VK_FORMAT_UNDEFINED. For those textures, FormatSupportsUsage() returns false for MSRTSS, which leads to an error in some test cases. * Added the condition that, to determine MSRTSS support, additional format is ignored if it is undefined. * Unsuppressed affected tests that should now be fixed. Bug: angleproject:348181798 Change-Id: I739b630ac7d0230e2506f6f13b8cb9b3b50d175f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5651860 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Amirali Abdolrashidi 3c472b45 2024-06-20T13:17:32 Vulkan: Fail if texture bound to MSRTT w/o support * If a texture is already bound to an MSRTT framebuffer, but MSRTSS is not supported by the driver for that format, it leads to failure. Bug: angleproject:348181798 Change-Id: I685ca552b9c53b06f33065ba594d81cfa7b25b4d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5644215 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 06f1b72f 2024-06-03T08:59:46 Vulkan: Bugfix in MSRTT emulation Transient multisampled images should have no mips. Enforce this requirement when MSRTT is being emulated Bug: angleproject:4836 Tests: MultisampledRenderToTexture*MultipleLevelsMultisample* Change-Id: I6df21bbb49a4c45aa3ee321f7d49b81f55352562 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5601347 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 65f8dc8e 2024-06-12T17:01:54 Vulkan: Remove traces of VK_MSRTSS_GOOGLEX Devices that shipped this unreleased extension should have long been updated to VK_MSRTSS_EXT Bug: angleproject:4836 Change-Id: I23736ebf28afd4a6f3b5b0d5a6417b3e7564c293 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5627575 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Charlie Lao b4f3824e 2024-05-31T11:36:32 Reland "Vulkan: Defer texture data flush until data provided for all levels" This is a reland of commit 490c056a88a33870cb4ba2a7906b0a9688d96262 Original change's description: > Vulkan: Defer texture data flush until data provided for all levels > > One of the major overhead with VkEvent is seeing with first frame where > all textures are being specified. The immutable textures, we always > immediately flush out the update as data provided for each level. This > means one VkEvent is created and SetEvent is called per level. This CL > delays the flush until data for all levels are provided, thus there is > only one flush per texture instead of per level. With this CL asphalt_9 > is no longer timeout on bots when VkEvent is enabled. > > There is also another benefit comes with this CL. On all desktop GPUs, > ASTC format texture are falling back to RGBA8. We always stage a clear > for the emulated format. That staged clear are able to be removed if > data is provided later. Because of we flush out staged update when first > level data is provided, all staged clear for the subsequent levels are > also gets flushed out, losing the chance to be removed. This CL will > allow all staged clears being removed. > > Bug: b/343976993 > Bug: b/336844257 > Change-Id: Ica731ea57db771b16966f4da92ccdc551ae93d81 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588816 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/343976993 Bug: b/336844257 Change-Id: Iabcc1b4ebca7d6f34a0e7f109795392fc00e7eda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5606146 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Alexey Knyazev 57524dc9 2024-06-06T00:00:00 Fix shader image level rebinding Added a test that interleaves two draw calls with rebinding the texture level of a shader image; fixed surface init. Vulkan: Fixed subresource serial generation. D3D11: Fixed dirty bit setting. Fixed: angleproject:7647 Bug: angleproject:8124 Change-Id: I4b5d095a1714f31a4f7b63f96dedb366faa17a03 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5611298 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.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>
Charlie Lao 92f198f6 2024-06-06T21:42:35 Revert "Reland "Vulkan: Defer texture data flush until data provided for all levels"" This reverts commit b93af07ac1ddb9f2e262d611d155f4b63f18999f. Reason for revert: b/345532371 Original change's description: > Reland "Vulkan: Defer texture data flush until data provided for all levels" > > This is a reland of commit 490c056a88a33870cb4ba2a7906b0a9688d96262 > > Original change's description: > > Vulkan: Defer texture data flush until data provided for all levels > > > > One of the major overhead with VkEvent is seeing with first frame where > > all textures are being specified. The immutable textures, we always > > immediately flush out the update as data provided for each level. This > > means one VkEvent is created and SetEvent is called per level. This CL > > delays the flush until data for all levels are provided, thus there is > > only one flush per texture instead of per level. With this CL asphalt_9 > > is no longer timeout on bots when VkEvent is enabled. > > > > There is also another benefit comes with this CL. On all desktop GPUs, > > ASTC format texture are falling back to RGBA8. We always stage a clear > > for the emulated format. That staged clear are able to be removed if > > data is provided later. Because of we flush out staged update when first > > level data is provided, all staged clear for the subsequent levels are > > also gets flushed out, losing the chance to be removed. This CL will > > allow all staged clears being removed. > > > > Bug: b/343976993 > > Bug: b/336844257 > > Change-Id: Ica731ea57db771b16966f4da92ccdc551ae93d81 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588816 > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Bug: b/343976993 > Bug: b/336844257 > Change-Id: Ie987582a44e0d73abd38ce8f6813ff8995e907e2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5597810 > Reviewed-by: Cody Northrop <cnorthrop@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/343976993 Bug: b/336844257 Change-Id: I9356da6b4cdb21dba47758d6e937d1ae02f0ae34 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5606144 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Charlie Lao b93af07a 2024-05-31T11:36:32 Reland "Vulkan: Defer texture data flush until data provided for all levels" This is a reland of commit 490c056a88a33870cb4ba2a7906b0a9688d96262 Original change's description: > Vulkan: Defer texture data flush until data provided for all levels > > One of the major overhead with VkEvent is seeing with first frame where > all textures are being specified. The immutable textures, we always > immediately flush out the update as data provided for each level. This > means one VkEvent is created and SetEvent is called per level. This CL > delays the flush until data for all levels are provided, thus there is > only one flush per texture instead of per level. With this CL asphalt_9 > is no longer timeout on bots when VkEvent is enabled. > > There is also another benefit comes with this CL. On all desktop GPUs, > ASTC format texture are falling back to RGBA8. We always stage a clear > for the emulated format. That staged clear are able to be removed if > data is provided later. Because of we flush out staged update when first > level data is provided, all staged clear for the subsequent levels are > also gets flushed out, losing the chance to be removed. This CL will > allow all staged clears being removed. > > Bug: b/343976993 > Bug: b/336844257 > Change-Id: Ica731ea57db771b16966f4da92ccdc551ae93d81 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588816 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/343976993 Bug: b/336844257 Change-Id: Ie987582a44e0d73abd38ce8f6813ff8995e907e2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5597810 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Yuly Novikov 170851ff 2024-06-04T09:01:11 Revert "Vulkan: Defer texture data flush until data provided for all levels" This reverts commit 490c056a88a33870cb4ba2a7906b0a9688d96262. Reason for revert: breaks win-trace https://ci.chromium.org/ui/p/angle/builders/ci/win-trace/6014/overview Original change's description: > Vulkan: Defer texture data flush until data provided for all levels > > One of the major overhead with VkEvent is seeing with first frame where > all textures are being specified. The immutable textures, we always > immediately flush out the update as data provided for each level. This > means one VkEvent is created and SetEvent is called per level. This CL > delays the flush until data for all levels are provided, thus there is > only one flush per texture instead of per level. With this CL asphalt_9 > is no longer timeout on bots when VkEvent is enabled. > > There is also another benefit comes with this CL. On all desktop GPUs, > ASTC format texture are falling back to RGBA8. We always stage a clear > for the emulated format. That staged clear are able to be removed if > data is provided later. Because of we flush out staged update when first > level data is provided, all staged clear for the subsequent levels are > also gets flushed out, losing the chance to be removed. This CL will > allow all staged clears being removed. > > Bug: b/343976993 > Bug: b/336844257 > Change-Id: Ica731ea57db771b16966f4da92ccdc551ae93d81 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588816 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> Bug: b/343976993 Bug: b/336844257 Change-Id: I25854b855334c4cac1c2b40467d8e2ecb7661b8f No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5593935 Auto-Submit: Yuly Novikov <ynovikov@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Charlie Lao 490c056a 2024-05-31T11:36:32 Vulkan: Defer texture data flush until data provided for all levels One of the major overhead with VkEvent is seeing with first frame where all textures are being specified. The immutable textures, we always immediately flush out the update as data provided for each level. This means one VkEvent is created and SetEvent is called per level. This CL delays the flush until data for all levels are provided, thus there is only one flush per texture instead of per level. With this CL asphalt_9 is no longer timeout on bots when VkEvent is enabled. There is also another benefit comes with this CL. On all desktop GPUs, ASTC format texture are falling back to RGBA8. We always stage a clear for the emulated format. That staged clear are able to be removed if data is provided later. Because of we flush out staged update when first level data is provided, all staged clear for the subsequent levels are also gets flushed out, losing the chance to be removed. This CL will allow all staged clears being removed. Bug: b/343976993 Bug: b/336844257 Change-Id: Ica731ea57db771b16966f4da92ccdc551ae93d81 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588816 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao a87ca02c 2024-05-31T11:18:52 Vulkan: change shouldUpdateBeStaged to shouldUpdateBeFlushed All usage of shouldUpdateBeStaged() is actually a negate if(!shouldUpdateBeStaged(...)) {doFlush();}. This CL changes shouldUpdateBeStaged to shouldUpdateBeFlushed to make it easier to read. The other change is that there is a distinction of a texture update must be flushed and update prefer to be flushed. So shouldUpdateBeStaged() logic has been split into two functions updateMustBeStaged and updateMustBeFlushed. shouldUpdateBeFlushed simply because it is either must be flushed or not mustBeStaged (proactively flush for performance reason). This CL is also a preparation for next CL. No actual behavior change is expected here. Bug: b/343976993 Change-Id: Icd9f57f43b6fb5761e9845cc6f27f9458073f905 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5588815 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 1a9a703b 2024-05-21T11:14:40 Vulkan: Add DeviceQueueIndex to Context/BufferHelper/ImageHelper This CL adds a utility class DeviceQueueIndex, which encapsulates queueFamilyIndex and the queueIndex into one integer value so that we can pass around to barrier function. vk::Context and BufferHelper and ImageHelper class now keeps mCurrentDeviceQueueIndex instead of mCurrentQueueFamilyIndex. For All contexts by default it gets the default queue from renderer (which is always the one corresponding to Medium priority). For ContextVk, when priority changes it update mCurrentDeviceQueueIndex to match new context priority. Bug: b/337135577 Change-Id: I62cc483cfdb3e974d38db074e671c57299300074 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5555903 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao b22cce5f 2024-05-21T10:55:27 Vulkan: Remove Renderer::getDeviceQueueIndex Renderer::getDeviceQueueIndex() returns queueFamilyIndex. There is a function that already returns mCurrentQueueFamilyIndex, so this function is now removed. This CL also renames ImageHelper::isQueueChangeNeccesary to isQueueFamilyChangeNeccesary Bug: b/337135577 Change-Id: I3cd9ded1414d1389e162aaa5399c231a987f871e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5553067 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Liza Burakova ead98ed9 2024-05-02T14:04:14 Implement basic texture upload. This change modifies ImageHelper's methods to upload textures to fix webgpu API calls, as well as fully implements uploading texture data via TextureWgpu::setImage for RGBA8 formats. Bug: angleproject:8457 Change-Id: I1c5be3d79ad996a709086ca7157cca6229a336ce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5398002 Reviewed-by: Matthew Denton <mpdenton@chromium.org> Commit-Queue: Liza Burakova <liza@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao a96e9197 2024-04-25T10:35:02 Vulkan: Add RefCountedEvent class and VkCmdSetEvent call This CL defines RefCountedEvent class that adds reference counting to VkEvent. CommandBufferHelper and ImageHelper each holds one reference count to the event. Every time an event is added to the command buffer, the corresponding RefCountedEvent will be added to the garbage list which tracks the GPU completion using ResourceUse. That event garbage's reference count will not decremented until GPU is finished, thus ensures we never destroy a VkEvent until GPU is completed. For images used by RenderPassCommands, As RenderPassCommandBufferHelper::imageRead and imageWrite get called, an event with that layout gets created and added to the image. That event is saved in RenderPassCommandBufferHelper::mRefCountedEvents and that VkCmdSetEvents calls are issued from RenderPassCommandBufferHelper::flushToPrimary(). For renderPass attachments, the events are created and added to image when attachment image gets finalized. For images used in OutsideRenderPassCommands, The events are inserted as needed as we generates commands that uses image. We do not wait until commands gets flushed to issue VkCmdSetEvent calls. A convenient function trackImageWithEvent() is added to create and setEvent and add event to image all in one call. You can add this call after the image operation whenever we think it benefits, which gives us better control. (Note: Even if forgot to insert the trackImageWithEvent call, it is still okay since every time barrier is inserted, the event gets released. Next time when we inserts barrier again we will fallback to pipelineBarrier since there is no event associated with it. But that is next CL's content). This CL only adds the VkCmdSetEvent call when feature flag is enabled. The feature flag is still disabled and no VkCmdWaitEvent is used in this CL (will be added in later CL). Bug: b/336844257 Change-Id: Iae5c4d2553a80f0f74cd6065d72a9c592c79f075 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5490203 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 2905a6a6 2024-04-19T15:09:41 Vulkan: Fix read pixel to cached non-coherent memory The bug here is that when we use cached non-coherent memory for image read, we must wait until DMA to finish before calling invalidate(). Otherwise CPU pre-fetching might end up populate the cache line again with old data between invalidate and DMA and causes CPU reads get the stale data from cache. This CL moves invalidate() call after we wait for copy to finish and removes requireCachedBitForStagingBuffer feature flag. Bug: b/335937565 Bug: b/315836169 Bug: b/324953979 Change-Id: Ie8a1854e17a5fe9c534c5102b2e0d51bd35c131a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5468597 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Amirali Abdolrashidi 4d317b52 2024-03-22T15:48:51 Vulkan: Add MSRTSS preferred usage for tex init The image create flag related to multisampled render to single- sampled was used when this feature flag was enabled. However, this could lead to some platforms allocating extra memory for the image, even if the image did not use this feature. In this change, a new feature is added regarding whether to prefer this flag from the start. If disabled, ANGLE will only use this bit for the texture if it is actually bound to an MSRTT framebuffer object (through FramebufferTexture2DMultisampleEXT()). * Added a new feature: preferMSRTSSFlagByDefault * If enabled, the MSRTSS is used for all image inits. * (TextureVk::initImage()) * Otherwise, it will create the image without the flag at first. * Added member to texture frontend to track if the texture has been bound to an MSRTT framebuffer. * mHasBeenBoundToMSRTTFramebuffer * During TextureVk::syncState(), if the image without the MSRTSS bit is bound to an MSRTT framebuffer, it is recreated using the MSRTSS flag. * Checked in respecifyImageStorageIfNecessary(). Bug: b/329911999 Bug: angleproject:8622 Change-Id: I5e7d43e3828ae272441d65b2be35d09b23b68f84 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5402978 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 914fe61b 2024-03-15T13:20:49 Vulkan: Rename RendererVk.* to vk_renderer.* Done in a separate CL from the move to namespace vk to avoid possible rebase-time confusion with the file name change. Bug: angleproject:8564 Change-Id: Ibab79029834b88514d4466a7a4c076b1352bc450 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5370107 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
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>
Roman Lavrov d4d34781 2024-03-14T13:03:55 Multisampling support check: sampleCounts > 1 and createFlags At least two drivers are returning VK_SUCCESS from vkGetPhysicalDeviceImageFormatProperties2 but also set sampleCounts to 1 which supposedly means no MSRTT Qualcomm reference device driver fails vkCreateImageView when enabling the multisampling bit one cubemaps which have sampleCounts == 1 Additionally, * include vk::GetMinimalImageCreateFlags() in createFlags - we don't get the cubemap bit without that * check both the image format and the additional view format (linear+srgb) as we set both of these when creating the image This fixes a bunch of cubemap and 3D tests on Qualcomm reference device Bug: b/329286011 Change-Id: I6d3ddea0cd997cf37b503050063f42d69723bd50 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372826 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Amirali Abdolrashidi 2ee295b4 2024-02-15T11:27:39 Vulkan: Add per-level image update tracker * Add a per-level image write tracker to ImageHelper. * It tracks the updates scheduled for different parts of the image. Within each level, it also tracks different layers, currently up to 64. * kMaxParallelSubresourceUpload renamed to kMaxParallelLayerWrites; moved to vk_helper header. * It is reset when a barrier is issued for the image. * Modified ImageHelper::recordWriteBarrier(). * Added isWriteBarrierNecessary(). * Now it checks the added writes for the image. It will no longer issue a barrier if the image is in the same layout and there is no write to a part of the image to which was previously written. * Added ReadImageSubresources to CommandBufferAccess. * It is used for layouts that allow both reading and writing to the image (including self-copy): * TransferSrcDst (used in CopyImageSubData) * ComputeShaderWrite (used in compute-based mipmap generation) * CommandBufferImageWrite -> CommandBufferImageSubresourceAccess * Updated onImageSelfCopy() args to include read subresource data. * Improves gpu_time for TextureUploadETC2TranscodingBenchmark perf test * Windows/NVIDIA: ~180609 ns -> ~62669 ns (~2.88x) * Linux/NVIDIA: ~157283 ns -> ~93360 ns (~1.68x) * Windows/Intel: ~72297 ns -> ~57153 ns (~1.27x) * Added a test to show that self-copy for a write-after-read works. * ArraySelfCopyImageSubDataWithWriteAfterRead * (ArraySelfCopyImageSubData covers RAW hazards; renamed) Bug: b/308455694 Change-Id: I5cef296d991ce6ec02792edc3ffc5cc4994831e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5301855 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Chris Forbes 6367f541 2024-01-25T10:16:04 Vulkan: supply YcbcrConversionDesc earlier Previously, the AHB import path would allow ImageHelper to build a bogus YcbcrConversionDesc (in initExternal) and then later overwrite it with what it wanted. The intermediate state was not necessarily valid, and could cause assertion failures and VVL errors. Instead, have ImageHelper clients provide the conversion they want upfront. In the non-external case, build an appropriate conversion for formats which need them, before delegating to initExternal. Bug: b/315387961 Change-Id: Icc8f561bb2de0289ceec56d41978b8c4651a47a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5232769 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Chris Forbes <chrisforbes@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi fad2adb2 2024-01-12T14:43:33 Vulkan: Fix importing external object and using as storage image The create flags used to create the imported object was 0. Later, when the texture was used as a storage image, TextureVk::syncState would recreate the image (losing connection to external object). This change makes sure the create flags include all the necessary create flags such that the texture can be correctly used as storage image. Bug: angleproject:8464 Change-Id: I6587b53b1c2819a11dec8f2d5a3a30c889a4c63f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5194064 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Stephen White a950f005 2023-12-06T18:58:35 Move compressed format validation to Vk backend. Add test to call glCompressedTexSubImage3D() from a pixel unpack buffer. This currently fails on OpenGL. Bug: angleproject:8449 Change-Id: I863b602e39a14878af8745ff62b408bdd879bc98 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5100348 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Shahbaz Youssefi b8ca8de4 2023-12-05T13:36:53 Vulkan: Don't crash when glCopyTexImage2D redefines itself The Vulkan backend marks a level being redefined as such before doing the copy. If a single-level texture was being redefined, it releases it so it can be immediately reallocated. If the source of the copy is the same texture, this causes a crash. This can be properly supported by using a temp image to do the copy, but that is not implemented in this change. Bug: chromium:1501798 Change-Id: I9dde99aa0b88bc7d5f582ff15772f70b36f424e0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5089150 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao b746dc3b 2023-11-29T17:40:53 Vulkan: Fix assertion when texture's min/mag filter disagree Camera CTS test testCameraGpuEncoderPath[1] is hitting assertion due to minFilter is NEAREST but magFilter is LINEAR. This CL use sampler's filter if min/mag agrees. Otherwise it uses default YCbCr chroma filter. The min/mag filter will still apply separately if VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT is set. If this bit is not set, we will force all of three filter to be the same anyway. Bug: b/302196568 Bug: b/308208067 Change-Id: I19007a107cfcea0f839cb66c236a70c003c43653 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5074826 Reviewed-by: Chris Forbes <chrisforbes@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya 8ae36a93 2023-11-14T10:11:51 Vulkan: Bugfix in isFastUnpackPossible Disallow fast unpack when there is a mismatch between the actual texture format and intended buffer (PBO or client buffer) format. Bug: angleproject:3777 Test: Texture2DTestES3.UnpackCompatibleFormatButDifferentType* Change-Id: I9ea9d9cdd5e1391acebb3d75d69437e27cfa90df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5029504 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9a5d75de 2023-10-30T11:59:19 Vulkan: Fix incompatible redefinition of cube faces The TextureVk::mRedefinedLevels bitmask tracked which levels are incompatibly redefined, greatly reducing the complexity of dealing with GL's mutable textures. It did not however take into account the fact that GL allows each cubemap face to be separately redefined (unlike 2D arrays, where all layers are defined together). This change turns the bitmask into an array of bitmasks. Previously, a single bit represented whether the level is incompatibly redefined. Now, elements of the array track the same information for each cube face. For non-cube-map textures, only element 0 is used. Bug: chromium:1494664 Change-Id: I69568d3da2391796bf5f01505861fee42c6c8924 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4986289 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 9298baa9 2023-10-20T10:26:00 Vulkan: Fix ImageTestES3.RenderToYUVAHB assertion The bug here is that for YUV resolve, we always set mTransience to YuvResolveTransient. And isImageTransient() returns true if mTransience != Default. And if image is transient, we will do unresolve, which is incorrect here. For nullColorAttachmentWithExternalFormatResolve() case, the image is actually not transient. This CL will only set transience to YuvResolveTransient if we need to create a transient color attachment. This CL looks at mImage->getExternalFormat() as the answer for isYUVResolve instead of rely on transience. Bug: b/223456677 Change-Id: I1bc176df22b0abc91d668a178e48d6b90eacbdd7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4959194 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Chris Forbes <chrisforbes@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi ba65feb4 2023-10-18T17:33:38 Vulkan: Limit mutable texture flush to one update In case there are many updates for a mutable texture, flushing it preemptively can reduce performance, especially if it is done repeatedly. * Added getLevelUpdateCount() to ImageHelper. * Previous mutable textures will now be flushed only if they have exactly one update per mip level/cubemap face (if defined). * This means that mutable textures with no data will also not be flushed. * Added unit tests for single-level texture flushing and situations with no updates or more than one update. Bug: b/285613719 Change-Id: I1592ecf502051a55ebfbb7fcd22577c9ce87bf43 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4953847 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 58ffa778 2023-10-11T09:41:23 Vulkan: Implement YUV_TARGET use VK_ANDROID_external_format_resolve This implements EXT_YUV_TARGET using VK_ANDROID_external_format_resolve extension. This CL is based on Chris Forbes's CL on android gerrit. Bug: b/223456677 Change-Id: Ieb6970a0787b0c2a72a76b208695a678d2c79e80 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4857459 Reviewed-by: Chris Forbes <chrisforbes@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev c54c2f81 2023-10-12T00:00:00 Sync border color on format updates When a texture is redefined, its border color should be resynced because of format-specific adjustments. Used memcmp for comparing ColorGeneric structs. Bug: angleproject:7969 Change-Id: If0e3e0bc7761c26dab6d00ab24462c789f5b90bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4935866 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Shahbaz Youssefi d919870f 2023-09-14T16:00:07 Vulkan: Do host image copy without holding the share group lock When an application uploads texture data such as with `glTexSubImage2D`, the share group lock is being hold while the data is being copied. Without VK_EXT_host_image_copy, this is a copy to a staging buffer, which may itself be expensive. With VK_EXT_host_image_copy, the cost of the copy is higher and so the lock would be held for a longer duration. This is particularly harmful to applications that spawn a separate thread for texture uploads (as the main thread is unable to make GL calls). This change moves the actual copy call to the tail of the call after the share group lock has been released. As a result: - The upload thread may be a bit slower, but - The copy does not interfere with the main thread, and - The copy does not interfere with the GPU's rendering work. As a result, games that load content seamlessly during gameplay should experience less stutter during texture uploads. Bug: angleproject:8341 Change-Id: I818c4389d4bf828847578da89414623e4b5e844e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4864290 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi 84c30b76 2022-07-12T20:42:00 Vulkan: Add single-level mutable texture flushing So far, the feature to flush mutable textures after switching to a new texture only applied to textures with at least two mip levels. In that case, the whole mip chain would be allocated for those textures. This change will add single-level texture flushing as well. However, the it should be optimized to prevent allocating the whole mip chain for only one defined level, and reduce memory usage. * Updated the code for previous texture flushing to include one-mip textures as well. * Added the condition that the mutable texture not be bound as an attachment for flushing. * Changed ImageMipLevels::FullMipChain to ::EnabledLevels in order to limit the number of allocated mips. * Removed ::FullMipChain from ImageMipLevels. Bug: b/285613719 Change-Id: Ibc76917345820c5a0991f700e9fb93e4cda6efae Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3763841 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 26148a02 2023-09-21T11:25:16 Vulkan: Minor cleanup of mPrevUploadedMutableTexture When texture is transit from mutable to immutable, we need to remove it from SharedGroupVk::mPrevUploadedMutableTexture if it is pointing to. Right now we did not clear the pointer, but rely on next texImage call to detect that mPrevUploadedMutableTexture is pointing to a immutable texture and then set it to new tetxure. This is a bit confusing since we only add a mutable texture to this mPrevUploadedMutableTexture pointer but at some point it becomes immutable. This CL changes to immediately reset the pointer when texture is respecified from mutable to immutable, and added assertion that mPrevUploadedMutableTexture is mutable. Bug: b/301289624 Change-Id: I97a11616887367cd4c2069419fe17d3dea052b50 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4879087 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 91ef1f3c 2023-09-08T16:39:53 Move buffer suballocation callers to ContextVk * Moved the following functions from BufferHelper to ContextVk. * initBufferForBufferCopy() * initBufferForImageCopy() * initBufferForVertexConversion() Bug: b/280304441 Change-Id: I890f4396b00b0c20feb44f0ad113c55924ce1014 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4854760 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b2e6a196 2023-09-11T15:27:20 Vulkan: Use VK_EXT_host_image_copy for texture uploads Of all the scenarios where host image copy may be useful, this is likely the most common case. There are numerous conditions for when the copy may be done on the host: - The image format must support it, - It must be unused by the GPU, - It must not have any pending updates (this can potentially be mitigated if needed), and - It must be in a host-copyable layout. However, many texture uploads are done: - To compressed formats, where support is highly likely, - On init, where: - the image is never previously used, - the image has no previous uploads - the image is in the UNDEFINED layout which satisfies the conditions above. As a result of this change, when the upload is done on the host, creation of a temp buffer is avoided which greatly reduces memory pressure (specially during app loading which is when most texture data is uploaded) and may even improve performance (due to avoiding a double copy). Testing the first 3 frames of the following traces with a SwiftShader implementation shows the amount of buffer allocated for staged uploads changed as such: - Black Desert: 185MB -> 65MB - Genshin Impact: 125MB -> 12MB - Asphalt 9: 138MB -> 0MB Bug: angleproject:8341 Change-Id: Id71dcc4a7a0f8b67960d2d283fe9d19ce7429a03 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4856676 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi e7418836 2023-08-16T14:25:52 Vulkan: Add context flushing as OOM fallback * As a new fallback for out-of-memory errors, if an allocation results in device OOM, the context is flushed and the allocation is retried. * Functions related to buffer/image allocations now return a VkResult value instead of angle::Result, which will be bubbled up to a higher level for safer handling. * The OOM is no longer handled at the level where the allocation happens, but is moved up to the context. * Added two functions to ContextVk for allocating memory for images and buffer suballocations, which also include the fallback options. * initBufferAllocation(): Uses BufferHelper::initSuballocation() * initImageAllocation(): Uses ImageHelper::initMemory() * Moved initNonZeroMemory() out of the following functions: * BufferHelper::initSuballocation() * Moved to ContextVk::initBufferAllocation(). * ImageHelper::initMemory() * Moved to ContextVk::initImageAllocation(). * Also moved to new function: ImageHelper::initMemoryAndNonZeroFillIfNeeded(). This function replaced the rest of initMemory() usages outside initImageAllocation(). * New macros for memory allocation * VK_RESULT_TRY() * If the output of the command inside it is not VK_SUCCESS, it will return with the error result from the command. * VK_RESULT_CHECK() * If the output of the command inside it is not VK_SUCCESS, it will return with the input error. * Added a test in which allocation would fail due to too much pending garbage without the fix on some platforms. The test ends once there has been a submission. * New suite: UniformBufferMemoryTest * Added a similar test for flushing texture-related pending garbage. * New suite: Texture2DMemoryTestES3 Bug: b/280304441 Change-Id: I60248ce39eae80b5a8ffe4723d8a1c5641087f23 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4787949 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi b185c3ea 2023-09-11T12:28:43 Vulkan: Add host-image-copy usage to images when optimal The change currently doesn't actually copy on host, but prepares the image for it. Bug: angleproject:8341 Change-Id: I4458712dca46ef9872020e158a3f902e94f5eb93 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4856146 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 6553225d 2023-09-11T11:33:19 Vulkan: Refactor image usage/flags support check logic The function that checks whether a format supports a specific usage is moved to ImageHelper. For VK_EXT_host_image_copy, Renderbuffer, AHB etc may also use this function. Bug: angleproject:8341 Change-Id: I6ebc06f97fd29e66aa8d43fcf045f51717d27864 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4856144 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 7c3c7b7b 2023-08-29T16:40:50 Add more test for GL_SRGB8 format And follow up changes from crrev.com/c/4819053 Bug: b/298037344 Change-Id: Ib27cc2fb8418d05d0b25f4abbdcf052d1f51c9ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4824046 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 519d330c 2023-08-28T15:41:18 Add GL_RGBX8_SRGB_ANGLEX and GL_BGRX8_SRGB_ANGLEX formats If app creates AHB with sRGBX format, and then create a EGLImage, Image::initialize() will retrieve the sized format from AHB, which is GL_RGBX_ANGLE, and then try to convert to sRGB color space. The bug here is that GetNonLinearFormat will pick GL_SRGB8 for all these formats :GL_RGB8, GL_BGRX8_ANGLEX, GL_RGBX8_ANGLE. This means that different AHBS with these three different format will end up createing a tetxure with same format which sRGB. I think the reason somone did it this way initially simply because there is no sRGB corresponding format available for BGRX8 and RGBX8. This CL adds sRGB internal version of these two formats, thus make it straight forward to pick the correct sRGB format. The other change here is for AHBs, right now we are always force mRequiredImageAccess to be Renderable. This actually workedaround the bug that mentioned earlier that we are picking the wrong format. Because of forced renderable, we end up with SRGB fallback to SRGBA. But external images should not fallback, we should use its existing format as is since it can be accessed via AHB interface directly. Bug: b/298037344 Change-Id: I6119c4015cc5bf0effdf0530cb756b6c4656c38f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4819053 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jeff Vigil 1bd45c4f 2023-07-17T14:18:53 Add tiling mode for GL_EXT_memory_objects Add set and get TexParameter for pName GL_TEXTURE_TILING_EXT Add test case to VulkanImageTest for import LINEAR memory object Bug: angleproject:8274 Change-Id: I4432093e41f45e3926a27e3dee00d48c0438cae5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4752793 Reviewed-by: Jeff Vigil <j.vigil@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: mohan maiya <m.maiya@samsung.com>
Mike Schuchardt be60f879 2023-06-28T17:29:45 Workaround for tex buffer type mismatch In the event of a mismatch between a texture buffer format (eg GL_R32F) and the shader sampler type (eg usamplerBuffer), adjust the tex buffer format to match the sampler (eg GL_R32UI). Test: angle_end2end_tests \ --gtest_filter="TextureBufferTestES31.TexBufferFormatMismatch*" Bug: b/233119699 Change-Id: I3461bcecabfe1d96be6350c43c15b32d35265b23 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4769137 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Mike Schuchardt <mikes@lunarg.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 7c69116f 2023-08-08T10:14:47 Vulkan: Fix data race with DynamicDescriptorPool Right now DynamicDescriptorPool::destroyCachedDescriptorSet can be called from garbage clean up thread, while simultaneously accessed from context main thread, and data race will happen and cause bugs. This can only happen when the buffer is not being suballocated. In this case, suballocation owns the bufferBlock and bufferBlock gets destroyed when suballocation is destroyed from garbage collection thread. If buffer is suballocated, the shared group owns pool which owns bufferBlocks and they gets destroyed from shared group with the share group lock. This CL avoids this race problem by release the shared cacheKey when the buffer is released, while we still had the shared group lock. Bug: chromium:1469542 Change-Id: Ic1f99e6b6083d63e4efb9c3f408921da62c006ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4761365 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mark Lobodzinski 0d886b62 2023-07-14T11:24:53 Check that MRTSS bit is supported by format Bit was added without checking ImageFormatProperties causing failures in some end2end tests. Bug: angleproject:8262 Test: Texture2DTestES3.TexStorage2D*/ES3_Vulkan* Change-Id: I7f9a4ee7c14610ee239ab1f86e4ba2c649ce76b3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4684549 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Mark Łobodziński <mark@lunarg.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 86e21fa2 2023-06-12T13:36:21 Vulkan: Refactor angle::Format depth/stencil checks Bug: b/246008627 Change-Id: If0a2992c5bd66adf27c6866aea04e54ba465a522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4608489 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi ec7e0778 2023-05-26T22:11:49 Vulkan: Track the emulated texture buffer in command buffer ... instead of the original texture buffer, because the emulated one is the one that is actually being used. This removes the necessity to issue a hacky barrier after the emulation is done. Bug: angleproject:8128 Change-Id: Ibc812894204cc1b2c6147817674de44e9c7ba2f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4571701 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Roman Lavrov ff110417 2023-04-21T15:16:03 Vulkan: Emulate RGB32 uniform texel buffers when unsupported Applies to: GL_RGB32F, GL_RGB32I, GL_RGB32UI When VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT is specified for these formats by the Vulkan driver, behavior is the same as before. When it is not speficied: previously ANGLE wouldn't enable GL_EXT_texture_buffer unless exposeNonConformantExtensionsAndVersions was enabled; now ANGLE always enables it and does the RGB->RGBA conversion (GPU) under the hood and tracks buffer content updates using the paths added for tracking this for Vertex Arrays. Bug: b/278585075 Bug: angleproject:8128 Change-Id: I4605719bf3f51c5a10c1a35ecae767833dcd45d7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4456498 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 80dd54f9 2023-05-17T22:16:59 Vulkan: Enable VK_EXT_image_2d_view_of_3d and set flag Based on a change by Yiwei Zhang <zzyiwei@chromium.org> Enabling the extension was missed from https://chromium-review.googlesource.com/c/angle/angle/+/3648586, and some implementations do rely on the feature enablement (e.g. RADV). This also fixes the VVL violations on satisfied implementations. Additionally, the VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT flag is always set on 3D images when this extension is supported; it is needed for both sampled and storage images, not just storage images. Bug: b/274478146 Change-Id: Ibc210275e2d39ac0c54d1ae4c2451a5402360972 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4544762 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Cody Northrop ec308b35 2023-05-15T15:03:10 Vulkan: Add feature to limit sample count to 2 This CL adds a feature called `limitSampleCountTo2`. Using it will have the Vulkan backend limit max samples to 2. Why 2? That's the minimum required in Vulkan to multisample without error. Here's an example validation error: vkCmdResolveImage: srcImage sample count is VK_SAMPLE_COUNT_1_BIT. The Vulkan spec states: srcImage must have a sample count equal to any valid sample count value other than VK_SAMPLE_COUNT_1_BIT. https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdResolveImage-srcImage-00257 Using a limit as opposed to forcing a value allows non-multisampling (sample count of 1) to continue working. To see how tests fare when the feature is set, see the following test results that force the value on: https://chromium-review.googlesource.com/c/angle/angle/+/4534098/4 Test: adb shell setprop debug.angle.feature_overrides_enabled limitSampleCountTo2 Bug: b/279498079 Bug: angleproject:8162 Change-Id: I1df2822709151e6084c32055b5aff444e0b10db5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4518562 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Greg Schlomoff <gregschlom@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Jason Macnak 5ab2fa96 2023-05-12T08:38:19 Vulkan: Move texture QFOTs to syncState() ... (and getAttachmentRenderTarget() which is syncState()-like for deferred clear) so that QFOTs are not actually scheduled until first use. SurfaceFlinger optimistically creates EGL images and textures for AHBs in case it does need them in the future. However, the images and textures may go unused. Prior to this change, ANGLE would create pending QFOT barriers while importing AHBs into EGL images and GL textures. However, SurfaceFlinger may not be doing any "real work" (other than repeatedly creating and destroying EGL images and GL textures) which would result in the command buffers containing the QFOTs being flushed. This can result in a large build up of unreleased memory (as the VkDeviceMemory would still be kept alive by the reference from the unflushed QFOT command buffer) and lead to the low memory killer nuking processes. Bug: b/282075554 Test: cts -m CtsOpenGLTestCases -t android.opengl.cts.GLSurfaceViewTest Test: adb shell dumpsys SurfaceFlinger Test: angle_end2end_tests --gtest_filter=ImageTestES3.AHBImportReleaseStress/ES3_Vulkan Change-Id: I7776abb2c6f834e96aa3926c26e77c53352ee561 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4527437 Commit-Queue: Jason Macnak <natsu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Hailin Zhang deab374e 2023-05-09T10:29:21 Vulkan: skip releaseStagedUpdates when not owned this is only a temp quick fix for b/279677207. may introduce rendering issue there are still other multi-thread race issues. the stagedupdates come from defer clears or empty entries. Bug: b/279677207 Change-Id: Idfd21120e5fe916d0d9d205dba2d71695085a5d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4518740 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Hailin Zhang <hailinzhang@google.com>
Roman Lavrov 2ce6d8df 2023-04-20T17:16:00 TextureVk calls onStateChange when releasing buffer views TextureVk::setBuffer releases buffer views and they don't get initialized unless a dirty bit is set. That works on the first draw call because Texture::Texture() sets DIRTY_BIT_IMPLEMENTATION in constructor, but when called twice mBufferViews remains unitialized causing mBufferViews.getView() misbehavior. Fix this by calling onStateChange when buffer views are released. As mBufferViews is only initialized conditionally for texture buffers, add a bool for tracking whether it is in the initialized state to avoid marking texture as dirty unnecessarily. Note that this isn't handled by signalDirtyStorage() inside Texture::setBufferRange because (in this test case?) there are no observers on Texture so onStateChange called from Texture is a no-op. Texture however observes its TextureVk implementation so onStateChange calls from TextureVk end up setting the dirty bit in Texture::onSubjectStateChange. Bug: b/278585075 Change-Id: I2b83160cdd89a086ed81e8412cd64d0aad930911 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4457147 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Amirali Abdolrashidi f2c5ce4e 2023-03-16T17:44:56 Re-enable mutable texture upload for one context It was observed that in some apps, mutable textures are uploaded in a context, but that context's outside RP command buffer is not flushed at all, resulting in invalid (noise) or incorrect textures. * Added isEligibleForMutableTextureFlush() to be used to determine whether onMutableTextureUpload() should be called. * Restricted the use of mutable texture upload to single-context share groups. * When the number of contexts becomes greater than one, the original context's outside render pass command buffer is flushed. * Added related tests. * Added a test to make sure that textures can be uploaded in one thread, and used for draw calls in another, with the help of a sync object. * Added a test to make sure that textures can be uploaded in the main thread, and used in a new thread. * Added a test in which a new context is created after mutable mipmap textures are defined. Bug: b/264143971 Change-Id: I66c0d8b04d39bb7244e5752aac0e46a0192f012e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4349156 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Igor Nazarov 233c128b 2023-01-17T19:21:58 Vulkan: Fix UBs when deleted attachment is used in a RenderPass. Problem: - "RenderbufferVk"/"TextureVk" with "mOwnsImage == false" used as RenderPass attachment. - "RenderbufferVk"/"TextureVk" deleted. - Owning resource is destroyed ("EGLImage" and all siblings / "EGLSurface"). - Crash (UB) may happen when ending RenderPass, flushing or executing commands. Fix adds tracking of "vk::ImageSourceID" value in "vk::RenderPassAttachment" - IDs of objects, that originally provide "vk::ImageHelper" images. This is necessary, because when using EGLImage, there may be multiple "TextureVk" objects with same "vk::ImageHelper", and need to call "finalizeImageLayout()" for the correct attachment. Bug: angleproject:8032 Test: angle_end2end_tests --gtest_filter=ImageTest*DeletedWhileInUse* Test: angle_end2end_tests --gtest_filter=PbufferTest.UseAsFramebufferColorThenDestroy* Change-Id: I50fdd9d6b6a9677adad2262373303b46de1dee4c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4296014 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Igor Nazarov b194c21a 2023-02-24T15:41:00 Vulkan: Enforce ContextPriority in ShareGroup and with EGLImage This CL enforces single Context Priority for all Contexts in a Share Group. This is necessary until Vulkan Semaphores will be used to automatically synchronize Resource access between Contexts. Contexts Priority updated when new Contexts is added to the Share Group. New Priority will be the highest among all ever existed Contexts (except if Priority is locked). When Contexts Priority changes, all flushed commands are submitted to the old VkQueue and semaphore is inserted into the new VkQueue. Currently opened RenderPasses and commands will not be flushed. When EGLImage is used in a Context, all Contexts in that Share Group locked (forever) to the Default Priority (Medium). This is done to simplify the implementation and because of the current limitations (lack of mutex protection across Context Share Groups). Notes: - the EGL_CONTEXT_PRIORITY_LEVEL_IMG will report initial priority. - below tests fail on G996B without this CL. Bug: angleproject:8039 Test: angle_end2end_tests --gtest_filter=MultithreadingTestES3.RenderThenSampleDifferentContextPriority* Test: angle_end2end_tests --gtest_filter=MultithreadingTestES3.RenderThenSampleInNewContextWithDifferentPriority* Test: angle_end2end_tests --gtest_filter=MultithreadingTestES3.RenderThenSampleDifferentContextPriorityUsingEGLImage* Change-Id: Ia6a2f0084d39168a58fd7ec33edc90ece9cead05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4289750 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
Kaiyi Li ac0a4a7d 2023-02-03T15:34:32 Add finer memory allocation type ... so that when we hit an OOM we have better understanding on why. Bug: b/266466279 Test: trigger a Vulkan OOM, see detailed allocation logging info Change-Id: I71c1ebd83e18ddb22e7abfd29a785bf4ad6454dc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4219365 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Kaiyi Li <kaiyili@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi d859ed39 2023-01-19T10:54:54 Vulkan: Disallow INPUT_ATTACHMENT usage on sampled image views Input attachments have similar requirements to draw attachments w.r.t swizzling. Bug: b/265647457 Change-Id: I7ff007b2b2ae2d8615b4b339bc621835888eebde Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4178023 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 626b10c1 2022-12-20T20:22:19 Vulkan: Add read/write depth/stencil layouts This CL only adds the layouts in the list, but does not use them. The layouts are renamed for consistency in this change. Bug: angleproject:7899 Bug: b/192477489 Change-Id: I47986c7252d32626e9f26c6670c0a4e3496fe0c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4116736 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 301ed545 2022-12-20T20:16:22 Vulkan: Pass context to layout getters In preparation for a change that optionally uses read/write depth/stencil layouts. Context is used to test for the supportsMixedReadWriteDepthStencilLayouts feature to know whether those layouts are supported or that a fallback must be chosen. Bug: angleproject:7899 Bug: b/192477489 Change-Id: I1453dc9d060453a3806ad0f261b94368fe01fb29 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4116735 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi fd75686e 2022-12-07T16:40:54 Vulkan: Fix EGL image queue change vs threads ANGLE records commands (a queue transfer and layout transition) when an external image is bound to a texture or a renderbuffer. If another thread starts using these resources, the recorded commands should have been flushed. The application is not required to synchronize between the threads in this case (or at least, there are applications that don't). Bug: b/261552549 Change-Id: I9f345316269baf5f10576dbef73b86924efd5c6f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4088903 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 02cc4cd5 2022-12-07T12:03:26 Vulkan: Remove ImageHelper::mImageAndViewGarbage This was introduced in crrev.com/c/3449450. At that time this is necessary, because we can not copy mUse for immediate view garbage collection. Now with recent work, mUse is copyable, we no longer need to accumulate the view garbage. They can be released immediately with a copy of image's mUse. Bug: b/261737134 Change-Id: Ic4393f8c4ee7c0e3be4669a0a557507c909a77ab Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4087323 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi fbd7d5fa 2022-10-17T17:20:09 Move thread pool classes to common/ In preparation for access by image_util files. Bug: b/250688943 Change-Id: I24777269a5071eae9a60f939635d01ed7246461f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3961454 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Hailin Zhang 836cc5e2 2022-09-09T22:06:22 Vulkan: add etc to bc compute transcoding. use compute shader to transcode etc format to bc format. Bug: b/243398683 Change-Id: Idbd0820a2df8d92fe690055dae2933bc559e9bfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3888501 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Hailin Zhang <hailinzhang@google.com>
Constantine Shablya ff7aa214 2022-09-29T19:56:28 GL_PALETTE* sampling Implement GL_PALETTE* formats by decoding them into a R8G8B8A8_UNORM image at load time. Test: angle_end2end_tests --gtest_filter="PalettedTextureTest.*" Bug: angleproject:7599 Bug: angleproject:7688 Bug: angleproject:7710 Change-Id: I94d51e2c480fcdd39f1a0ad241b311d3b4de1579 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863251 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Constantine Shablya <constantine.shablya@collabora.com>
Shahbaz Youssefi ff46a03a 2022-08-25T20:19:02 Vulkan: Use VK_EXT_multisampled_render_to_single_sampled Previously, the GOOGLEX version was used. The EXT version is favored now. Bug: angleproject:4836 Change-Id: Ie41d750b0729f0b3a14d1937fbf2dd386b65dd59 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3857993 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 4c6f7d8e 2022-08-10T15:21:57 Vulkan: Never stage update for EGLImage EGLImage could be shared between contexts in different share groups. If we stage any update in the ImageHelper for such EGLImage, then you may run into threading bugs when two textures are trying to flush out the staged update at the same time. There is no evidence showing we are running into this issue, but this CL forces this requirement. Bug: b/169868803 Change-Id: Ie26542225705ee4638ca1b3cf3cc5af499685137 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3824159 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Amirali Abdolrashidi f5de8e01 2022-08-05T10:23:37 Vulkan: Disable texture upload if texture sharing * Disabled mutable texture upload in cases of display-level texture sharing. Bug: chromium:1346808 Change-Id: Ia54496521d151ca7f273845fb40c56b5322470af Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812386 Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Lingfeng Yang bd82a5e4 2022-07-07T17:03:27 Vulkan: __samplerExternal2DY2YEXT-aware ProgramExecutableVk This CL incorporates __samplerExternal2DY2YEXT into the Vulkan objects involved in ProgramExecutableVk. Specifically, we need: 1. TextureVk to create and return a VkSampler imbued with identity conversion model, so we can create an immutable sampler from it. 2. Access to the identity conversion desc so that it can be traced in mImmutableSamplerIndexMap. Bug: b/223456677 Change-Id: Ia302226a8aa4a97d4a42f79c79ce47af3abec37c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3753294 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Lingfeng Yang 6c418f8c 2022-07-07T14:28:06 Vulkan: __samplerExternal2DY2YEXT-aware TextureVk This CL adds the ability for TextureVk to return an ImageView that is created with a VkSamplerYcbcrConversion object that uses an identity conversion model. This allows direct sampling of YUV values without RGB conversion, which is needed for __samplerExternal2DY2YEXT. Bug: b/223456677 Change-Id: Ie1d4e12375b7808a1f060747bc2d74baeda3fdea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3751889 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi d9763c60 2022-07-14T14:42:27 Disable mutable texture upload on Win/Intel devs After adding the mutable texture upload CL, we are experiencing some instances of flakiness in the form of lost context/device errors in the perf tests in Win/Intel cases. * Added mutableMipmapTextureUpload as an ANGLE feature, which is used to determine if onMutableTextureUpload() should be called. * It is disabled on Windows when using an Intel GPU. * Disabled the related unit tests on Win/Intel cases. Bug: angleproject:7308 Bug: b/202744914 Change-Id: Ib8c1bddc39cc4354468831a4a599a7c343d05f0e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3764460 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Charlie Lao 01092c48 2022-07-12T10:11:22 Vulkan: Destroy descriptorSet cache when shader image is destroyed Similar to texture descriptor set, this applies to images used as shader resource. When a texture is used in a shader resource descriptorSet, we record it. When texture is destroyed, we also destroy that shader resource descriptorSet cache. Bug: b/237686097 Change-Id: I475982fcec45535cc285a4aebca922d01efc7ed2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3758884 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Auto-Submit: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Amirali Abdolrashidi 32c5fd8a 2022-05-13T14:31:03 Reland "Vulkan: Flush texture updates more often" This is a reland of 8bb7c35c2159de2fa9e9a008679c692edd4402a6 * Added a condition to make sure the previous texture is not immutable when performing the optimization. * Fixed the issue where mipmap textures with unequal dimensions were not flushed. * Added related tests. * Added kEnableMutableMipmapTextureUpload, a flag to enable/disable the feature (enabled by default). Original change's description: > Vulkan: Flush texture updates more often > > * Added a pointer to the previous texture in ShareGroupVk so we can > flush the texture updates once we switch to a new texture. > > * We check if mip levels 0 and 1 are conformant in terms of > size, format and number of samples. > > * As a part of size check, we also check depths if the texture > target is either 3D, 2D array, or cube map array. For the former > two, they have to conform to mip scaling similar to width and > height. For the latter, the depth represents layer-faces and does > not change for mipmaps. > > * Added a test to ensure the pointer to the previous texture is > deleted when the corresponding texture is deleted, so the old value > is not accessed by a future mutable texture. > > * Added tests to make sure the mutable texture is uploaded with > the appropriate mip level attributes, and not uploaded in cases of > size/format inconsistencies, incompleteness, and no base level. > > Bug: b/202744914 > Change-Id: I9c2c1af87a8a49e75d3ad25523436b0cd51a7e81 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3606329 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Bug: b/202744914 Change-Id: I2bdbcd0182a57c18c1a18968396251a2e366731b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3646959 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Mark Lobodzinski fb3e2def 2022-05-24T15:47:01 Extend labelObject functionality Modify interface to fully support labelObject return codes. Fix issues with texture implementation, including handling deferred Vulkan object creation. Bug: b/229105865 Change-Id: I0c64b72dd0b54642fb643ee7f5ccbb2a134c6787 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3703184 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Mohan Maiya 81a69da6 2022-06-30T09:56:54 Vulkan: min/mag filters follow chroma filter value The Vulkan spec states that for those formats lacking support for VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT the min and mag filter must be equal to the sampler YCbCr conversion's chroma filter. Having the min/mag filters follow the chroma filter leads to simpler and more efficient code. Also update getPreferredFilterForYUV function to return existing filter value when preferLinearFilterForYUV feature is disabled. Bug: angleproject:7382 Bug: angleproject:7392 Tests: Texture2DTestES3YUV.TexStorage2DYuvFilterModes* Tests: ImageTestES3.SourceYUVAHBTargetExternalYUVSampleLinearFiltering/ES3_Vulkan Change-Id: I550ef8feede1dc6c3a0d8e32f790113e90ef7a4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739582 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Charlie Lao 723cc880 2022-06-10T17:55:54 Reland "Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid"" This is a reland of commit 551a26aeedbfd971d6199c8eddb433a4f4ff871c Original change's description: > Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" > > This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with > the fix for angleproject:7466. When DescriptorPoolhelper gets > release/destroyed, we ensure all sharedCacheKeys are destroyed. > > Original change's description: > > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > > > When a new texture descriptorSet is allocated, we store one reference of > > the cache key in ProgramExecutableVk and all TextureVks that it > > associated with. When any of the TextureVk is destroyed or its view > > destroyed, we immediately erase the descriptorSet from the cache and > > track GPU progress and free the descriptorSet when it's GPU completed. > > That way we delete the dead descriptorSet that will for sure never been > > reused ASAP so that its space is avialable for reuse. > > > > Bug: b/235523746 > > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > > Reviewed-by: Lingfeng Yang <lfy@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Ian Elliott <ianelliott@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: b/235523746 > Bug: angleproject:7466 > Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: I6b88b884841c5dbc625ee7e0c52c45af09dec199 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3741027 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com>
Ian Elliott 4b745c2b 2022-07-01T01:25:36 Revert "Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid"" This reverts commit 551a26aeedbfd971d6199c8eddb433a4f4ff871c. Reason for revert: Blink test failures at: https://ci.chromium.org/ui/p/chromium/builders/ci/WebKit%20Linux%20MSAN/15546/overview Original change's description: > Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" > > This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with > the fix for angleproject:7466. When DescriptorPoolhelper gets > release/destroyed, we ensure all sharedCacheKeys are destroyed. > > Original change's description: > > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > > > When a new texture descriptorSet is allocated, we store one reference of > > the cache key in ProgramExecutableVk and all TextureVks that it > > associated with. When any of the TextureVk is destroyed or its view > > destroyed, we immediately erase the descriptorSet from the cache and > > track GPU progress and free the descriptorSet when it's GPU completed. > > That way we delete the dead descriptorSet that will for sure never been > > reused ASAP so that its space is avialable for reuse. > > > > Bug: b/235523746 > > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > > Reviewed-by: Lingfeng Yang <lfy@google.com> > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Ian Elliott <ianelliott@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Bug: b/235523746 > Bug: angleproject:7466 > Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 > Reviewed-by: Ian Elliott <ianelliott@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: Icdde2752c462b7ebbb51d46fd35ce749b5caf377 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3739585 Reviewed-by: Ian Elliott <ianelliott@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Ian Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
Charlie Lao 551a26ae 2022-06-10T17:55:54 Reland "Vulkan: Destroy DescriptorSet cache when it becomes invalid" This is a reland of commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993 with the fix for angleproject:7466. When DescriptorPoolhelper gets release/destroyed, we ensure all sharedCacheKeys are destroyed. Original change's description: > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > When a new texture descriptorSet is allocated, we store one reference of > the cache key in ProgramExecutableVk and all TextureVks that it > associated with. When any of the TextureVk is destroyed or its view > destroyed, we immediately erase the descriptorSet from the cache and > track GPU progress and free the descriptorSet when it's GPU completed. > That way we delete the dead descriptorSet that will for sure never been > reused ASAP so that its space is avialable for reuse. > > Bug: b/235523746 > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > Reviewed-by: Lingfeng Yang <lfy@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746 Bug: angleproject:7466 Change-Id: I4413bec27ea0ca830010e2ca15036c2e667141c0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726964 Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuly Novikov f8690429 2022-06-27T13:50:44 Revert "Vulkan: Destroy DescriptorSet cache when it becomes invalid" This reverts commit 0779ccbcd427dcb00e53afa6385fb4e8e2377993. Reason for revert: crashes in blink_web_tests on linux-rel https://ci.chromium.org/ui/p/chromium/builders/try/linux-rel/1051045/overview Original change's description: > Vulkan: Destroy DescriptorSet cache when it becomes invalid > > When a new texture descriptorSet is allocated, we store one reference of > the cache key in ProgramExecutableVk and all TextureVks that it > associated with. When any of the TextureVk is destroyed or its view > destroyed, we immediately erase the descriptorSet from the cache and > track GPU progress and free the descriptorSet when it's GPU completed. > That way we delete the dead descriptorSet that will for sure never been > reused ASAP so that its space is avialable for reuse. > > Bug: b/235523746 > Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 > Reviewed-by: Lingfeng Yang <lfy@google.com> > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Ian Elliott <ianelliott@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/235523746, angleproject:7466 Change-Id: I7e5067de2f2add08af1f9804cc2e952238b2e942 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3726097 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Charlie Lao 0779ccbc 2022-06-10T17:55:54 Vulkan: Destroy DescriptorSet cache when it becomes invalid When a new texture descriptorSet is allocated, we store one reference of the cache key in ProgramExecutableVk and all TextureVks that it associated with. When any of the TextureVk is destroyed or its view destroyed, we immediately erase the descriptorSet from the cache and track GPU progress and free the descriptorSet when it's GPU completed. That way we delete the dead descriptorSet that will for sure never been reused ASAP so that its space is avialable for reuse. Bug: b/235523746 Change-Id: Ib1b9662a254eea5a3f410dc6d5d89fca6727a647 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700226 Reviewed-by: Lingfeng Yang <lfy@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 0a7cfa08 2022-06-16T16:24:54 Vulkan: Fix marking external images as renderable Bug: chromium:1266094 Change-Id: Ie8d7b82f859697530f6581c7109d773d6fa35d37 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3710690 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Charlie Lao 72e457fe 2022-06-03T15:36:01 Vulkan: Promptly destroy cached framebuffer when it becomes invalid When Texture gets respecified, the VkFramebuffer cache created out of it becomes invalid and will never possibly get used. Before this CL, we never clear such invalid framebuffer objects from the cache. This CL keeps a reference to the cache key in each attachment and will immediately destroy the cached VkFramebuffer object when one of the attachment has become invalid. Bug: b/234769934 Change-Id: Ib01f6dffe9211084b1ada340081daf905e3f1bef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3682164 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 0bc70e96 2022-06-10T22:27:04 Vulkan: Rename getShareGroupVk to getShareGroup + other miscellaneous clean up Bug: angleproject:7375 Change-Id: I25690860478a2fd181a67ce2b6cb4d7aac7dbaa7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3700197 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>