From fc17231b2b4eb2e24506db289cf89978779d9204 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 13 Apr 2021 23:19:23 +0200 Subject: [PATCH] v3dv/pipeline: reduce descriptor_map size 64 was a temporary and conservative "big enough" value, but we can do better. Note that as mentioned on the FIXME, we could be even more detailed, adding a descriptor map allocate method based on the descriptor type. That would mean more individual allocations, and slightly more complexity. Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/vulkan/v3dv_private.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index 4abb679..36ecba1 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -1553,18 +1553,30 @@ struct v3dv_pipeline_layout { uint32_t push_constant_size; }; +/* + * We are using descriptor maps for ubo/ssbo and texture/samplers, so we need + * it to be big enough to include the max value for all of them. + * + * FIXME: one alternative would be to allocate the map as big as you need for + * each descriptor type. That would means more individual allocations. + */ +#define DESCRIPTOR_MAP_SIZE MAX3(V3D_MAX_TEXTURE_SAMPLERS, \ + MAX_UNIFORM_BUFFERS, \ + MAX_STORAGE_BUFFERS) + + struct v3dv_descriptor_map { /* TODO: avoid fixed size array/justify the size */ unsigned num_desc; /* Number of descriptors */ - int set[64]; - int binding[64]; - int array_index[64]; - int array_size[64]; + int set[DESCRIPTOR_MAP_SIZE]; + int binding[DESCRIPTOR_MAP_SIZE]; + int array_index[DESCRIPTOR_MAP_SIZE]; + int array_size[DESCRIPTOR_MAP_SIZE]; /* NOTE: the following is only for sampler, but this is the easier place to * put it. */ - uint8_t return_size[64]; + uint8_t return_size[DESCRIPTOR_MAP_SIZE]; }; struct v3dv_sampler { -- 2.7.4