mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +01:00
nvk: Really fix maxVariableDescriptorCount w/ iub
I didn't test "nvk: Fix maxVariableDescriptorCount with iub" as
thoroughly as I should have and it regressed
dEQP-VK.api.maintenance3_check.descriptor_set because we were then
violating the requirement that maxPerSetDescriptors describes a limit
that's guaranteed to be supported (and reported as supported in
GetDescriptorSetLayoutSupport).
That commit was also based on a misreading of nvk_nir_lower_descriptors.c
where I thought that the end offset of an inline uniform block needed to
be less than the size of a UBO. That is not the case - on closer
inspection that code gracefully falls back to placing IUBs in globablmem
if necessary. So, we can afford to be less strict about our IUB sizing
and only require that IUBs follow the existing limit imposed by
maxInlineUniformBlockSize.
Fixes: ff7f785f09 ("nvk: Fix maxVariableDescriptorCount with iub")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37922>
This commit is contained in:
parent
0781edc30f
commit
77cd629b34
1 changed files with 14 additions and 7 deletions
|
|
@ -474,9 +474,6 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
assert(stride <= UINT8_MAX);
|
assert(stride <= UINT8_MAX);
|
||||||
assert(util_is_power_of_two_nonzero(alignment));
|
assert(util_is_power_of_two_nonzero(alignment));
|
||||||
|
|
||||||
variable_is_inline_uniform_block =
|
|
||||||
binding->descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK;
|
|
||||||
|
|
||||||
if (flags & VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT) {
|
if (flags & VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT) {
|
||||||
/* From the Vulkan 1.3.256 spec:
|
/* From the Vulkan 1.3.256 spec:
|
||||||
*
|
*
|
||||||
|
|
@ -486,6 +483,9 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
*/
|
*/
|
||||||
variable_count = MAX2(1, binding->descriptorCount);
|
variable_count = MAX2(1, binding->descriptorCount);
|
||||||
variable_stride = stride;
|
variable_stride = stride;
|
||||||
|
|
||||||
|
variable_is_inline_uniform_block =
|
||||||
|
binding->descriptorType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK;
|
||||||
} else {
|
} else {
|
||||||
/* Since we're aligning to the maximum and since this is just a
|
/* Since we're aligning to the maximum and since this is just a
|
||||||
* check for whether or not the max buffer size is big enough, we
|
* check for whether or not the max buffer size is big enough, we
|
||||||
|
|
@ -507,8 +507,6 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
if (pCreateInfo->flags &
|
if (pCreateInfo->flags &
|
||||||
VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR)
|
VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR)
|
||||||
max_buffer_size = NVK_MAX_PUSH_DESCRIPTORS * nvk_max_descriptor_size(&pdev->info);
|
max_buffer_size = NVK_MAX_PUSH_DESCRIPTORS * nvk_max_descriptor_size(&pdev->info);
|
||||||
else if (variable_is_inline_uniform_block)
|
|
||||||
max_buffer_size = NVK_MAX_INLINE_UNIFORM_BLOCK_SIZE;
|
|
||||||
else
|
else
|
||||||
max_buffer_size = NVK_MAX_DESCRIPTOR_SET_SIZE;
|
max_buffer_size = NVK_MAX_DESCRIPTOR_SET_SIZE;
|
||||||
|
|
||||||
|
|
@ -519,12 +517,21 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
switch (ext->sType) {
|
switch (ext->sType) {
|
||||||
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT: {
|
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT: {
|
||||||
VkDescriptorSetVariableDescriptorCountLayoutSupport *vs = (void *)ext;
|
VkDescriptorSetVariableDescriptorCountLayoutSupport *vs = (void *)ext;
|
||||||
|
uint32_t max_var_count;
|
||||||
|
|
||||||
if (variable_stride > 0) {
|
if (variable_stride > 0) {
|
||||||
vs->maxVariableDescriptorCount =
|
max_var_count =
|
||||||
(max_buffer_size - non_variable_size) / variable_stride;
|
(max_buffer_size - non_variable_size) / variable_stride;
|
||||||
} else {
|
} else {
|
||||||
vs->maxVariableDescriptorCount = 0;
|
max_var_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (variable_is_inline_uniform_block) {
|
||||||
|
max_var_count =
|
||||||
|
MIN2(max_var_count, NVK_MAX_INLINE_UNIFORM_BLOCK_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
vs->maxVariableDescriptorCount = max_var_count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue