v3dv: fix descriptor set limits

There were various issues here:
   - MAX_DYNAMIC_UNIFORM_BUFFERS was larger than MAX_UNIFORM_BUFFERS.
   - In some cases we were exposing more than the minimums required.
     While that is not incorrect, it is not following what we have
     been doing in general.
   - The Vulkan spec states that some of the MaxDescriptorSet limits
     need to be multipled by 6 to include all shader stages, even
     if the implementation doesn't support all shader stages.

Fixes: cbd299b051 ('v3dv/device: do not compute per-pipeline limits multiplying per-stage')
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10252>
This commit is contained in:
Iago Toral Quiroga 2021-04-15 11:59:34 +02:00 committed by Marge Bot
parent a0152c5948
commit e7e8464d94
2 changed files with 18 additions and 12 deletions

View File

@ -999,6 +999,8 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
STATIC_ASSERT(MAX_SAMPLED_IMAGES + MAX_STORAGE_IMAGES + MAX_INPUT_ATTACHMENTS
<= V3D_MAX_TEXTURE_SAMPLERS);
STATIC_ASSERT(MAX_UNIFORM_BUFFERS >= MAX_DYNAMIC_UNIFORM_BUFFERS);
STATIC_ASSERT(MAX_STORAGE_BUFFERS >= MAX_DYNAMIC_STORAGE_BUFFERS);
const uint32_t page_size = 4096;
const uint32_t mem_size = compute_heap_size();
@ -1042,13 +1044,17 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
.maxPerStageDescriptorInputAttachments = MAX_INPUT_ATTACHMENTS,
.maxPerStageResources = 128,
.maxDescriptorSetSamplers = V3D_MAX_TEXTURE_SAMPLERS,
.maxDescriptorSetUniformBuffers = MAX_UNIFORM_BUFFERS,
/* Some of these limits are multiplied by 6 because they need to
* include all possible shader stages (even if not supported). See
* 'Required Limits' table in the Vulkan spec.
*/
.maxDescriptorSetSamplers = 6 * V3D_MAX_TEXTURE_SAMPLERS,
.maxDescriptorSetUniformBuffers = 6 * MAX_UNIFORM_BUFFERS,
.maxDescriptorSetUniformBuffersDynamic = MAX_DYNAMIC_UNIFORM_BUFFERS,
.maxDescriptorSetStorageBuffers = MAX_STORAGE_BUFFERS,
.maxDescriptorSetStorageBuffers = 6 * MAX_STORAGE_BUFFERS,
.maxDescriptorSetStorageBuffersDynamic = MAX_DYNAMIC_STORAGE_BUFFERS,
.maxDescriptorSetSampledImages = MAX_SAMPLED_IMAGES,
.maxDescriptorSetStorageImages = MAX_STORAGE_IMAGES,
.maxDescriptorSetSampledImages = 6 * MAX_SAMPLED_IMAGES,
.maxDescriptorSetStorageImages = 6 * MAX_STORAGE_IMAGES,
.maxDescriptorSetInputAttachments = MAX_INPUT_ATTACHMENTS,
/* Vertex limits */

View File

@ -39,20 +39,20 @@
#define MAX_PUSH_CONSTANTS_SIZE 128
#define MAX_UNIFORM_BUFFERS 12
#define MAX_STORAGE_BUFFERS 12
#define MAX_SAMPLED_IMAGES 16
#define MAX_STORAGE_IMAGES 4
#define MAX_INPUT_ATTACHMENTS 4
#define MAX_DYNAMIC_UNIFORM_BUFFERS 16
#define MAX_DYNAMIC_STORAGE_BUFFERS 8
#define MAX_DYNAMIC_BUFFERS \
(MAX_DYNAMIC_UNIFORM_BUFFERS + MAX_DYNAMIC_STORAGE_BUFFERS)
#define MAX_UNIFORM_BUFFERS 12
#define MAX_STORAGE_BUFFERS 4
#define MAX_DYNAMIC_UNIFORM_BUFFERS 8
#define MAX_DYNAMIC_STORAGE_BUFFERS 4
#define MAX_DYNAMIC_BUFFERS (MAX_DYNAMIC_UNIFORM_BUFFERS + \
MAX_DYNAMIC_STORAGE_BUFFERS)
#define MAX_RENDER_TARGETS 4
/* These are tunable parameters in the HW design, but all the V3D
* implementations agree.
*/