From 764c8867b046db4bb0bdaabc068ada35d5d7c4b4 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 25 Jan 2022 12:53:20 +0100 Subject: [PATCH] v3dv: document why we don't expose VK_EXT_scalar_block_layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And since this is an optional feature in Vulkan 1.2, fill in the corresponding feature query while we are at it. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_device.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 7282236f15e..47d94fbfde7 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -1088,6 +1088,15 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, .hostQueryReset = true, .uniformAndStorageBuffer8BitAccess = true, .uniformBufferStandardLayout = true, + /* V3D 4.2 wraps TMU vector accesses to 16-byte boundaries, so loads and + * stores of vectors that cross these boundaries would not work correcly + * with scalarBlockLayout and would need to be split into smaller vectors + * (and/or scalars) that don't cross these boundaries. For load/stores + * with dynamic offsets where we can't identify if the offset is + * problematic, we would always have to scalarize. Overall, this would + * not lead to best performance so let's just not support it. + */ + .scalarBlockLayout = false, .storageBuffer8BitAccess = true, .storagePushConstant8 = true, }; @@ -1191,6 +1200,13 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT: { + VkPhysicalDeviceScalarBlockLayoutFeaturesEXT *features = + (void *) ext; + features->scalarBlockLayout = vk12.scalarBlockLayout; + break; + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR: { VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR *features = (VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR *)ext;