mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 03:40:23 +01:00
nvk: Fix descriptor offset alignment
This fixes two bugs. First, we were aligning when setting the bindign offset but not actually applying that alignment to buffer_size so when we incremented by stride * descriptorCount, it incremented starting with the unaligned value. Second, in some cases we return stride = align = 0 and the ALIGN_POT macro will return 0 when something's aligned to 0. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
443717a17e
commit
fff59a5f4f
1 changed files with 8 additions and 4 deletions
|
|
@ -183,10 +183,14 @@ nvk_CreateDescriptorSetLayout(VkDevice _device,
|
|||
nvk_descriptor_stride_align_for_type(binding->descriptorType, type_list,
|
||||
&stride, &align);
|
||||
|
||||
assert(stride <= UINT8_MAX);
|
||||
layout->binding[b].offset = ALIGN_POT(buffer_size, align);
|
||||
layout->binding[b].stride = stride;
|
||||
buffer_size += stride * binding->descriptorCount;
|
||||
if (stride > 0) {
|
||||
assert(stride <= UINT8_MAX);
|
||||
assert(util_is_power_of_two_nonzero(align));
|
||||
buffer_size = ALIGN_POT(buffer_size, align);
|
||||
layout->binding[b].offset = buffer_size;
|
||||
layout->binding[b].stride = stride;
|
||||
buffer_size += stride * binding->descriptorCount;
|
||||
}
|
||||
|
||||
if (binding_has_immutable_samplers(binding)) {
|
||||
layout->binding[b].immutable_samplers = samplers;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue