src/libANGLE/renderer/vulkan/TextureVk.cpp


Log

Author Commit Date CI Message
Charlie Lao 6c894e82 2021-11-04T14:49:41 Vulkan: Replace BufferVk::getBufferAndOffset() with getBuffer() Now BufferHelper class already keeps offset information. There is no reason for BufferVk to have that information any more. Bug: b/205337962 Change-Id: I6e014fb480bfcd5018ef9231b0fb87a50021f179 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3266147 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 55840e90 2021-12-03T15:24:00 Vulkan: Fix deferred flush vs UtilsVk Take the following scenario: 1. Draw 2. Flush (this is deferred) 3. Get image view (this is retain()ed) 4. Pass view to a draw-based UtilsVk function 5. Flush 6. Delete image view At step 4, UtilsVk may start a new render pass and use the image view from step 3. Since the flush at step 2 is deferred, it will be performed at this step, and so the serial of the image view is set to the previous submission. When step 4 uses this view, it doesn't retain it. Step 5 submits the new command buffer using this image view. At step 6, if the previous submission has finished, it will destroy the view immediately even though it's in use by the new submission. One solution could have been to make sure render pass closure originating from UtilsVk doesn't incur a flush. However, due to the current design where the render pass is immediately recorded in RendererVk's primary command buffer, it's possible that an unrelated context would perform the flush anyway. This change makes sure instead that the render pass is closed before any views are allocated/retained to be used by UtilsVk. Bug: chromium:1272266 Change-Id: I5bdefb34e03c368511c4c174cf7965fda158d2b8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3315976 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Lingfeng Yang 929c8ed4 2021-12-01T18:16:14 Vulkan: remove staged updates on storage set Previously we would allow staged updates to bigger versions of a texture to go through even if the texture was redefined via glTexStorage*. Bug: chromium:1262080 Change-Id: I9d861fed68d4a1fdcd0777b97caf729cc74c595e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3312718 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Alexis Hetu 7817761a 2021-11-23T22:47:44 Vulkan: Use the correct format when binding a pBuffer. Vulkan would get the texture format from the pBuffer's config but some pBuffer types use different formats which are queried with getBindTexImageFormat. This CL also removes nativeSizedExternalFormat. nativeSizedExternalFormat was only used when the format/type is GL_RGB/GL_UNSIGNED_BYTE. This is now obsolete since the real fix was the pBuffer fix mentioned above, so this CL cleans up the now unnecessary code. Bug: angleproject:4369 Bug: chromium:1237561 Bug: chromium:1099979 Change-Id: Ibfedea60d10856831e3a1975ac20ae5eb6a73786 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3298352 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexis Hétu <sugoi@chromium.org>
Mohan Maiya 44d0ef69 2021-11-25T14:37:38 Vulkan: Enhance SamplerDesc for YUV formats In order to uniquely identify a VkSamplerYcbcrConversion, having just the format is insufficient. We need to account for conversion model and color component range. Refactor SamplerDesc by encapsulating YUV related fields into its own YcbcrConversionDesc. Bug: angleproject:6732 Test: Texture2DTestES3.*Yuv*Vulkan Change-Id: I23114c50646232dccde988a52b0649778ad72a90 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3301899 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 6fe13477 2021-11-11T00:47:14 Vulkan: Add external's pNext to ANGLE_external_objects_flags ANGLE was chaining VkImageFormatListCreateInfoKHR to VkImageCreateInfo::pNext to support sRGB extensions. For external images, it was unknown whether that was valid because there was no way to know if external used an identical chain of pNexts. This was causing a discrepancy between images created by Chrome and those created by ANGLE as part of an import. This change updates ANGLE_external_objects_flags to take in the pNext chain external has used to create the image so ANGLE could create the image identically. Bug: chromium:1266094 Change-Id: I479b9e7ff39d437425dc91c79834880749766f99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3274177 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Peng Huang <penghuang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dbc0c646 2021-11-06T01:09:26 Vulkan: Output the reason for RP closure in command buffer To make it easier when viewing the command buffer in a graphics debugger, this change inserts a marker just before closing the render pass that specifies why the render pass was closed. Bug: angleproject:2472 Change-Id: I862e500cd58332d6e199c853315c560fe6a73dc2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3265609 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d2d3a546 2021-11-11T12:22:04 Vulkan: Write perf warnings in command buffer It's much easier to understand what command the perf warning refers to when it's visible in the command buffer using a graphics API debugger. This change creates ANGLE_VK_PERF_WARNING which gives the warning both to the application (through ANGLE_PERF_WARNING) and inserts it in the command buffer. Bug: angleproject:2472 Change-Id: Ie84feed53eca5cda93e1f2bc653fcbf9bcd57b56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3275839 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 96b587b0 2021-11-10T15:10:09 Vulkan: Fix rendering to RGB external images Based on the provided usage flags, the texture's image access mode is updated to be renderable. Bug: chromium:1266094 Change-Id: I5d092a2786fc12537ef0ad1f224137cc1fd8f864 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3270980 Reviewed-by: Craig Stout <cstout@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 0fcad626 2021-11-09T14:02:08 Vulkan: Fix edge case with changing base level. Bug: chromium:1267624 Change-Id: I36b983fdbbb258454215abe827837517df5a5aff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3270971 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao bae19e06 2021-10-26T13:35:57 Vulkan: Avoid unnecessary wait if mapBufferRange indicates read only When we call BufferVk::mapRangeImpl(), both from internal code paths for data reads or due to glMapBufferRange call, we are not passing the access bit to the call. This CL passes the proper access bits to the call and only wait for GPU writes to finish if access is for read only. This CL also adds access bitfield to the BufferVk::mapImpl() API and have various callers pass in the proper access bits as well. Bug: b/203582620 Change-Id: Ica8493c902dbd7b15996266c81ce0fd4dbfc2520 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3245487 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Tim Van Patten 9ac2409e 2021-10-26T00:55:06 Reland "Vulkan: Flush descriptor set updates during flush*Commands()" This reverts commit 420e77a64e890ad4c585d72789ca59501be3ac75. Reason for revert: The crash is in ProgramExecutableVk::getOrAllocateShaderResourcesDescriptorSet(), which is unrelated to this change. Creating a CL to reland this (the reland button is failing), to try and investigate further. Original change's description: > Revert "Vulkan: Flush descriptor set updates during flush*Commands()" > > This reverts commit 02b73c2fd738b237f1ab3ecd400feec222903a48. > > Reason for revert: Causes test to crash on Linux/Intel: anglebug.com/6591 > > Original change's description: > > Vulkan: Flush descriptor set updates during flush*Commands() > > > > The intent of this CL is to reduce the number of descriptor set updates > > by delaying the work until all of the GLES commands that could trigger a > > re-update have been performed and the command stream is being flushed. > > To achieve this, flushDescriptorSetUpdates() is being moved from > > setupDraw()/setupDispatch() to > > flushRenderPassCommands()/flushOutsideRPCommands(). > > > > This change also exposed an issue where the BufferView handles were not > > being preserved until flushDescriptorSetUpdates() was called. To resolve > > this, flushDescriptorSetUpdates() is also being called during > > BufferViewHelper::release() before the BufferView memory is released. > > > > Bug: angleproject:5706 > > Change-Id: I61e19af9c0fac891aa2115d72391459b80d22f19 > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939385 > > Reviewed-by: Charlie Lao <cclao@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Commit-Queue: Tim Van Patten <timvp@google.com> > > Bug: angleproject:5706 > Bug: angleproject:6591 > Change-Id: I9d1ee3fcb3d1aebc86e60896e0065cab847a92b4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233901 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5706 Bug: angleproject:6591 Change-Id: Ibc7e934b82e6cd90e766f43135583f7c45acfe39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3244024 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 420e77a6 2021-10-20T15:02:45 Revert "Vulkan: Flush descriptor set updates during flush*Commands()" This reverts commit 02b73c2fd738b237f1ab3ecd400feec222903a48. Reason for revert: Causes test to crash on Linux/Intel: anglebug.com/6591 Original change's description: > Vulkan: Flush descriptor set updates during flush*Commands() > > The intent of this CL is to reduce the number of descriptor set updates > by delaying the work until all of the GLES commands that could trigger a > re-update have been performed and the command stream is being flushed. > To achieve this, flushDescriptorSetUpdates() is being moved from > setupDraw()/setupDispatch() to > flushRenderPassCommands()/flushOutsideRPCommands(). > > This change also exposed an issue where the BufferView handles were not > being preserved until flushDescriptorSetUpdates() was called. To resolve > this, flushDescriptorSetUpdates() is also being called during > BufferViewHelper::release() before the BufferView memory is released. > > Bug: angleproject:5706 > Change-Id: I61e19af9c0fac891aa2115d72391459b80d22f19 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939385 > Reviewed-by: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Tim Van Patten <timvp@google.com> Bug: angleproject:5706 Bug: angleproject:6591 Change-Id: I9d1ee3fcb3d1aebc86e60896e0065cab847a92b4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3233901 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Tim Van Patten 02b73c2f 2021-07-14T15:45:47 Vulkan: Flush descriptor set updates during flush*Commands() The intent of this CL is to reduce the number of descriptor set updates by delaying the work until all of the GLES commands that could trigger a re-update have been performed and the command stream is being flushed. To achieve this, flushDescriptorSetUpdates() is being moved from setupDraw()/setupDispatch() to flushRenderPassCommands()/flushOutsideRPCommands(). This change also exposed an issue where the BufferView handles were not being preserved until flushDescriptorSetUpdates() was called. To resolve this, flushDescriptorSetUpdates() is also being called during BufferViewHelper::release() before the BufferView memory is released. Bug: angleproject:5706 Change-Id: I61e19af9c0fac891aa2115d72391459b80d22f19 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939385 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten eb1d2474 2021-10-04T20:23:26 Vulkan: Add R8G8B8_UNORM to vk_format_map.json The map of R8G8B8_UNORM -> VK_FORMAT_R8G8B8_UNORM is missing from vk_format_map.json. This leads to attempting to get format bits for angle::FormatID::NONE / VK_FORMAT_UNDEFINED. This CL adds R8G8B8_UNORM to vk_format_map.json, so devices that support it, like ARM, can use it. This allows those devices to import AHBs created with R8G8B8_UNORM. This CL also adds some additional ASSERT() and UNREACHABLE() calls to catch missing formats sooner. This allows the EGL tests to pass on ARM devices, but the tests are still skipped due to Qualcomm not having the necessary support for optimal tiling. Bug: angleproject:6277 Test: dEQP-EGL.functional.image* Change-Id: I41b7ead97a10ae80be4b6048d36d0d85ad71784f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3204152 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f3334d03 2021-09-30T23:44:54 Vulkan: Fix importing layered AHBs Bug: angleproject:6475 Change-Id: Iceb0880cadc54552d3f01593d2e12088cafa10cc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3198733 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 6793d50e 2021-10-06T15:48:55 Vulkan: Remove ImageHelper::setFirstAllocatedLevel and Add assertion ImageHelper::mFirstAllocatedLevel is set via ImageHelper::initExternal. There isn't a good use to set the mFirstAllocatedLevel when mImage is invalid, and semantically it is wrong to try to get mFirstAllocatedLevel or format while its storage is invalid (i.e., not allocated). This CL removes ImageHelper::setFirstAllocatedLevel() API all together and added assertion that image is valid when ImageHelper::getFirstAllocatedLevel and getActualFormat and various other get APIs whose value are set during initExternal call. Bug: angleproject:6532 Change-Id: I9c97f488b3e959443fec632540e7f0906a49dc13 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3209838 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 185e48a7 2021-10-06T18:53:08 Vulkan: Make TextureVk::mRedefinedLevels bitmask of gl::LevelIndex We have gl::LevelIndex and vk::LevelIndex. gl::LevelIndex means level index at OpenGL concept and is used in TextureVk code. vk::LevelIndex means already adjusted with baseLevel and is used by ImageHelper object. This mRedefinedLevel is gl::TexLevelMask type, but it actually is a bit mask of vk::LevelIndex right now. This is inconsistent and confusing. This CL changes it to bit mask of gl::LevelIndex to be consistent with the namespace of "gl". Bug: angleproject:6532 Change-Id: Ic88e373f70d3bd3e3fea676765c82fd0941e245c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3210726 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 6cb599f9 2021-10-06T13:07:27 Vulkan: Change dest to dst for consistency Cleanup only, no functional change. dst aligns better with src. Bug: angleproject:6502 Change-Id: I69821b1aae50a7ce647c7cc876468b6de309eec8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3208514 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Charlie Lao a52f4032 2021-09-24T15:31:26 Vulkan: Skip releaseImage call when image is invalid releaseImage is only useful if image is already valid. Otherwise it is wasting CPU cycles to go through bunch of release calls that essentially doing nothing. Bug: angleproject:6014 Change-Id: I550b12bdc566cca699f6bf6662d176a01b2bce2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3183800 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao b600d212 2021-09-24T15:05:34 Vulkan: Consolidate calls to respecifyImageStorageAndLevels respecifyImageStorage() calls respecifyImageStorageAndLevels with the same arguments that respecifyImageStorageAndLevels() could easily get from the mImage and TextureState. This CL get rid of respecifyImageStorageAndLevels and only uses respecifyImageStorage(). Bug: angleproject:6532 Change-Id: I388af1f1db0e3ce6c77475a03667fca451ab7013 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3183399 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 34ee74be 2021-10-06T15:00:49 Vulkan: Remove unused imageBaseLevel from TextureVk::setImageHelper We used to store baseLevel in ImageHelper object. Since then we have removed baseLevel from ImageHelper to make ImageHelper object able to be immutable for immutable textures. During that effort, the usage of baseLevel has been switched to retrieve directly from TextureState directly. This CL removes imageBaseLevel from the call. Bug: angleproject:4999 Change-Id: I6ea8a651ee81bebc8529ffaaaba22c3ce4f8ac90 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3209831 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi a097ee2e 2021-09-27T15:18:02 Vulkan: Fix clearing external images with emulated format External images may already have data, and clearing them due to their format being emulated is incorrect. This change makes sure that only the emulated channels are cleared. The RGBXDataPreservedAHB test is based on one contributed by Jason Macnak <natsu@google.com>. Bug: b/192315789 Change-Id: Ibc8953fdac356f2a62a5b46512a51e1916b4a1b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3193416 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Tim Van Patten 57d59e83 2021-09-07T17:41:11 Vulkan: Add ResourceWrite to track Read and Write Access vk::Resource currently only tracks accesses in general, not which type of access is being performed. This CL adds the new class ResourceWrite to track whether the access is a Read or Read/Write access and when the access completes. This allows a follow-on CL to know when a buffer is being written to by the GPU or if the GPU is only reading from a buffer. Tracking write accesses to buffers is required when attempting to "Ghost" (duplicate) GPU-read-only buffers to prevent breaking the render pass when the CPU maps the buffer memory. Bug: angleproject:5971 Test: ComputeShaderTest.ImageBufferMapWrite Change-Id: I965e3e75730719ccce77334744ae4feae33c6101 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3146319 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Jamie Madill 9184973f 2021-07-21T08:28:30 Add GetCompressedTexImageANGLE to ANGLE_get_image Includes front-end support for reading back compressed texture images. Back-end support is incomplete and will be implemented in a future CL. CL authored by cnorthrop@google.com. Bug: angleproject:6177 Change-Id: I1482b15e5ffec6120f09f51b2718cdbef07c93c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3163359 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Charlie Lao ca70b636 2021-09-09T16:34:34 Vulkan: Reformat staged buffer data using CPU When a R4G4B4A4 texture is attached to FBO, we dynamically choose a new format to fallback to R8G8B8A8 on some GPU that can't render to R4G4B4A4. During this format switch, if we already have a staged buffer update with old format, we must reformat the data to new format. Right now this is done by initImage and flush out staged update and read back and restage. This is very inefficient. This CL adds a new code path that just uses CPU to convert the staged data from old format to new format. Bug: b/198788068 Change-Id: I9b763dafdc9431d4fbbc26169c156b09ac13c815 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3153055 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 0a592aa4 2021-09-01T19:00:24 Vulkan: Add warning when a fallback texture format is used. Emit a performance warning message when a fallback texture format is been used for sampling. Emit a performance warning when we have to do data copy during format fallback transition. Bug: b/196456356 Change-Id: Ifbe66069e506597dbacfefda10e699a8e9f320d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3139239 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 856a0e03 2021-09-01T18:09:14 Vulkan: Make vk::Format from struct to class With all the recent changes that there are two actualImageFormatIDs, retrieve the actual format requires pass in a renderable boolean. And the vertex format also has a similar requirement to the real format may differ depends on if it is compressed or not. This struct no longer safe to expose the underline data members directly. This CL turns it into a class and expose the actual format via method that requires renderable or compressed boolean. Bug: b/196456356 Change-Id: Ie2f8308cc408bde1b0787e0b392e143187cc4425 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3139236 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 8ea87a67 2021-08-17T18:46:36 Vulkan: Avoid texture format fallback when possible Some texture formats are not renderable on some hardware. For example, R4G4B4A4 are not renderable on nvidia and not blendable on ARM. R5G5B5A1 are also not blendable on nvidia. Right now when we generate format table, we are being most conservative, picking an actual format that is always renderable and blendable. This means when R4G4B4A4 is used on one of these GPUs, we are always falling back to R8G8B8A8 regardless if the texture is actually being used as color attachment or not. This CL adds a actualRenderableImageFormatID field in vk::Format. Initially we will pick actualImageFormatID which only ensures texture sample capability. If later on the texture is being attached to FBO, then we will switch to actualRenderableImageFormatID and do data copy if necessary. This way we save memory and reduce texture bandwidth for most usage of these textures. For renderBuffer and surfaces and EGLImages, we always pick the renderable textures. Bug: b/196456356 Change-Id: I02eec3365c2a317b0d1bad6dbdc3e741114c5bba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3104514 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao ad09f98c 2021-09-03T18:20:01 Vulkan: Simplify TextureVk::initImage() call. This CL moves the logic that check if immutable texture or not and decide what levels should be allocated from callers in various places to TextureVk::initImage() to simplify the code a bit. Bug: b/196456356 Change-Id: Ida31a5a06402cc627d0493032f8424baae3e7264 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3141974 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Cody Northrop 5015bf85 2021-09-02T10:47:21 GetTexImage: Fix image initialization The extra checks were preventing texture updates from flushing, triggering the following assert in readPixels during capture: ASSERT(!hasStagedUpdatesForSubresource(levelGL, layer, 1)); Test: Fortnite MEC Bug: b/180418810 Bug: angleproject:5658 Change-Id: If4209cbe9587c4222e3bf93d1551e454b1d8248d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140096 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 50391b81 2021-09-01T16:27:36 Vulkan: Change TextureVk's vk::FormatID usage to angle::FormatID This is preparation change to replace some vk::Format usage in TextureVk.cpp to angle::FormatID so that they will not get affected by the next CL which will change how you retrieve actualImageFormatID from vk::Format. Bug: b/196456356 Change-Id: I30ad8314da917e7a9c8a642ccbdc6facc44f9719 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3139233 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao 550bf6ce 2021-09-01T13:09:12 Vulkan: Keep track of data format for staged updates for ImageHelper We stage updates from a buffer or another ImageHelper object, even when the destination ImageHelper object has not been initialized (i.e, format is unknown). And we do not track what data format the staged updates are in. Right now this works because the format we end up choose will always the same as the staged data. But this may not be true in the future. This CL remembers the data format of the staged update and assert at flushStagedUpdate time that the format we staged is the same as the ImageHelper's actual format. Bug: b/196456356 Change-Id: Ib8124a47ca31f7782b9ec89c1fcb7e3000c747b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3137419 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 58ec0fbf 2021-09-02T11:47:48 Vulkan: Remove the forceCPUPathForCubeMapCopy workaround This workaround has been disabled since https://chromium-review.googlesource.com/c/angle/angle/+/2594707 Bug: angleproject:2822 Bug: angleproject:3055 Change-Id: Ie9cc12c7616cd9e1801dbd92e21822c63f4d0bef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3140214 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 8ce42fd3 2021-08-24T17:33:05 Vulkan: Remove mFormat from ImageHelper The only thing we need from ImageHelper::mFormat is to get intendedImageFormat. This CL simplifies the interface by simply pass in intendedImageFormat into initExternal so that ImageHelper class will not need to reference to vk::Format at all. Bug: b/196456356 Change-Id: I5fcb0d7226cae44dc865a7cfb0149d74e5756f11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3111451 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 11fd7a14 2021-08-18T13:46:30 Vulkan: Pass actualFormatID directly into ImageHelper::initExternal Since vk::Format alone won't tell us what the actual format is. This CL let caller pass actualFormatID directly into ImageHelper::initExternal() call and let ImageHelper object keeps record of mActualFormatID without need to refer to vk::Format object. Bug: b/196456356 Change-Id: I3c47caae7f946805a32f57519348528f8d47cf4a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3104513 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill a8f1a916 2021-08-26T17:53:56 GetTexImage: Remove syncState calls & add early error exit. Instead of calling syncState to force the Vulkan staged textures to flush, we ensure the Texture is marked initialized by sending a message up to the Texture when there are no more pending updates. Also adds handling for textures with extra mips. Instead of crashing, we now return an error with a warning. Also adds a test with a texture that has extra (outside the mip chain) defined levels. Also adds a test and handling for empty texture levels. This should lead to more consistent behaviour in the trace test serialization logic, where often the prior logic would behave differently depending on if GetImage was called from MEC or from the serialization code. Also updates the generateMipmap logic to syncState after calling initializeContents so the updates happen in the correct order on Vulkan. Bug: angleproject:5133 Bug: angleproject:6336 Change-Id: Iab1c2a22b9f9435e7f3c0f870c86bbed3460482e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3123168 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao ab1a5dbe 2021-08-17T15:42:43 Vulkan: Use angle::Format for ImageViewHelper class ImageViewHelper class only needs actualFormatID. Instead of passing vk::Format to ImageViewHelper, this CL passes actualImageFormatID to the ImageViewHelper API to further reduce the exposure to vk::Format where getting actualImageFormatID needs extra information (renderable or not) Bug: b/196456356 Change-Id: I26afc1f37980a3b2419a66510cf720d79ad0a111 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3101928 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao e98539f0 2021-08-17T14:42:26 Vulkan: Add ImageHelper::getIntendedFormatID() This adds helper API to return intendedFormat directly from ImageHelper object instead of vk::Format, to make API symmetrical. It is also necessary. It is also needed in some places where we no longer have access to vk::Format any more due to refactoring. Bug: b/196456356 Change-Id: Ie0502793623138ded28c3f01320c57ffea2d93df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3101925 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Charlie Lao cf24931a 2021-08-17T10:48:23 Vulkan: Add ImageHelper::getActualFormat() This is preparation for future CLs. In the future vk::Format may not tell you what actual format is. This CL adds a new method of ImageHelper::getActualFormatID() and ImageHelper::getActualFormat() so that we can use these two APIs and avoid using vk::Format, thus reduce reliance on vk::Format. Bug: b/196456356 Change-Id: Ic50e664e033feb5e066f40269c33cffe96024172 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3100319 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Charlie Lao 24a1650a 2021-08-23T18:48:24 Vulkan: set TextureVk::mImageUsageFlags for extern mem backed texture For external memory backed texture, mImageUseFlags are never set. Not exactly sure what harm will cause, but I am seeing when TextureVk::syncState is called we are incorrectly recreating storage due to we think there is usage flags change. The other fix here is the test VulkanExternalImageTest.ShouldClearOpaqueFdWithSemaphores is not using deviceMemorySize and causing VVL to complain. Bug: b/197578056 Change-Id: Icca89de973ee3cb93b7e0fe8083ae674df81cae8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3115333 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Jamie Madill c61fd919 2021-08-25T08:29:55 Fix array texture readback with GetTexImage. According to the desktop GL specs, GetTexImage retrieves entire mips of a texture for 2D array and cube array textures. The prior code was only retrieving one layer and didn't have any way to get the layers other than layer zero. Fix this by using similar logic to how we read back 3D textures. Also adds regression tests to GetImageTest. Bug: angleproject:5133 Bug: angleproject:6132 Change-Id: I8b22bc10ac1fdfe6389ac309450b92681f087cda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3118266 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 1be6d1d4 2021-08-24T10:03:13 Capture/Replay: Sync textures before serialization. This ensures we get a consistent value for the texture init status and pixel data between when we capture the trace and when we run the replay. Because syncState is normally only called for textures that are currently bound for sampling, and here we are calling syncState when texture are not (and may never be) bound, we have to rely on a few extra checks to ensure we return a correct result. Bug: angleproject:5133 Change-Id: I2ca76743e8a6550a730dc55d935ba69d88679589 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3118265 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jeff Vigil 6136620b 2021-03-25T15:43:06 Reland "EGL: GLES: Implement GL_EXT_protected_textures" This is a reland of 6210a9b34a721df2c84cf69170ad9bf7ba40e4aa This removes changes in gl backend. Original change's description: > EGL: GLES: Implement GL_EXT_protected_textures > > Implement EGL_EXT_protected_content Images > Add protected member to Images and Textures > Add error when creating objects if not supported or > does't match native buffer > When creating siblings pass protected state > Add extension caps > Add Validation > Add GetTexParameter and SetTextparameter > Add protected to Texture and state > Expand tests for images and textures > > Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest > > Bug: angleproject:3965 > Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: Id36d697c53afc0f0dadf92bda4565f9157f4fc2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076825 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill c408926f 2021-07-22T12:00:59 Revert "EGL: GLES: Implement GL_EXT_protected_textures" This reverts commit 6210a9b34a721df2c84cf69170ad9bf7ba40e4aa. Reason for revert: Suspected for breaking ANGLE->Chrome roller. Bug: angleproject:6204 Original change's description: > EGL: GLES: Implement GL_EXT_protected_textures > > Implement EGL_EXT_protected_content Images > Add protected member to Images and Textures > Add error when creating objects if not supported or > does't match native buffer > When creating siblings pass protected state > Add extension caps > Add Validation > Add GetTexParameter and SetTextparameter > Add protected to Texture and state > Expand tests for images and textures > > Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest > > Bug: angleproject:3965 > Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:3965 Change-Id: Ia3ef260a17097b474189ccad5b235a9db99ee00b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3043889 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Jeff Vigil 6210a9b3 2021-03-25T15:43:06 EGL: GLES: Implement GL_EXT_protected_textures Implement EGL_EXT_protected_content Images Add protected member to Images and Textures Add error when creating objects if not supported or does't match native buffer When creating siblings pass protected state Add extension caps Add Validation Add GetTexParameter and SetTextparameter Add protected to Texture and state Expand tests for images and textures Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jeff Vigil d2b659f9 2021-03-25T15:40:58 EGL: implement EGL_EXT_protected_content Context Add Validation check to Contexts and Surfaces Add Vulkan protected memory features and properties Add protected member to Surfaces and Contexts Implement hasProtectedContent in Vulkan Add QueueFamily helper, extent DeviceQueueMap Protected Swapchains always on for Android Add EGLProtectedContentTest Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: I9352b1e594f71bb4e89cee7137a468940d186b1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2800413 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Cheryl Wei 45965e72 2021-06-17T10:21:26 Vulkan: Translate border color's channel by image view format ANGLE implementes some formats as other formats,such as ALPHA8 to R8, this caused some tests failed due to missing border color's channel translation,this change add a new textureBorderLoadFunction to translate channels of border color by image view format. Bug: angleproject:6046 Change-Id: I94ce719b4db3724ffd3dc862b51a412b5d9f3cce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2972328 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 971ba359 2021-06-23T16:45:33 Add angle::BitMask for creating bit masks angle::BitMask(n) implements the common pattern of angle::Bit(n)-1. Bug: angleproject:6048 Change-Id: Icd56ef1504804add59d0804a7249b3035c96f9c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2984099 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 977a28f3 2021-06-22T12:30:07 No-op glGenerateMipmap on zero-sized textures The spec says: > Otherwise, ... if any dimension is zero, all mipmap levels are left > unchanged. This is not an error. Bug: chromium:1220250 Change-Id: I45e007c1f8e9b80f405d3d096eb896a7246f7c8e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2979853 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 5b314268 2021-06-15T17:37:45 Vulkan: Support OVR_multiview and OVR_multiview2 Multiview is supported in Vulkan simply by specifying the number of views in the render pass, and creating the appropriate image views. A number of changes to the way image views and render targets are stored are made to support those that don't cover the entire range of layers. One particular detail that is not implemented in this change is the use of queries in combination with multiview. Vulkan specifies that N queries are actually produced (N being the number of views) which must be summed by the application, but this is not currently done. Bug: angleproject:6048 Change-Id: I1d4a9894c232d3a93d7a97c9fa0eedc334e57469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2967625 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Mohan Maiya 26a54260 2021-05-26T16:53:29 Reland "Vulkan: Handle immutable sampler state change in TextureVk" This is a reland of 349c08300e08bc809c448d62e0ad969ecb17c047 Skip YUV tests on Pixel2 Original change's description: > Vulkan: Handle immutable sampler state change in TextureVk > > Transitioning between sources in RGB and YUV colorspace or between > YUV formats with different layout should force the recreation of > pipeline layout and the invalidation of texture's sampler. > > Only textures that are EGLImage targets are handled for now. > > Bug: b/155487768 > Bug: angleproject:5033 > Bug: angleproject:5773 > Test: ImageTest.SourceAHBTarget2DExternalCycleThrough*Vulkan > Change-Id: I02d5763e7f89b910313e14b57bfc5403113dfbb2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2924415 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Change-Id: Ie3791bc6f6e9b53eb0db23759a14fdc038c8f5b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2939354 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Sunny Sachanandani 03d8e7c9 2021-06-04T21:22:52 Revert "Vulkan: Handle immutable sampler state change in TextureVk" This reverts commit 349c08300e08bc809c448d62e0ad969ecb17c047. Reason for revert: anglebug.com/6028 Original change's description: > Vulkan: Handle immutable sampler state change in TextureVk > > Transitioning between sources in RGB and YUV colorspace or between > YUV formats with different layout should force the recreation of > pipeline layout and the invalidation of texture's sampler. > > Only textures that are EGLImage targets are handled for now. > > Bug: b/155487768 > Bug: angleproject:5033 > Bug: angleproject:5773 > Test: ImageTest.SourceAHBTarget2DExternalCycleThrough*Vulkan > Change-Id: I02d5763e7f89b910313e14b57bfc5403113dfbb2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2924415 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Bug: angleproject:6028 Change-Id: Ib8b3b54ff61f26910df2af4a6b894b3d2d5906bb No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2941547 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Mohan Maiya 349c0830 2021-05-26T16:53:29 Vulkan: Handle immutable sampler state change in TextureVk Transitioning between sources in RGB and YUV colorspace or between YUV formats with different layout should force the recreation of pipeline layout and the invalidation of texture's sampler. Only textures that are EGLImage targets are handled for now. Bug: b/155487768 Bug: angleproject:5033 Bug: angleproject:5773 Test: ImageTest.SourceAHBTarget2DExternalCycleThrough*Vulkan Change-Id: I02d5763e7f89b910313e14b57bfc5403113dfbb2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2924415 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 81db1a46 2021-05-20T13:45:26 Vulkan: TextureVk inherits a few attributes from ImageHelper Cache VkImageCreateFlags in ImageHelper. This allows texture target siblings to inherit a few VkImage create attributes thus avoiding image respecification in certain code paths. Bug: angleproject:2514 Bug: angleproject:5281 Test: PbufferTest.ClearAndBindTexImageSrgbSkipDecode*Vulkan Change-Id: Ic7397fabdce185264e06488355ca47f809338519 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2910473 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi cf3af29a 2021-05-14T16:49:36 Vulkan: Optimize respecifying an image When recreating a texture image to change a usage flag or the base/max levels, this change directly places the levels of the previous image as updates to the new image. This is instead of copying the image to a temp one and staging that. Bug: angleproject:4835 Change-Id: Ibc210b9ff0e8d11cba10b1cd9ab262c8f706cea5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2898417 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 9c262ad0 2021-05-14T12:26:48 Vulkan: Cleanup texture image respecify Prior to this change, respecifying a texture image due to usage, base or max level changes incurred a copy of every level and layer to a temporary buffer which was then staged as an update to the new image. This code was somewhat messy (for example with respect to depth/stencil images), error prone (e.g. previously had bugs with compressed textures) and disallowed further optimizations such as in anglebug.com/4835. This change does the following: - ImageHelper::SubresourceUpdate now takes ref-counted images, instead of image pointers. This allows the same image to be staged for multiple updates. - Respecifying an image is still done through a copy, but to an identical (temp) image instead of buffer, and each level of the image is staged as an update. * Further optimization is to stage the old image itself directly as updates to the new image Bug: angleproject:4835 Change-Id: I4a3ef2d616c9ab459ff65f918b0fb6d9a2161b73 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2897537 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi e354ff1a 2021-03-05T04:07:21 Vulkan: Allow DynamicBuffer suballocation in BufferVk When allocations are made from DynamicBuffer, they suballocate from a possibly larger BufferHelper. In BufferVk, the offset of the suballocation was discarded, which limited the use of DynamicBuffer to a pool of small buffers. This change applies any such offset that may arise from suballocations everywhere, and makes BufferVk use a larger buffer size when the GL_DYNAMIC_* buffer usage hints are provided. Bug: angleproject:5719 Change-Id: I3df3317f7acff1b1b06a5e3e2bb707616a7d0512 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2738650 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 6d905c76 2021-04-01T13:58:42 Vulkan: Remove initImmutableImage and use initImage instead This is follow up of crrev.com/c/2368038. There was concern that initImmutableImage and initImage are a bit duplicated. This CL gets rid of initImmutableImage and uses initImage instead. Bug: b/181800403 Change-Id: I2c73c7ce979792cc762214f1e5ef9978eeab6212 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2800422 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 92d3912d 2021-04-01T10:49:14 Vulkan: Remove maxLevel and immutable from ImageHelper::initExternal Now that we have removed mBaseLevel and mMaxLevel from ImageHelper class in previous two CLs. The initExternal function can be modified to not pass in base/max level information. This CL also removes immutable from argument and let caller directly pass in firstLevel to it. Bug: b/181800403 Change-Id: I595c1faffabc7582af35a9578b2ecdf00c39207f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2800414 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao afd32d8e 2021-03-30T15:50:57 Vulkan: Remove mMaxLevel from ImageHelper class This CL removes mMaxLevel from ImageHelper class. Instead, it now uses front end's max level information when possible. Bug: b/181800403 Change-Id: Ie0f6bd11e3ca0d4ddfc98f21261396c4d71b7140 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2796153 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Charlie Lao 08b7c55c 2021-03-30T13:51:04 Vulkan: Remove mBaseLevel from ImageHelper class This removes mBaseLevel from ImageHelper class. With the mFirstAllocatedLevel tracking exactly which GL level has been allocated, this cached mBaseLevel is no longer needed. Bug: b/181800403 Change-Id: I99d66c93b0c8f1bd20a5811b51f512a27927201e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2795275 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao b5a71140 2020-08-20T17:24:21 Vulkan: Make storage actually immutable for immutable textures The immutable textures are intended to be "immutable". Right now we are still re-allocating VkImage object based on base_level and max_level. This causes a problem for rendering to a level that is beyond [base_level, max_level], which is totally within OpenGL spec. This CL makes an immutable texture always allocate from 0 to max levels that are specified by a glTexStorage call. Changing base_level will not trigger re-allocation of VkImage object. Bug: b/181800403 Change-Id: I4b4ddea17b7f6f7bfd8f36bfe8bb3a35b5c180b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2368038 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi d1462228 2021-03-09T11:25:36 Vulkan: Use VK_EXT_multisampled_render_to_single_sampled Additionally, makes the emulation path not require independentResolveNone. This was only used to select the NONE resolve mode when the attachment format doesn't have either of depth or stencil aspects, but it's ok to specify the same resolve mode for both aspects even if one aspect is missing. Bug: chromium:1088005 Change-Id: Ifc37cbf5331145179c5927853b996a0d62b871ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743666 Reviewed-by: David Reveman <reveman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao da437f26 2021-03-08T19:08:14 Vulkan: Defer color image layout changes at endRenderPass time Right now color render target's image's layout change are done at beginRenderPass time. The problem is that the layout also depends on whether texture is also being used as a sampler or not. That information is not known when renderpass starts. We did some special treatment for depth stencil attachment so that its layout determination is deferred until endRenderPass time. This CL expands that same mechanism to color attachment as well. Right now the color attachment will still pick the same ImageLayout::ColorAttachment layout since the logic to detect it is also used for texture sampling is not there yet. Bug: b/175584609 Change-Id: Id7486174d475f894461578b31d0d40fdd90e808a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2744121 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Mohan Maiya 81dcf078 2021-03-08T11:21:31 Reland "Vulkan: Support EXT_sRGB_write_control" This is a reland of 6073af536cf627742696823edc82c9b0a481a8bc with 2 changes - 1. Don't enable the extension even in nonConformant mode 2. Don't enable VK_KHR_image_format_list for swiftshader Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075 Change-Id: I8e149d196a39c3c4769bfa8690792f3c53831299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2762647 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Peng Huang b27740f3 2021-03-09T16:15:15 Revert "Vulkan: Support EXT_sRGB_write_control" This reverts commit 6073af536cf627742696823edc82c9b0a481a8bc. Reason for revert: crbug.com/1186140 Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075,chromium:1186140 Change-Id: Ib0d4d60fe7434fb950f99db2c210aab9af7d2d0e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743663 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Peng Huang <penghuang@chromium.org>
Mohan Maiya 6073af53 2021-03-08T11:21:31 Vulkan: Support EXT_sRGB_write_control Implement support for EXT_sRGB_write_control. This extension requires VK_KHR_image_format_list to be supported. The spec requires this functionality to work with glBlitFramebuffer as well but support for that will be added in a follow up change. As such, this extension is only exposed in non-conformant mode. Bug: angleproject:5075 Tests: SRGBFramebufferTest.*Vulkan* Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 4afd0f27 2021-02-17T13:35:57 Vulkan: Add VK_KHR_image_format_list support to initExternal The code for initializing a VkImage with VK_KHR_image_format_list extension support is now internal to initExternal. Also provides a flag to inform callers when VK_KHR_image_format_list support is enabled. Bug: angleproject:5520 Change-Id: Ie2ade93d1403ab3f9cbcf7d80684bbca201d5d8d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2702159 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Mohan Maiya 2b69462e 2021-02-12T15:55:00 Vulkan: Consolidate image format list initialization code HardwareBufferImageSiblingVkAndroid, RenderbufferVk, SurfaceVk and TextureVk all had similar code to initialize VkImage with VK_KHR_image_format_list extension support. Consolidate all of them into a helper. Bug: angleproject:5520 Change-Id: Ib7ac582a35a26c0da15879e688bcaf0c2a92ea87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2692641 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi eae262e7 2021-01-27T13:56:49 Vulkan: Fix image layout barriers for tessellation shaders Also fixes a bug where invalid stages may be specified for example if AllGraphicsReadOnly or DepthStencilReadOnly layouts are used and geometry or tessellation shaders are not supported by the implementation. Bug: angleproject:5557 Change-Id: Ia25a6aec8138c67701c63da65783263d8a7bda27 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2653911 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi ea71c6b6 2021-01-12T14:13:35 Vulkan: Emulate R32F images with R32UI GL requires that imageAtomicExchange be supported for r32f formats. However VK_FORMAT_FEATURE_STORAGE_*_ATOMIC_BIT is nearly unsupported everywhere without some Vulkan extension that brings in unnecessary support. This GL feature is emulated by transforming the shader to use r32ui for all images that originally specified r32f. floatToUintBits and uintBitsToFloat is used to maintain correct usage of the image* builtin functions. Bug: angleproject:5535 Change-Id: Ie607089935d3283b3ffa054f4b4385b81fb8f53d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2635453 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 2e9706d8 2021-01-08T17:29:42 Vulkan: Use angle::FormatID instead of VkFormat. This change switches the internal enums we pass around from VkFormat to FormatID. The end goal of the refactor is to allow the Vulkan back-end to store packed tables indexed by FormatID. Because VkFormat has large gaps in its enum space we'd otherwise need to use unordered data structures like unordered_map. The change removes the redundant VkFormat storage from vk::Format and uses a new table query to return the VkFormat that 1:1 matches an angle::FormatID. We also include a reverse mapping for use with native Vulkan get functions for Android. Also moves sRGB conversion functions into renderer_utils. A couple sRGB formats that don't exist in GL are no longer handled by the sRGB conversion functions. These formats should be extremely rare. Bug: angleproject:5438 Change-Id: Id8b49773ca0c556f9f5a6a10fcf0d9762b93bbea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2618204 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Jamie Madill e91097bf 2020-12-29T14:05:56 Vulkan: Clean up "actual"/"intended" naming. Clarifies that the GL internal format is an "intended" format and the Vulkan formats are "actual" formats. This makes all the format fields use the same consistent naming pattern. Bug: angleproject:5438 Change-Id: I935a49895109e9e06eae5ef98d5614dfd1128ff8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2605728 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 56330564 2020-12-10T00:46:04 Vulkan: Support layered framebuffers This feature is introduced by geometry shaders, where all the layers of a texture can be attached to a framebuffer. The geometry shader would use gl_Layer to decide which layer the primitive should be rendered to. Bug: angleproject:3571 Change-Id: Ib2ae8e227b226295f9e2f62f6b230839070bc95c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2582711 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya e674625d 2020-11-20T13:05:49 Reland "Vulkan: Fix incorrect exposure of sRGB extensions" This is a reland of abcabb474bf1c25eea48d7dca14bcafde737eba7 only we continue to suppress the validation error Original change's description: > Vulkan: Fix incorrect exposure of sRGB extensions > > When we check to see what formats we can reinterpret for sRGB > extensions, we need to make sure we can match the image usage > flags as well. If the original format supports framebuffer > attachment usage, we need to make sure that the reinterpreted > format can support it as well. > > Bug: angleproject:5309 > Change-Id: I7e84d01004504f854a3e22227e99b1740ed1a2b2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2549156 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: angleproject:5309 Change-Id: I0efb6180b7be4e14d24b4bb339de01a2b9177e7e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2556571 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi acf004a1 2020-11-19T16:58:30 Vulkan: Use transfer more opportunistically with copyTextureCHROMIUM If the difference between formats is sRGB vs not or normalized vs integer, still allow the transfer path to be taken. Bug: b/159211070 Change-Id: I53334812ed29baec6ad434de1fcd6dde35049c12 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551534 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 5fac02c8 2020-11-24T14:20:36 Revert "Vulkan: Fix incorrect exposure of sRGB extensions" This reverts commit abcabb474bf1c25eea48d7dca14bcafde737eba7. Reason for revert: Failed on CQ and build passed, see bug. Bug: angleproject:5394 Original change's description: > Vulkan: Fix incorrect exposure of sRGB extensions > > When we check to see what formats we can reinterpret for sRGB > extensions, we need to make sure we can match the image usage > flags as well. If the original format supports framebuffer > attachment usage, we need to make sure that the reinterpreted > format can support it as well. > > Bug: angleproject:5309 > Change-Id: I7e84d01004504f854a3e22227e99b1740ed1a2b2 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2549156 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=syoussefi@chromium.org,jmadill@chromium.org,m.maiya@samsung.com Change-Id: I211802eb17deff3399ec680eeae4c4ff33e52d9d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:5309 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2557567 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya abcabb47 2020-11-20T13:05:49 Vulkan: Fix incorrect exposure of sRGB extensions When we check to see what formats we can reinterpret for sRGB extensions, we need to make sure we can match the image usage flags as well. If the original format supports framebuffer attachment usage, we need to make sure that the reinterpreted format can support it as well. Bug: angleproject:5309 Change-Id: I7e84d01004504f854a3e22227e99b1740ed1a2b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2549156 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi b6ec24ab 2020-11-14T00:24:52 Vulkan: Support format reinterpretation in imageBuffers This is done by creating multiple buffer views over the buffer based on the format specified by the attached shaders. Bug: angleproject:3573 Change-Id: I0372a988938050cc092d8a0959a59d1c893fc6f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2536909 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 61a117fa 2020-11-16T12:48:11 Vulkan: Fix aliasing format for non-layered image bindings This was correctly handled for layered bindings by the change anglebug.com/3885#c20. This change uses the same mechanism for non-layered bindings. Bug: angleproject:5347 Change-Id: Ida55b3589d0bdbe5d824c1614c9bf9f867a7f652 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2541182 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 86d7e4d8 2020-11-10T15:55:34 Vulkan: Support texture buffers Texture buffers are placed in the same descriptor set with the rest of the textures. However, the different code paths that handle textures have special cases for texture buffers as they create a different descriptor type (texel buffer instead of combined image sampler). Image view serials are used to track the buffer view serials as well so the texture descriptor cache can handle texture buffers as well. This CL is missing storage texel buffer support. Bug: angleproject:3573 Change-Id: Iff80ca22ff9b9957a0c9a3c7aaada1fa54b24ec8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532653 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi c669bf52 2020-11-09T21:39:04 Vulkan: Optimize PBO copy from depth xor stencil src If the buffer format of the PBO does not contain both depth and stencil, it already has packed data ready for upload, so this change allows the GPU path to be taken. Bug: angleproject:5315 Bug: b/172354898 Change-Id: I424c15951594f49ffc140f9cde9e7c73486512b3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2526947 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9e7f08fc 2020-11-06T16:55:51 Vulkan: Fix incorrect reordering of barriers Take the following situation, a simple copy from image to buffer: ANGLE_TRY(contextVk->onBufferTransferWrite(buffer)); ANGLE_TRY(contextVk->onImageTransferRead(aspectFlags, image)); CommandBuffer &commandBuffer = contextVk->getOutsideRenderPassCommandBuffer(); commandBuffer.copyImageToBuffer(imageHandle, layout, bufferHandle, 1, regions); Both `onBufferTransferWrite` and `onImageTransferRead` may flush either the outsideRP or insideRP command buffers. If buffer is not previously used, but image is used: - onBufferTransferWrite: buffer usage is recorded in outsideRP1 - onImageTransferREad: outsiderRP1 is flushed, outsideRP2 is started - copyImageToBuffer: recorded on outsideRP2, but buffer usage not recorded there - A following command that uses the buffer and requires barrier doesn't close outsideRP2 as it believes it was not used there Bug: angleproject:5319 Change-Id: Ib8994083fbc21969a538cda3784adee57b089415 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2523388 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 36787dcb 2020-11-04T23:06:47 Vulkan: Fix PBO assuming color images Bug: b/172354898 Change-Id: I777eaa33ddac853492d38a03c16caeddad0c2d16 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2520108 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Mohan Maiya 72001c7d 2020-11-07T12:33:01 Vulkan: Bug fix in texture respecification code When a target texture is created from an EGL image, respecification of the texture needs to take into account the fact that it din't own the ImageHelper. Refactor copy and stage code to account for this possibility as well. Bug: angleproject:3756 Bug: angleproject:5281 Test: ImageTest.Source2DTarget2DTargetTextureRespecify* Change-Id: I2e3bd5d1d64e85da521a841423cfe24673efe88f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2524703 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 55934550 2020-11-05T07:13:39 Vulkan: Don't refresh image views unnecessarily If the underlying ICD supports VK_KHR_image_format_list extension we will have created both the linear and sRGB image views, reuse them instead of refreshing them. Bug: angleproject:3609 Bug: angleproject:4561 Bug: angleproject:5281 Change-Id: Ie34f08b3554a07f94911bebf925e38d702bc3c36 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2518387 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi d77e85a8 2020-11-03T22:23:18 Vulkan: Store image updates per level This optimization allows iterating only over updates of a certain level or range of levels, instead of having to iterate over every update and filter out the ones matching the desired level(s). Bug: angleproject:4891 Change-Id: Ied04f4b28f05d37b9add61c7f4d54cc328c0be86 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519095 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 1e494cae 2020-10-07T19:26:01 Vulkan: Add support for EXT_copy_image Add support for GL_EXT_copy_image which allows image data transfer between image objects. This is implemented by using the vkCmdCopyImage API call. Bug: angleproject:3593 Test: dEQP-GLES31.functional.copy_image.* Change-Id: I30a34a8711b5d2e5834064d7453e03d6ec0df478 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2393955 Commit-Queue: Brandon Schade <b.schade@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4989667a 2020-11-03T16:28:37 Vulkan: Make ImageHelper::flushStagedUpdates take gl::LevelIndex More consistent with the rest of the public functions in this class. Bug: angleproject:4891 Change-Id: I72c7c3d21f8287cc1711772671c6e7ad524fd096 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2518179 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 23d1f9b4 2020-11-02T13:00:08 Vulkan: Add support for VK_KHR_image_format_list extension GLES sRGB extensions allows for a texture to be respecified, with say the sRGB_override extension, which will require us to reinterpret the data in the texture in sRGB colorspace (or linear depending on the format of the texture). If the underlying ICD supports VK_KHR_image_format_list extension we create a texture's backing VkImage with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT enabled since we already know the format we might need to reinterpret the texture as. Bug: angleproject:3609 Bug: angleproject:4561 Bug: angleproject:5281 Change-Id: Ia4bed596ed3000f8af1a8fd73fb8e6c2cb9b5d6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2513110 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 3fcf17e6 2020-11-02T12:51:35 Vulkan: Bug fix in sRGBDecode logic When a sampler's GL_TEXTURE_SRGB_DECODE_EXT state was toggled between GL_DECODE_EXT and GL_SKIP_DECODE_EXT VkImageViews of the TextureVk object were not being updated. Add sRGB_decode state as part of ImageViewSubresourceSerial so we retrieve the correct VkImageView from the texture cache. Bug: angleproject:3609 Tests: angle_end2end_tests --gtest_filter=SRGBTextureTestES3.SRGBDecodeSamplerParameterToggle*Vulkan Change-Id: I897e461957d408b5a5b4f03fefc05f2e9684c7b7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514900 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 97843bda 2020-10-30T17:03:36 Vulkan: Fix EGL Surface robust init. The error here was related to using a single cache variable for the robust init setting for all the surfaces in a DisplayVk. Fix this by passing down the robust init setting from the SurfaceVk to image init. Bug: angleproject:5274 Change-Id: I9bc9c20990268d1d5166411fb53f8f2593fd1971 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510694 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 33e30205 2020-10-17T19:03:45 Vulkan: sRGB cleanups. A few fixes to how we check for the sRGB override in the TextureVk class. In at least one instance there was a potential edge case where in syncState we might not create the Texture with the mutable bit the second time through the function. Bug: angleproject:5176 Change-Id: I4f1ca6e469b10514c3a0de3120be9ade62568084 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2482292 Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2072ce50 2020-10-18T16:44:09 Rename "NonLinear" to "SRGB". In OpenGL parlance there are really only two color spaces: Linear and SRGB. Vulkan is much more complicated with linear and nonlinear SRGB, and multiple non-SRGB linear color spaces. Keep things simple by working with OpenGL nomenclature. Bug: angleproject:5176 Change-Id: Ia730a9a666a2b3325194b86dc588e7fd226c4183 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2483466 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Jamie Madill 5f7eeb93 2020-10-17T11:52:40 Add isSRGB flag to angle::Format. Bug: angleproject:5176 Change-Id: I85fc78206456439ba7dab55c093187fb94364823 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2482290 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Mohan Maiya 7bbe497a 2020-10-16T14:46:45 Vulkan: Implement EXT_texture_sRGB_decode Implement EXT_texture_sRGB_decode. This builds on the existing functionality from EXT_texture_sRGB_override, with 2 major edge cases: 1. sRGB_decode allows the texture state to be overridden by sampler state, which is implemented by forcing a a texture state sync during updateActiveTextures if a texture is bound to the same unit as a sampler with that state 2. texelFetch calls require us to reenable decoding, regardless of decode state. We add a new compiler pass (FlagSamplersWithTexelFetch) to mark samplers that are used with texelFetch in order to support this. This change also re-enables EXT_texture_sRGB_R8, which was disabled due to a dEQP bug that this change will bypass. Bug: angleproject:3609 Bug: angleproject:4503 Test: dEQP.GLES31/functional_srgb_texture_decode_skip_decode_* Test: GLES31/functional_state_query_texture_*_srgb_decode_* Test: GLES31/functional_state_query_sampler_*_srgb_decode_* Test: GLES31/functional_debug_negative_coverage_*_srgb_decode_* Test: GLES31/functional_android_extension_pack_extensions_ext_texture_srgb_decode Test: angle_end2end_tests --gtest_filter=SRGBTextureTest.*Vulkan* Change-Id: I4a67e487dc82e2f57c8c87d4bcd8ef442b6fe220 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359481 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Hyunchang Kim d9a88d63 2020-09-28T17:58:31 Vulkan: Support OES_texture_cube_map_array extension Add support for GL_OES_texture_cube_map_array to the Vulkan backend if the underlying ICD supports creation of of cube array ImageViews Bug: angleproject:3584 Test: dEQP-GLES31.functional.fbo.color.texcubearray.* Change-Id: I636cbf347d718abfc1600119b312578370b8e02e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437989 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 4c6b4794 2020-10-12T12:37:29 Vulkan: TexSubImage3D using PBO should use correct layerCount The layerCount for 3D texture and 2DArray should be 1 if it does not have layers. Bug: b/170657065 Change-Id: I974ddda7c0eaa92da8033f15c682820e3d4eb32a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2466616 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 68bd685a 2020-10-10T22:58:41 Reland: "4 Vulkan content defined CLs." Reland "Vulkan: Avoid content restore by detecting no-op stencil" This relands commit 243d0f899e443cd931c78aba7489382dff79edbb. Reland "Vulkan: Restore at the end of RP if write-after-invalidate" This relands commit e5d52ac3b9a00656acdd912ee8cd62dd14784075. Reland "Vulkan: Invalidate/restore depth/stencil separately." This relands commit 61fa0878964a796f6d3b3c13bc3a3849403ecdbd. Reland "Vulkan: Move content-defined tracking to ImageHelper" This relands commit 2392e6b34c0ddfbfd7b4c3cb67323ba463e11a57. Reason for revert: Caused crashes in Fuchsia x64 and on ARM. Reland fixes content defined for external images. Original CL message: Content-defined tracking was done in render targets prior to this change. This had multiple drawbacks: - When a framebuffer attachment is changed (including the first time it's set), it's unknown whether the contents of the attachment is defined. - Invalidate takes effect at the end of render pass, at which point the render target objects may be gone. Attachment ImageHelpers are however correctly tracked. This change moves content-defined tracking to the ImageHelper itself, and tracks it per subresource. ImageHelper::onWrite() now receives the subresource that is being written, and marks it as having defined content. A future optimization can make use of this change to ImageHelper::onWrite to track "dirty" subresources. This can lead to the removal of unnecessary barriers when same-kind writes are done on different subresources of the image. See http://anglebug.com/3347#c15 Bug: b/167275320 Bug: angleproject:4836 Bug: angleproject:5159 Change-Id: If5c1ae7152657fd7c94db7d55bea4fb9ddf835ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2464825 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>