Mesa (master): v3dv/pipeline: reduce descriptor_map size
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 14 11:33:03 UTC 2021
Module: Mesa
Branch: master
Commit: fc17231b2b4eb2e24506db289cf89978779d9204
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc17231b2b4eb2e24506db289cf89978779d9204
Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date: Tue Apr 13 23:19:23 2021 +0200
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 <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10207>
---
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 4abb67979ff..36ecba13055 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 {
More information about the mesa-commit
mailing list