src/libANGLE/renderer/vulkan/vk_cache_utils.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi d285d6a7 2021-11-23T23:12:00 Vulkan: Use VK_EXT_depth_clip_control Bug: angleproject:6679 Change-Id: Iea3b7a2d8db630dcea19836732de8f9e0a7a568f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3298356 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 038adcae 2022-02-08T16:46:40 Vulkan: Render the overlay in the graphics pipeline Bug: angleproject:6976 Change-Id: I388d429f0726b4d6a1c4ecd446ead93579a14a1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3448643 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 70c510eb 2022-02-03T07:54:29 Vulkan: Use common storage for descriptor set descs. This lets us avoid using templates when implementing descriptor set caches. As an added bonus, the key size now scales with the number of active items in the cache. In the case of using a smaller set of active textures, our keys now use sizeof(uint32_t) * (kFastBufferWordLimit) + sizeof(void *) bytes of storage (132/136) instead of sizeof(uint32_t) * 3 * 96 bytes (1152) per set. This reduction should improve cache coherency. Bug: angleproject:6776 Change-Id: I904fc5527ff033af927e25abe6d13d98142e3f14 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3436767 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 665ddccd 2021-12-09T23:06:39 Vulkan: Emulate dithering Dithering in OpenGL is vaguely defined, to the extent that no dithering is also a valid dithering algorithm. Dithering is enabled by default, but emulating it has a non-negligible cost. Similarly to some other GLES drivers, ANGLE enables dithering only on low-bit formats where visual banding is particularly common; namely RGBA4444, RGBA5551 and RGB565. Dithering is emulated in the fragment shader and is controlled by a spec constant. Every 2 bits of the spec constant correspond to one attachment, with the value indicating: - 00: No dithering - 01: Dither for RGBA4444 - 10: Dither for RGBA5551 - 11: Dither for RGB565 The translator appends code to the shader that, based on the format specified by the specialization constant, adds dithering to each color attachment output. A 2x2 Bayer matrix is used for dithering, indexed by gl_FragCoord.xy % 2. Bug: angleproject:6755 Change-Id: Ib45da5938e299b6626bff921119d63e7357dd353 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3374261 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 168e0ae5 2022-01-27T16:50:00 Vulkan: Refactor descriptor pool code. This uses vk::Context to init DynamicDescriptorPool, and removes some accesses to ProgramExecutableVk member variables so the methods can more easily be moved into another class. The changes should have no effective behaviour difference. Note that the immutable sampler descriptor count is entirely set by the format of the immutable samplers. However we can't determine this count by looking at the descriptor set layout desc with the current implementation. Bug: angleproject:6776 Change-Id: I0a323d19fa3720b5afd8300401ed9c30b105c0ef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3424657 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov 345cdcb0 2022-01-10T22:41:46 Rename features for consistency. supports_custom_border_color -> supportsCustomBorderColor supports_protected_memory -> supportsProtectedMemory Also drop EXT from the end of the variable name as other variables don't have that. Bug: angleproject:6731 Change-Id: I60b20d84387bccbca0c4c1cbc7e341c1f5e8f0ba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3378827 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>
Tim Van Patten fd014271 2021-12-16T20:44:42 Vulkan: Match chromaFilter to min/mag for YUV AHBs From the VVL: VUID-VkSamplerCreateInfo-minFilter VkCreateSampler: VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT specifies that the format can have different chroma, min, and mag filters. However, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT is not supported for VkSamplerYcbcrConversionCreateInfo.format = VK_FORMAT_UNDEFINED so chromaFilter needs to be equal to minFilter/magFilter. We don't know what the min/mag filters are when the AHB is imported, so we need to update the YcbcrConversionDesc with the current min/mag filter value before creating the VkSamplerYcbcrConversion when the ImageView is created. Additionally, if the min/mag filters are updated later, TextureVk::syncState() needs to recreate the ImageViews to ensure the chromaFilter matches the new min/magFilters. Test: atest android.media.cts.DecodeAccuracyTest#testGLViewDecodeAccuracy[0] Test: ImageTestES3.SourceYUVAHBTargetExternalYUVSampleLinearFiltering Bug: b/210526871 Change-Id: I95dbd9738f6e3fd0870e484518eee105e995f93a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3346394 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Lingfeng Yang 6f1c39b5 2021-12-16T16:10:49 Vulkan: Restore color attachment mask-related blend states When we end up resetting blend state such as when changing to a depth-only FBO and back, we can end up adding attachment states. They need to be updated with the current GL blend state. Bug: b/210543392 Bug: angleproject:6828 Change-Id: I3419acb8081eb7d662576a75382bb8684cc0d29f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3346320 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>
Mohan Maiya 36fcf80b 2021-12-11T20:55:53 Vulkan: Consolidate SamplerYcbcrConversionCache Now that SamplerDesc and ImageHelper have the fully qualified description of a VkSamplerYcbcrConversion, we can lazy allocate the conversion handle along with streamlining the interface to the SamplerYcbcrConversionCache class. Bug: angleproject:6732 Test: Texture2DTestES3.*Yuv*Vulkan Change-Id: I7deaa0220031bc4c500d88021459017bf937218c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3333629 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
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>
Jamie Madill 5f755c29 2021-11-17T16:29:37 Vulkan: Lock around handle counter. TSAN showed we could have a data race when multiple threads were releasing objects because of the singleton handle counter. Bug: angleproject:6714 Change-Id: I23b5d343bec421a663198e7efc30c78dab2bde8f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3288328 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 4a2446c6 2021-10-19T11:55:17 Vulkan: Implement robust shader outputs. In this CL we change ANGLE to pass the mask of missing shader outputs down to pipeline creation. We then use the color mask bits to block SwiftShader writing to unused outputs. This fixes the undefined behaviour present in Genshin Impact. Note that the other GLES implementations we tested don't seem to modify outputs even if they're unused. It was easier to mask out the color attachments in initialize rather than set up the pipeline desc to mask out the attachments. This was because we manipulate the color mask in a fairly complex way before we initialize the pipeline desc. Bug: angleproject:6566 Change-Id: Ie659fcd511cd286fa573fd25e3e6a0b9e123ebd6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3232435 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Hans Wennborg 6ce67886 2021-10-28T13:45:18 Drop -Wweak-template-vtables Clang is dropping suport for this flag, see bug. Bug: chromium:1264351 Change-Id: I09b3d42889eecb8e786c52c205f28507fc797c5a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3250885 Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 4b75345a 2021-10-06T22:47:16 Vulkan: Don't create pipeline with depthWrite if !depthTest depthWrite is ineffective without depthTest. This change makes sure that depthWrite/depthTest combinations of true/false and false/false generate the same Vulkan pipeline. Bug: angleproject:6410 Change-Id: I47e1524379d40dfb956f026903e0affc7f4fc59d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3210628 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi e637e4c9 2021-10-18T13:54:00 Vulkan: Optimize updating blend state in pipeline desc Updating blend funcs and equations always updated all 8 slots. Now that's only done for the attachments that are present. Bug: angleproject:6298 Change-Id: I58fa7e4dfa27d05fef54cc9d56c7b2aa5ef43dd8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3202550 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Jamie Madill 1dc2b702 2021-10-13T16:02:37 Vulkan: Pass shader module map to init pipelines. Instead of pulling out the shader modules from the shader map when we start the call chain, pull them out right in the init call. This saves a bunch of boilerplate code. Refactoring change only. Bug: angleproject:6566 Change-Id: Ib8d79bd7284d7ddb83522270f3d4df9086ab7300 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3221134 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 4ad55d07 2021-10-05T15:45:05 Vulkan: Turn 1-view multiview FBOs into no-multiview When only 1 view is enabled, ANGLE continued to append a VkRenderPassMultiviewCreateInfo struct to the render pass. VVL produced an error when transform feedback was used in this case, quoting that multiview and transform feedback cannot mix. This change makes sure that 1-view framebuffers are threated as if they were not multiview. Bug: angleproject:6478 Change-Id: If079c9a052f822342a49a9cc880be2577a356b64 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3206269 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill e84b0154 2021-09-13T16:04:20 Update extension boolean names. This is in preparation for auto-gen, which uses a simple naming scheme. This fixes the bool names to be totally consistent with the extension names. Bug: angleproject:6379 Change-Id: Ia212449be04accb0e4f006b55b1813ab4481fa0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3157417 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 1ca1589f 2021-09-13T10:56:58 Give GLES extension bools a vendor suffix. This is in preparation for auto-generation which will give all of these bools suffixes. Bug: angleproject:6379 Change-Id: I7e3f6c9b644c41a2165e6bf7b62d661fd352a250 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3158503 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 371542cd 2021-08-23T23:10:09 Vulkan: Use VK_EXT_load_store_op_none With read-only depth/stencil attachments, ANGLE utilizes storeOp=NONE to optimize memory bandwidth (by avoiding write back of tile memory at the end of the render pass). Simultaneoulsy, this avoids a synchronization hazard with the next write to that depth/stencil image. If a framebuffer contains a depth/stencil attachment but it's unused, ANGLE utilizes loadOp=NONE/storeOp=NONE to effectively remove any memory bandwidth wasted on the attachment. Bug: angleproject:5371 Change-Id: I76cbadbf1194041532ac4b690ffe087298f2de51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3114232 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
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>
Brandon Schade 5a7b8c61 2021-08-31T14:58:06 Vulkan: Removed size check when handling mismatched vertex attributes If locations are specified to be noncontiguous or out of order when there is a mismatch between the attribute type specified by glVertexAttribPointer and the shader, the program's attribute type from ProgramExecutable's getProgramInputs() method would fail. This is due to using attribIndex which refers to the attribute's location rather than the position in the vector returned from getProgramInputs(). This change removes the size check as it's not needed for GL_ANGLE_relaxed_vertex_attribute_type. Bug: angleproject:5762 Test: VertexAttributeTestES3.DrawWithMismatchedComponentCountLocationSpecified Change-Id: Ie15f2095e618e12403d1524273d1add74b00cdbd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3137273 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Brandon Schade <b.schade@samsung.com>
Charlie Lao 6977fa6f 2021-08-31T09:47:59 Vulkan: Store actualFormatID (not intendedFormat) in RenderPassDesc Today we store intendedFormatID in the RenderPassDesc. At unpack time, we convert intendedFormatID to vk::Format and then get the actual VkFormat. This is a bit complex and unnecessarily confusing. And this will be very error prone in the future when vk::Format has two actual image formats. This CL packed actualFormatID into RenderPassDesc and converts to VkFormat directly. Once packed in the RenderPassDesc, we never needs to reference to intendedFormat or vk::Format since all these does not matter. The only format matters is actualFormatID once you packed into the RenderPassDesc. This simplifies the logic and prepare for the future CLs. Bug: b/196456356 Change-Id: Ia282115c824e3ec446d2be15b40b1e2974b99afa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3133761 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
Cody Northrop ef96bde8 2021-08-28T23:59:33 Vulkan: Fix VVL error regarding geometryStreams Addresses new validation error: [ VUID-VkPipelineRasterizationStateStreamCreateInfoEXT-geometryStreams-02324 ] Validation Error: [ VUID-VkPipelineRasterizationStateStreamCreateInfoEXT-geometryStreams-02324 ] Object 0: handle = 0xb400007e8176af60, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf1034461 | pCreateInfos[0].pRasterizationState pNext chain includes VkPipelineRasterizationStateStreamCreateInfoEXT, but geometryStreams feature is not enabled. The Vulkan spec states: VkPhysicalDeviceTransformFeedbackFeaturesEXT::geometryStreams must be enabled (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkPipelineRasterizationStateStreamCreateInfoEXT-geometryStreams-02324) The validation was added in this commit: https://github.com/KhronosGroup/Vulkan-ValidationLayers/commit/bdaec8454a27e65dd81f46bbfad1889b7a3e34f6 Test: World of Kings MEC Bug: b/198101940 Bug: angleproject:6339 Change-Id: I3cfacc20d231d246500e83451c9ec6b74d9372f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3127942 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
Mohan Maiya 5c8bf081 2021-06-08T13:12:24 Vulkan: Add support for YUV internal format extension 1. Add a function to upload YUV image data to textures 2. Modify stageSubresourceUpdate method to account for YUV images 3. Create VkSamplerYcbcrConversion when initializing ImageHelper 4. Update hasImmutableSampler to account for native YUV format support 5. Skip initializeNonZeroMemory for YUV formats Bug: angleproject:5773 Test: Texture2DTestES3.TexStorage2D*Yuv*Vulkan* Change-Id: I270f04bbf903cf2bf19f100eb95f32953d491c39 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2947767 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Cheryl Wei 45965e72 2021-06-17T10:21:26 Vulkan: Translate border color's channel by image view format ANGLE implementes some formats as other formats,such as ALPHA8 to R8, this caused some tests failed due to missing border color's channel translation,this change add a new textureBorderLoadFunction to translate channels of border color by image view format. Bug: angleproject:6046 Change-Id: I94ce719b4db3724ffd3dc862b51a412b5d9f3cce Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2972328 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 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 5b314268 2021-06-15T17:37:45 Vulkan: Support OVR_multiview and OVR_multiview2 Multiview is supported in Vulkan simply by specifying the number of views in the render pass, and creating the appropriate image views. A number of changes to the way image views and render targets are stored are made to support those that don't cover the entire range of layers. One particular detail that is not implemented in this change is the use of queries in combination with multiview. Vulkan specifies that N queries are actually produced (N being the number of views) which must be summed by the application, but this is not currently done. Bug: angleproject:6048 Change-Id: I1d4a9894c232d3a93d7a97c9fa0eedc334e57469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2967625 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 9bad7a19 2021-06-15T23:39:52 Vulkan: Unpack RenderPassDesc Upcoming multiview support needs to add 2~3 more bits to this struct, but this struct is already fully packed. As the combination with emulated multisampled render to texture is not planned, some bits used for MSRTT can be aliased with multiview. However, that makes the packing of this struct even more unwieldy. Since only tens of render passes are expected per frame, increasing the size of the render pass cache key should not have a dramatic effect. Bug: angleproject:6048 Change-Id: I5c9a0d155f23a37e2787b38525d3ce721b54ec1e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2966218 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 64ce506d 2021-06-18T14:48:29 Vulkan: SPIR-V Gen: Support most non-texture/image built-ins Most GLSL built-ins map directly to some SPIR-V operation. texture*() and image*() built-ins are not implemented as well as a handful of other built-ins that require special-handling. Bug: angleproject:4889 Change-Id: I72abfb4692c3d66a3c8be43ce44ba6808efe6255 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2971646 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Cody Northrop 851fbedb 2021-06-10T21:27:01 Vulkan: Switch viewport and scissor to dynamic state Heavily based on http://crrev/c/1316888 Some apps are creating a large number of viewport combinations and are running out of graphics memory. This CL drops their graphics pipeline use from tens of thousands to tens. Performance testing shows little impact to application traces. Bug: b/190026813 Bug: angleproject:3143 Change-Id: Ib7415be1128f8fedae4a7ca72e067b2815201223 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954925 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya e697e379 2021-03-10T23:59:45 Vulkan: Allow certain usecases to have non-zero stride When glVertexAttribPointer is called with a type parameter that doesn't match the vertex attribute binding's type in shader, the vulkan backend used to force the stride to 0. This is acceptable since this usecase is unspecified in spec. To allow for better app compatibility, introduce a new extension that requires normal glVertexAttribPointer functionality to be maintained if the mismatched vertex attribute type is a mismatched integer type sign. This change also modifies the VkFormat used when a mismatch in signedness occurs to use a VkFormat with the same component width as the type parameter. Bug: angleproject:5762 Test: VertexAttributeTestES3.DrawWithRelaxedVertexAttributeType* Test: VertexAttributeTestES3.DrawWithMismatchedComponentCount* Change-Id: I7e5281500afc3d77f0775821447cabfad3ff2d66 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2765012 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya dd312cc6 2021-05-21T08:49:48 Reland "Vulkan: Add support for EXT_texture_border_clamp" This is a reland of 4b92e089c01e94730fe26c4c743d76d6c935088d Initializes mPadding to 0 in SamplerDesc::update Original change's description: > Vulkan: Add support for EXT_texture_border_clamp > Add support for GL_EXT_texture_border_clamp. This is implemented by > using VK_EXT_custom_border_color. > > Bug: angleproject:3577 > Test: dEQP-GLES31.functional.texture.border_clamp* > Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: angleproject:3577 Change-Id: I8684242c4bce6e1a006dbe926defaa495fcc2282 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2911571 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Yuly Novikov 44fabb7b 2021-05-21T00:51:06 Revert "Vulkan: Add support for EXT_texture_border_clamp" This reverts commit 4b92e089c01e94730fe26c4c743d76d6c935088d. Reason for revert: breaks "Linux MSan Tests" bot https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20MSan%20Tests/28489/overview Original change's description: > Vulkan: Add support for EXT_texture_border_clamp > > Add support for GL_EXT_texture_border_clamp. This is implemented by > using VK_EXT_custom_border_color. > > Bug: angleproject:3577 > Test: dEQP-GLES31.functional.texture.border_clamp* > Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Bug: angleproject:3577, angleproject:5996 Change-Id: I6b62f1a4a43fcfe2d0df2c73de24db83606ce430 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2911533 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Mohan Maiya 4b92e089 2021-05-12T09:20:24 Vulkan: Add support for EXT_texture_border_clamp Add support for GL_EXT_texture_border_clamp. This is implemented by using VK_EXT_custom_border_color. Bug: angleproject:3577 Test: dEQP-GLES31.functional.texture.border_clamp* Change-Id: Ie9fa1eb5dd03b997b5ae182787641a53080a9e51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830192 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9e8fea5b 2021-05-13T07:04:05 Vulkan: Fix desc set cache bug with xfb offset Prior to this change, the transform feedback buffer offset was not stored in the descriptor set key, so if the offset changed, stale descriptor sets could be used. Bug: angleproject:5963 Change-Id: I3dec4ab9fa82092a65e9a75bdd19c5f2cf49521c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2894513 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill ccc0fbaa 2021-03-24T17:56:38 Vulkan: Related fixes for buffer descriptor set cache. Includes some stats counter gathering and a few related refactors and cleanups. Also includes a new overlay widget. Bug: angleproject:5736 Change-Id: Ida8d2cd815c5b598c6a442dd9bbfdf51e9c05180 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2785431 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi cd4a63f5 2021-04-26T11:52:02 Vulkan: Fix ASSERT in CreateRenderPass2 RenderPass2 was used for when a depth/stencil attachment is needed, or the VK_EXT_multisampled_render_to_single_sampled extension. The logic that decided this was "has D/S resolve || has MSRTSS extension", but the function itself asserted that the render pass is using MSRTSS if not D/S resolve. This caused an assertion failure on platforms where MSRTSS is present, but a non-MSRTSS render pass is used. Bug: chromium:1201455 Change-Id: Iefd26a071303c703a322d946f82474f85f5bf767 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2849180 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 0c77f3ad 2021-03-10T15:58:00 Vulkan: Implement shader buffers descriptor cache. Implements a descriptor set cache for UBOs, SSBOs, and atomic counter buffers. Storage Images and framebuffer fetch input attachments are not yet included. Requires moving the buffer barrier handling into ContextVk, similarly to how we handle the barriers for Textures. The packed description key for the descriptors uses a "fast" vector with a basic minimum size. For most cases of a few buffers this will fit easily in stack memory, but for larger programs with many buffers we fit this into heap memory. The key has a large upper bound due to the high ES 3.2 requirements and the need to index several values such as the offset and binding size. We use dynamic offsets for uniform buffers when possible. This ensures applications like Manhattan 3.1 that use sets of common buffers with changing offsets hit the cache most of the time. Because of resource limits we pick at compilation time whether to use dynamic or static descriptor sets. Mostly this applies to tests that use a large number of uniform buffers. A future implementation could be smart and would recompile the program with heuristics to use a minimal number of dynamic indices. Reduces the number of descriptor set updates from ~300 -> ~30 per frame in Manhattan 3.1 and in Asphalt 9 from 900+ to as low as 0 per frame. Bug: angleproject:5736 Change-Id: I5c2a3881bec90d301dab15cc86c8a70e60674ad7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2757515 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 065c2329 2021-04-08T11:59:43 Reland "Vulkan: Add features to modify sampling parameters" This reverts commit a51b57fa2dc73f8bc8acdf0b818cc0315fb23d75. Original change's description: > Revert "Vulkan: Add features to modify sampling parameters" > > Bug: b/167404532 > Change-Id: Iae19dfe165074e8c01216312bddd744c4fb504a4 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510012 > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/167404532 Change-Id: I2c756b8eb0f61701ef6e33275e557bc199a4d3b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815259 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi d1462228 2021-03-09T11:25:36 Vulkan: Use VK_EXT_multisampled_render_to_single_sampled Additionally, makes the emulation path not require independentResolveNone. This was only used to select the NONE resolve mode when the attachment format doesn't have either of depth or stencil aspects, but it's ok to specify the same resolve mode for both aspects even if one aspect is missing. Bug: chromium:1088005 Change-Id: Ifc37cbf5331145179c5927853b996a0d62b871ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743666 Reviewed-by: David Reveman <reveman@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill 572fd801 2021-03-22T16:14:34 Vulkan: Rename Uniforms/XFB descriptor desc. The new name is more consistent with the other names. Refactoring change only. Bug: angleproject:5736 Change-Id: Idc47fef29040e3a422267795c4536163a6f8eb4e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2779953 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao 867411a4 2021-03-08T19:08:14 Vulkan: Track images used for both attachment and sampler This CL adds a new layout ImageLayout::ColorAttachmentAndShaderRead. We detect that the same ImageHelper object is used for both sampler and attachment and will pick this new layout instead of ColorAttachment. Bug: b/175584609 Change-Id: I2089f59d4dc1ad4de7edab0e067797adcfa9b020 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2749479 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>
Jamie Madill b717952e 2021-03-18T10:39:34 Vulkan: Use packed enum map for descriptor set index. This simplifies a lot of the data structure indexing in the program executable class. Also renames the "DriverUniforms" and "InternalShader" index into a single "Internal" index. Bug: angleproject:5736 Change-Id: I2a51d8b14d5b16b438dbe636f77b11bbc045ba9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2773321 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Mohan Maiya 81dcf078 2021-03-08T11:21:31 Reland "Vulkan: Support EXT_sRGB_write_control" This is a reland of 6073af536cf627742696823edc82c9b0a481a8bc with 2 changes - 1. Don't enable the extension even in nonConformant mode 2. Don't enable VK_KHR_image_format_list for swiftshader Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075 Change-Id: I8e149d196a39c3c4769bfa8690792f3c53831299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2762647 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Peng Huang b27740f3 2021-03-09T16:15:15 Revert "Vulkan: Support EXT_sRGB_write_control" This reverts commit 6073af536cf627742696823edc82c9b0a481a8bc. Reason for revert: crbug.com/1186140 Original change's description: > Vulkan: Support EXT_sRGB_write_control > > Implement support for EXT_sRGB_write_control. This extension > requires VK_KHR_image_format_list to be supported. > > The spec requires this functionality to work with glBlitFramebuffer > as well but support for that will be added in a follow up change. > As such, this extension is only exposed in non-conformant mode. > > Bug: angleproject:5075 > Tests: SRGBFramebufferTest.*Vulkan* > Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:5075,chromium:1186140 Change-Id: Ib0d4d60fe7434fb950f99db2c210aab9af7d2d0e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743663 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Peng Huang <penghuang@chromium.org>
Mohan Maiya 6073af53 2021-03-08T11:21:31 Vulkan: Support EXT_sRGB_write_control Implement support for EXT_sRGB_write_control. This extension requires VK_KHR_image_format_list to be supported. The spec requires this functionality to work with glBlitFramebuffer as well but support for that will be added in a follow up change. As such, this extension is only exposed in non-conformant mode. Bug: angleproject:5075 Tests: SRGBFramebufferTest.*Vulkan* Change-Id: I59b38f6cd810a3d0d67ec29f4f19c25f65f70862 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2617243 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya 907a3cee 2021-02-17T08:07:45 Vulkan: Add support for EXT_shader_framebuffer_fetch_non_coherent EXT_shader_framebuffer_fetch_non_coherent is implemented using subpass input attachments. The extension will be enabled in a follow up change that adds required changes to the Vulkan translator. Bug: angleproject:5454 Test: FramebufferFetchNonCoherentES31.*Vulkan Change-Id: Ic73c66a476c4a21db5269431166a198841f1dc0c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2598059 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tim Van Patten 64b5b3d3 2021-02-12T17:31:58 Vulkan: Further restrict enabling LINE_RASTERIZATION_MODE_BRESENHAM The app "Car Parking Multiplayer" enables GL_SAMPLE_ALPHA_TO_COVERAGE, which leads to a VVL error when LINE_RASTERIZATION_MODE_BRESENHAM is also enabled: VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766: The Vulkan spec states: If the lineRasterizationMode member of a VkPipelineRasterizationLineStateCreateInfoEXT structure included in the pNext chain of pRasterizationState is VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT or VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT and if rasterization is enabled, then the alphaToCoverageEnable, alphaToOneEnable, and sampleShadingEnable members of pMultisampleState must all be VK_FALSE. This CL adds the additional checking to GraphicsPipelineDesc::initializePipeline() to ensure those conditions are met before setting lineRasterizationMode to VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT. Bug: angleproject:5613 Test: StateChangeTest.AlphaToCoverageEnable Change-Id: Ie2286078f6916c01a19ae6f932321a86619bd4e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2694094 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten 80308e20 2021-02-08T16:16:36 Vulkan: Match min/magFilter to chromaFilter VkSamplerCreateInfo.magFilter and minFilter must match VkSamplerYcbcrConversionCreateInfo.chromaFilter. VkSamplerYcbcrConversionCreateInfo.chromaFilter is currently hard-coded to VK_FILTER_NEAREST in HardwareBufferImageSiblingVkAndroid(), so force magFilter and minFilter to VK_FILTER_NEAREST in SamplerDesc::init() if an externalFormat is being used. Bug: b/178424566 Change-Id: Ia1f7fc21e3faa4e57f837ed3ae70608134150aea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2683038 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill df48c027 2021-02-02T13:34:29 Vulkan: Don't request aliased FB attachments. This produces undefined pixel values in GL. We can also return UNSUPPORTED if required and still be conformant. This fixes an assert in the gfx-rs portability implementation. Bug: angleproject:5601 Change-Id: Ifb84ad9b5e2365360a81cddba766b0bea81f2d51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2668311 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Brandon Schade 6cc845bb 2020-12-07T18:14:50 Vulkan: Add support for EXT_blend_func_extended This implementation utilizes vulkan's dualSrcBlend feature. Expose this extension if the underlying vulkan backend allows the use of this feature. Test: angle_end2end_tests --gtest_filter=EXTBlendFuncExtendedDrawTest* Bug: angleproject:5074 Change-Id: I7d2f611df89d65e5cac35158cb5f41a0ebd58aae Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2593151 Commit-Queue: Brandon Schade <b.schade@samsung.com> Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b912eec5 2020-11-27T11:08:41 Vulkan: Support GL_EXT_tessellation_shader. Shader translator changes done in http://crrev.com/c/2633936 Adds a new DIRTY_BIT_PATCH_VERTICES state to Context. Supportes state query and transform feedback. 4 test suppressions remain as follow-up fixes. Adds a new varying packing mode for a simple Vulkan rule set. Based on work by Mohan Maiya (m.maiya@samsung.com). Test: dEQP-GLES31.functional.tessellation.* Bug: angleproject:3572 Change-Id: I4cad2cca30adb754fd12c83027673906541f566a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568234 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Stephan Hartmann d21d682d 2021-01-11T12:59:53 libstdc++: fix incomplete type for FramebufferCache libstdc++ does not allow incomplete type for T2 with std::pair<T1,T2> and fails with: .../../src/libANGLE/renderer/vulkan/vk_cache_utils.h:1570:64: required from here /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/stl_pair.h:215:11: error: std::pair<_T1, _T2>::second has incomplete type 215 | _T2 second; /// @c second is a copy of the second object | ^~~~~~ https://chromium-review.googlesource.com/c/angle/angle/+/2580111 added class FramebufferCache with incomplete type in |mPayload| to vk::FramebufferHelper. Changing include order is not an option. However, FramebufferCache is only used in FramebufferVk and we can make it local there. Bug: chromium:957519 Change-Id: I5fbdca23adbb9f4aecc266988c02fb0d051504cb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2621473 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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>
Mohan Maiya 98b56e60 2020-12-12T16:28:21 Vulkan: Accumulate internal cache stats in renderer The CacheStats of all internal caches are accumulated by the renderer. In order to see the hit ratios of all caches, the following GN args must be enabled: is_debug = true angle_enable_perf_counter_output = true Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: Iaca3249192e9e4e130d8291b7759c459d79b06ee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2588430 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Mohan Maiya 46eaba7f 2020-12-12T10:31:26 Vulkan: Add support for internal cache hit and miss counts Add a CacheStats class that provides cache hit and miss bookkeeping. All internal caches make use of this class to keep track of its stats. This provides a means to profile cache hit ratios a.k.a Vulkan object reuse for any application. Bug: angleproject:5447 Test: Manual verification with angle_end2end_tests Change-Id: I44eeb0c2b9b291ec1cdd156fb2be4a5fe80d2848 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2580111 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 56330564 2020-12-10T00:46:04 Vulkan: Support layered framebuffers This feature is introduced by geometry shaders, where all the layers of a texture can be attached to a framebuffer. The geometry shader would use gl_Layer to decide which layer the primitive should be rendered to. Bug: angleproject:3571 Change-Id: Ib2ae8e227b226295f9e2f62f6b230839070bc95c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2582711 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao 067a12f0 2020-11-19T16:47:25 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This is a reland of ff38106d62fca2e36ec2db1cd580b546fd53ae43 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/173800146 Change-Id: Ifc36086f4c5d6a44fb5456aa6e31bc8a783bba71 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2579648 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Ian Elliott 1ad5791d 2020-12-03T22:05:51 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Suspect that this CL may be causing win-angle-rel-32 bot failures Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: b/173800146 Change-Id: I7bc9966ebbe949f3999d7927afa629dd2e3a4187 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2572801 Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
Jamie Madill 720b85e6 2020-12-01T20:45:29 Reland "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit b1917fe1a314709cd9f7f53b2923d6be0e8bbf6c. Reason for revert: Not the root cause. See bug. Original change's description: > Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" > > This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. > > Reason for revert: Speculative revert to clear up AMD. See bug. > > Bug: chromium:1154356 > > Original change's description: > > Vulkan: Use specialization constant for halfRenderAreaWidth > > > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > > shader via specialization constant, thus allow compiler to consolidate > > the calculation into one MAD instruction. > > > > Bug: b/173800146 > > Change-Id: Id66301278e3389e2582369b695825e632bccecee > > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > > Commit-Queue: Charlie Lao <cclao@google.com> > > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Tim Van Patten <timvp@google.com> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com > > Change-Id: Idab612bcad4f179857c41ffc4bf8fa2355fae946 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: b/173800146 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568244 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com # Not skipping CQ checks because this is a reland. Bug: chromium:1154356 Bug: b/173800146 Change-Id: I5b86bbee8600c6597620f31d8d7b08ca8b3d2d57 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568246 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill b1917fe1 2020-12-01T20:42:36 Revert "Vulkan: Use specialization constant for halfRenderAreaWidth" This reverts commit ff38106d62fca2e36ec2db1cd580b546fd53ae43. Reason for revert: Speculative revert to clear up AMD. See bug. Bug: chromium:1154356 Original change's description: > Vulkan: Use specialization constant for halfRenderAreaWidth > > halfRenderArea is used by fragment shader to adjust gl_FragCoord for > rotation and yflip compensation. This CL bakes halfRenderAreaWidth into > shader via specialization constant, thus allow compiler to consolidate > the calculation into one MAD instruction. > > Bug: b/173800146 > Change-Id: Id66301278e3389e2582369b695825e632bccecee > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 > Commit-Queue: Charlie Lao <cclao@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Tim Van Patten <timvp@google.com> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=timvp@google.com,syoussefi@chromium.org,jmadill@chromium.org,cclao@google.com Change-Id: Idab612bcad4f179857c41ffc4bf8fa2355fae946 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: b/173800146 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2568244 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Charlie Lao ff38106d 2020-11-19T16:47:25 Vulkan: Use specialization constant for halfRenderAreaWidth halfRenderArea is used by fragment shader to adjust gl_FragCoord for rotation and yflip compensation. This CL bakes halfRenderAreaWidth into shader via specialization constant, thus allow compiler to consolidate the calculation into one MAD instruction. Bug: b/173800146 Change-Id: Id66301278e3389e2582369b695825e632bccecee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551541 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi a5da17cd 2020-11-26T17:09:37 Vulkan: Remove vk:: inside namespace vk Bug: angleproject:5404 Change-Id: I51df1ad69a65b17621a3cbe4e5d55621cc9ae6ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2562683 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Anders Leino 4e913d34 2020-11-02T10:44:51 Vulkan: Work around Nvidia depth clamping bug In GL ES, depth is always clamped to [0,1]. The same is true in Vulkan, but not for implementations affected by Nvidia bug 3171019. This patch implements a workaround. The workaround introduced test failures on Linux with Nvidia Quadro P400 and driver version 418.56, so it's only applied conditionally, and as a result the test failure expectations are not removed completely. Bug: angleproject:3970 Change-Id: I0d9f855d7f3df72fea4af9f9b134ae3177cf820d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2514377 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 130597e1 2020-11-23T18:59:02 Vulkan: Use PackedScissor struct to reduce GraphicsPipelineDesc size We are running out of space in GraphicsPipelineDesc. According to gpuinfo, the max reported viewport size is 32768. This CL changes scissor's x/y/w/h from uint32_t to uint16_t, which saves two uint32_t for other usages. Bug: b/173800146 Change-Id: Icf2d8ba8ea8a8c412ecef2059401a8d831c410e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2557218 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 86d7e4d8 2020-11-10T15:55:34 Vulkan: Support texture buffers Texture buffers are placed in the same descriptor set with the rest of the textures. However, the different code paths that handle textures have special cases for texture buffers as they create a different descriptor type (texel buffer instead of combined image sampler). Image view serials are used to track the buffer view serials as well so the texture descriptor cache can handle texture buffers as well. This CL is missing storage texel buffer support. Bug: angleproject:3573 Change-Id: Iff80ca22ff9b9957a0c9a3c7aaada1fa54b24ec8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2532653 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Charlie Lao b22f8e8e 2020-10-29T15:50:39 Vulkan: Add specialization constants for surface rotation This plumbing through the specialization constant for surface rotation from ContextVk to pipeline program creation. It has not been used yet, so expecting no real functional change. This CL also converts lineRasterEmulation to use the same specialization constant path as surface rotation. Bug: b/171750979 Change-Id: Ic08c4f8bb576424d1752015e874d0977a58d78bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2508837 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang a51b57fa 2020-10-30T10:00:05 Revert "Vulkan: Add features to modify sampling parameters" Bug: b/167404532 Change-Id: Iae19dfe165074e8c01216312bddd744c4fb504a4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2510012 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Courtney Goeltzenleuchter f51e99fb 2020-10-13T11:38:28 Vulkan: Remove serial from RenderPassHelper We don't delete RenderPass's so no need to keep a serial. This simplifies things for coming threading code. Bug: b/169788986 Change-Id: I2577b17bc1f6af163725389589d7cd62d09eea13 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2468538 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com>
Shahbaz Youssefi df8f71d1 2020-10-09T15:27:28 Vulkan: Don't break the render pass on scissored clears clearImmediatelyWithRenderPassOp is removed and the draw path is used for the scissor. That path was added to avoid creating a large number of graphics pipelines due to the scissor state. This is now done by using dynamic state for scissor in the draw path for clear. Running the following dEQP tests without and with dynamic state for scissor: dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_ops.* the number of graphics pipelines is reduced from 95392 to 16. Bug: angleproject:4617 Bug: angleproject:4836 Change-Id: Ib373d8cd23ca2b67e6fd26aa2a1103f281f7e473 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2463985 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao df6b7298 2020-10-12T13:39:09 Vulkan: Use StoreOp_None_QCOM for read only depth stencil buffer For read only depth stencil buffers, there is no need to store depth or stencil value. But we can not use DontCare for storeOp because vulkan core spec says DontCare indicates data is undefined after this. VK_QCOM_render_pass_store_ops extension introduces a new store op that will leave data defined but skip the store. This CL utilize this if the extension is available. Bug: angleproject:5055 Change-Id: I104f3d01eb342a2d0cc900f342430e901bde1bff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462604 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi f8070feb 2020-10-09T11:03:29 Vulkan: Use depthClamp to clear depth where available This will avoid breaking render pass if clearing depth in clearWithDraw. Bug: angleproject:4836 Change-Id: I50242d1115efc91059923143f6ae5fd25fb3d36f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2462717 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 5081f89b 2020-10-02T01:15:37 Vulkan: Support invalidate of MSRTT attachments Invalidate was previously affecting only the storeOp of the color and depth/stencil attachments. With multisampled-render-to-texture attachments, the storeOp of the resolve attachments were not being affected. This change implements the latter, attempting to remove the attachment altogether if possible. With MSRTT depth/stencil buffers, this makes possible the ability to never write depth/stencil data to memory. Bug: angleproject:4836 Change-Id: I53599e2f4ed6c390dfd03bf226274f6f53f438bb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437506 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 887b1346 2020-10-02T01:12:01 Vulkan: Add resolve/unresolve counters With this change, render-pass-related counters are calculated at render pass creation time and stored alongside the render pass handle (and serial) in the render pass cache. On every use, the render pass' counters are accumulated over the global counters. Additionally, this change adds MSRTT resolve and unresolve counters to render pass counters. Bug: angleproject:4836 Change-Id: If15a789e5a7d66c7ea5a2315bc76fe045ce57491 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444099 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao 22ed1e59 2020-10-05T17:59:27 Vulkan: Remove depth stencil access out of RenderPassDesc Vulkan spec says that image layout is not counted toward render pass compatibility: "Two render passes are compatible if their corresponding color, input, resolve, and depth/stencil attachment references are compatible and if they are otherwise identical except for: Initial and final image layout in attachment descriptions Image layout in attachment references" This CL removes the depth stencil access mode information out of RenderPassDesc structure. It is essentially partially reverted the change from crrev.com/c/2354280 Bug: b/170134600 Change-Id: Iada4d89c3249489b47db3046952e7cb10f252891 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2451597 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev d5fa6ea9 2020-04-29T04:13:54 Vulkan: Implement OES_draw_buffers_indexed Bug: angleproject:4394 Change-Id: I7db9c695c233b2daf740acc654b1b2e546a8b681 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2172739 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mohan Maiya 9f5eb0b8 2020-10-05T08:18:05 Vulkan: Add OES_sample_shading extension support Support OES_sample_shading extension if the underlying Vulkan ICD supports sampleRateShading. Bug: angleproject:3587 Tests: dEQP-GLES31.functional.sample_shading.* Change-Id: I1b324c1ad3ea3b2157d3cbe0abcdf7085aa4231b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444213 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 50070481 2020-10-02T01:03:41 Vulkan: Render pass creation cleanup Bug: angleproject:4836 Change-Id: If7b0beef4b32149bebb0f63558ac34d0c3cd79c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2444098 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Trevor David Black e815afbf 2020-09-07T22:09:22 First pass at increasing inclusivity Link to the inclusivity rules https://source.android.com/setup/contribute/respectful-code Bug: b/162834212 Bug: chromium:1097198 Change-Id: Ied5a9e3879d72bff3f77ea6fcda9b82f30c32c2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2396737 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Trevor Black <vantablack@google.com>
Shahbaz Youssefi 2f3d18f2 2020-10-01T05:58:44 Vulkan: Fix unresolve disagreement between FB and RP FramebufferVk::updateRenderPass reset the render pass description, but not the framebuffer description. This caused a disagreement between the two regarding which attachments need to be unresolved. Later, FramebufferVk::startNewRenderPass could miscalculate whether a new framebuffer needs to be generated based on changes in unresolve attachments. For example: - say in the first render pass color needs to be unresolved. Both RP and FB desc would remember this (each being keys for their respective caches). - A following operation triggers syncState such that FB desc changes (for example rebind of attachment), which cleared RP desc but not FB desc's unresolve attachment state. - If the next render pass does not require an unresolve (for example due to a clear or invalidate), then the framebuffer is not recreated because according to RP desc at the start and end of FramebufferVk::startNewRenderPass there has been no change in unresolve mask. * At start there's no unresolve because of syncState clearing it. * At end there's no unresolve because there's no need for unresolve. - In the end, the framebuffer used for the first render pass would be used for the second render pass as well. Note that: * The first render pass included an unresolve, i.e. two subpasses. * The second render pass requires one subpass according to its RP desc. It's quite easy to accidentally have the framebuffer correctly recreated (based on the reset RP desc) before FramebufferVk::startNewRenderPass. Note that since syncState has called updateRenderPass, FB desc has necessarily changed, and mFramebuffer is nullptr, so any call to FramebufferVk::getFramebuffer would recreate the framebuffer. Both clear and invalidate call FramebufferVk::getFramebuffer. The issue is reproducible in situations where clear/invalidate has been called before the framebuffer is modified, and then draw is issued after the modification. An ASSERT is added to catch discrepencies between RP desc and FB desc to catch bugs even when the issue doesn't manifest itself as a VVL error. Bug: angleproject:4836 Change-Id: I8a0d116402a6c298377d03e0908baa942019ccd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2442379 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 01641c7a 2020-09-30T15:25:28 Vulkan: Fix UtilsVk clear in non-zero subpass Mid-render-pass clears (through UtilsVk) run on the current subpass, which in the presence of multisampled-render-to-texture unresolve would be subpass 1. The graphics pipeline for that draw call should set the correct subpass index. Bug: angleproject:4836 Change-Id: Iba4a03ea96a63b0f5d09c27e5283ff8a8b534e05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2441509 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi 463e02e6 2020-09-29T14:46:46 Vulkan: Constants for unpacked D/S attachment indices kClearValueDepth/StencilIndex is renamed and repurposed in other places where depth and stencil are placed at indices MAX_DRAW_BUFFERS and MAX_DRAW_BUFFERS+1. Bug: angleproject:4836 Change-Id: Idaeff5017d944d786a5f388c4f1ce3a4e3fe9b7d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2437505 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 43163491 2020-09-22T11:45:06 Vulkan: Unresolve depth/stencil MSRTT attachments Using the same shader that unresolves color, this change allows depth/stencil to be unresolved as well. In turn, this allows the depth and stencil loadOp/storeOp of the implicit multisampled image associated with a multisampled-render-to-texture renderbuffer to be set to DONT_CARE. Stencil unresolve depends on VK_EXT_shader_stencil_export. In the absence of this extension, the stencil aspect is not unresolved and must continue to use loadOp=LOAD and storeOp=STORE. This is not ideal, but the expected use-case of depth/stencil MSRTT renderbuffers is that they get invalidated, so that load and store wouldn't happen in practice. Bug: angleproject:4836 Change-Id: I9939d1e15e10fa8ed285acdd6fe6edb42c59054f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2427049 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao ae24f28a 2020-09-22T17:33:32 Vulkan: Move mReadOnlyDepth out of FramebufferDesc The depth read only or not should not affect VkFramebuffer creation. RenderPasses with just depthstencil layout differences are considered compatible. This CL moves this out of FramebufferDesc into FramebufferVk. Bug: b/168953278 Change-Id: I5bd05b262b7b3b0dc70f9fb8fc4a3db5e7082916 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425032 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao d59bccb5 2020-09-23T10:20:35 Vulkan: updateRenderPassDesc may lose color attachment data FramebufferVk::updateRenderPassDesc() is resetting entire mRenderPassDesc, which may lose color unresolve attachments. This CL makes sure that when we toggle depth stencil buffer's read/write access, we do not reset the whole mRenderPassDesc. Instead we only update the depth stencil attachment's access. Bug: b/168953278 Change-Id: Ia9df2d8ac81ebf2da8a360ba1293faf6c14b2738 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2426468 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi a76b6836 2020-09-17T22:40:42 Vulkan: Support MSRTT depth/stencil resolve VK_KHR_depth_stencil_resolve is used by this change to resolve depth/stencil multisampled-render-to-texture renderbuffers. This extension is not widely supported yet. If it's not present, the depth/stencil resolve operation is silently ignored and the renderbuffer acts as a normal multisampled one. This is not correct, but our primary user (Chrome), and most applications don't care for the resolved depth/stencil data. In fact, it's recommended for the depth/stencil attachment to be invalidated after rendering. Exposing EXT_multisampled_render_to_texture even in the absence of depth/stencil resolve allows the majority of the applications to still take advantage of MSRTT color attachments. Bug: angleproject:4836 Change-Id: I6ba4187344a0c9330d2c77bdc5e2c6fc5483c299 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2417645 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Geoff Lang f0b02054 2020-08-06T20:55:05 Add a Vulkan feature to compress float32 vertex formats. Use the vertex conversion pipeline in VertexArrayVk to detect static vertex data and convert float32 vertices to float16. This feature is useful for determining if an allication is vertex bandwidth bound and seeing what gains could be had by using smaller attributes. This feature could be implemented in ANGLE's frontend but new infrastructure for converting and storing the converted attributes would need to be added to gl::VertexArray. Our backends already have the functionality needed to handle unsupported attribute formats and this can be repurposed for compressing vertex formats. Bug: b/167404532 Bug: b/161716126 Change-Id: I9a09656a72e8499faa4124adf876d7261c8341c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2342285 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 49f01a53 2020-09-18T11:38:14 Vulkan: Add features to modify sampling parameters Add features to optionally increase the LoD offset of all sampling operations or disable linear filtering. These can be used to compare performance without recompiling ANGLE. These features could be potentially implemented in the frontend it is more difficult because the features are not available at texture initialization time. Bug: b/167404532 Change-Id: Ifcf56fbcf130c24c54834737733bbffa5ade3959 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2411475 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Shahbaz Youssefi f39e0f01 2020-09-07T23:07:37 Vulkan: Use subpass to unresolve render-to-texture attachments GL_EXT_multisampled_render_to_texture allows singlesampled textures to be used with multisampled framebuffers in such a way that the final resolve operation is automatically done. In Vulkan terminology, the render-to-texture GL attachment is used as a Vulkan subpass resolve attachment with an implicit (ideally-)lazy-memory multisampled image as the color attachment. This extension expects that if the texture is drawn to after the automatic resolve, the implicit multisampled image would take its fragment colors from the singlesampled image. In other words, the opposite of a resolve operation should be automatically performed at the start of the render pass. This change refers to this operation as "unresolve". The goal of this extension is to allow tiling GPUs to always keep multisampled data on tile memory and only ever load/store singlesampled data. The latter is achieved by using a subpass resolve attachment and setting storeOp of the multisampled color attachment to DONT_CARE. This change achieves the former by using an initial subpass that uses the resolve attachment as input attachment, draws into the multisampled color attachment and sets loadOp of said attachment to DONT_CARE. Bug: angleproject:4881 Change-Id: I99f410530365963567c77a7d62fc9db1500e5e3e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2397206 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang f17cd288 2020-09-18T11:36:50 Refactor IsMipmapFiltered to take the min filter directly. This function is more useful if it takes just the min filter mode instead of the entire sampler struct to read a single member. Bug: b/167404532 Change-Id: Ie8c01c4095a615f06fe046fb175cdfb92fa54cbf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2419111 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 8d4331ee 2020-09-16T00:42:08 Vulkan: Free up 5 bits in RenderPassDesc Leveraging the fact that there are only a handful of depth/stencil formats, the last element of RenderPassDesc::mAttachmentFormats can contain other information in addition to the depth/stencil format ID. The FormatID enum is rearranged such that depth/stencil formats are placed first, as a result occupying values in [1, 7]. These values take up 3 bits in an element of RenderPassDesc::mAttachmentFormats (which could be the last element if all color draw buffers are attached). As a result, the upper 5 bits of the last element of RenderPassDesc::mAttachmentFormats is unused. It is intended for these bits to be used in the implementation of multisampled-render-to-texture depth/stencil renderbuffers. Bug: angleproject:4836 Change-Id: I0786e0712539cdbbf5494ec83aeee1dd93f936dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2413165 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev ed01473e 2020-09-12T13:01:05 Vulkan: Fix blendEnable-02023 VU Enable BlendIntegerTest Add DrawBuffersTest.BlendWithGaps test Add BlendPackedTest Bug: angleproject:4548 Bug: angleproject:4571 Bug: angleproject:4583 Change-Id: I139183099b26f0fe1ac9e43f96d18b8ccb134a2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2407772 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Charlie Lao 06b4fb92 2020-09-11T21:24:46 Vulkan: Fool proof packed attachment index to vulkan and from OpenGL ANGLE packs FBO attachments from OpenGL and uses packed attachments to create VkFramebuffer and renderpass. When we use attachment index into the attachment array, we must be very careful to use packed index for vulkan objects. It is easy to make mistakes here and introduce hard to debug bugs. This CL defines a PackedAttachmentIndex class that uses that to index into vulkan attachments and pass around APIs so that compiler would catch the error when wrong index is used. This also introduces PackedClearValuesArray that stores clear value in packed attachment index so that it is impossible to mix it with ClearValuesArray that stores clear value in GL attachment index. Bug: b/167301719 Change-Id: I68680522c60beeb5096e5211eaef89da28c7097e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2410366 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Charlie Lao e4e2a016 2020-09-01T11:23:09 Vulkan: Use color mask to handle draw buffer disabled case When draw buffers set to GL_NONE, instead of remove the attachment from renderpass which breaks renderpass, we force vulkan's per buffer color mask to false while keep the disabled draw buffer attached. This CL also always create FrameBuffer with all color attachments regardless it is enabled or not. Bug: b/167301719 Change-Id: Ice9fca9aacf774a47d13b749f822b222cc050174 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2389007 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
Shahbaz Youssefi cba9bbbe 2020-09-02T09:55:31 Vulkan: Fix resolve-with-subpass retaining resolve attachment The temporary resolve attachment used to optimize blit was not removed from the framebuffer and render pass descriptions, resulting in subsequent draws to be resolved again. Bug: b/159903491 Change-Id: I9a9c90d25cb07ba9a25999f808b164f9085387d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2390441 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Tim Van Patten 85ddcc93 2020-08-24T14:22:22 Vulkan: Convert ProgramExecutableVk::mDescriptorSets to std::array Currently ProgramExecutableVk::mDescriptorSets is a vector, but it's size is bound so it can be a std::array (DescriptorSetLayoutArray). To ensure the size grows correctly in the future, the various descriptor set indexes are also being converted from independent constexpr uint32_ts into the enum DescriptorSetIndex. Bug: angleproject:4898 Test: CQ Change-Id: I7ae8ff3455bcfb61e24b73bd16cc3f8cf9873087 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372664 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Tim Van Patten dff47d5f 2020-07-14T19:10:12 Vulkan: Optimize MSAA using subpass resolve attachments If a user is performing a blit to resolve a multisample color buffer into a single attachment, ANGLE can use subpass resolve attachments to resolve directly into the destination buffer as part of the render pass. This allows the data to remain in tiler memory and reduce the extra bandwidth required to write the multisampled data back to perform the copy. This work also requires restoring/reopening a render pass if it has been finished already, assuming the finished render pass was started and for the framebuffer that is the source for the blit command. Other objects that were created when the render pass was started need to be updated as well, such as the source FramebufferVk's resolve attachment, the CommandBufferHelper's vk::Framebuffer and vk::RenderPassDesc, etc. While this is better than performing vkCmdResolveImage(), there is still another major part of optimizing MSAA using resolve attachments not implemented here: discarding the multisampled image rather than writing it to GMEM, which requires the user to invalidate the read FBO after the blit. This CL was verified with AGI to make sure there are no explicit blits to resolve the multiple sampled image. Bug: b/159903491 Test: FramebufferTest_ES31.*Blit* Test: VulkanPerformanceCounterTest_ES31.MultisampleResolveWithBlit Change-Id: I320a26088d8f614a295e7feec275d71310391806 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2298663 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>