panvk: report the maximum supported size for a variable count iub
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

If VkDescriptorSetVariableDescriptorCountLayoutSupport is passed to
vkGetDescriptorSetLayoutSupport, we should report the maximum size in
bytes for inline uniform blocks.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Fixes: 5fe5e317 ("panvk: advertise descriptor indexing on valhall")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35545>
This commit is contained in:
John Anthony 2025-06-19 14:08:18 +02:00 committed by Marge Bot
parent 1b309e77fc
commit cce2fa9af6
3 changed files with 27 additions and 8 deletions

View file

@ -19,10 +19,11 @@
#include "genxml/gen_macros.h"
#define PANVK_DESCRIPTOR_SIZE 32
#define MAX_DYNAMIC_UNIFORM_BUFFERS 16
#define MAX_DYNAMIC_STORAGE_BUFFERS 8
#define MAX_PUSH_DESCS 32
#define PANVK_DESCRIPTOR_SIZE 32
#define MAX_DYNAMIC_UNIFORM_BUFFERS 16
#define MAX_DYNAMIC_STORAGE_BUFFERS 8
#define MAX_PUSH_DESCS 32
#define MAX_INLINE_UNIFORM_BLOCK_SIZE (1 << 16)
#define MAX_DYNAMIC_BUFFERS \
(MAX_DYNAMIC_UNIFORM_BUFFERS + MAX_DYNAMIC_STORAGE_BUFFERS)

View file

@ -253,6 +253,7 @@ panvk_per_arch(GetDescriptorSetLayoutSupport)(
unsigned desc_count = 0, dyn_buf_count = 0, non_variable_count = 0,
variable_stride = 0;
VkDescriptorType variable_type = {0};
for (unsigned i = 0; i < pCreateInfo->bindingCount; i++) {
const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[i];
VkDescriptorType type = binding->descriptorType;
@ -321,6 +322,7 @@ panvk_per_arch(GetDescriptorSetLayoutSupport)(
type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK ? 4 : 1;
}
variable_type = type;
variable_stride = stride;
assert(variable_stride);
}
@ -340,7 +342,24 @@ panvk_per_arch(GetDescriptorSetLayoutSupport)(
return;
pSupport->supported = true;
if (var_desc_count)
var_desc_count->maxVariableDescriptorCount = variable_stride != 0 ?
(PANVK_MAX_DESCS_PER_SET - non_variable_count) / variable_stride : 0;
if (!var_desc_count)
return;
var_desc_count->maxVariableDescriptorCount = 0;
if (!variable_stride)
return;
if (variable_type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) {
/* Maximum byte size for inline uniform block */
unsigned available_size =
panvk_get_iub_size(PANVK_MAX_DESCS_PER_SET - non_variable_count);
var_desc_count->maxVariableDescriptorCount =
MIN2(available_size, MAX_INLINE_UNIFORM_BLOCK_SIZE);
} else {
/* Maximum descriptor count for any other descriptor type */
var_desc_count->maxVariableDescriptorCount =
(PANVK_MAX_DESCS_PER_SET - non_variable_count) / variable_stride;
}
}

View file

@ -32,7 +32,6 @@
* descriptor metadata */
#define RESERVED_UBO_COUNT 6
#define MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS (32 - RESERVED_UBO_COUNT)
#define MAX_INLINE_UNIFORM_BLOCK_SIZE (1 << 16)
void
panvk_per_arch(get_physical_device_extensions)(