summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2019-07-29 16:52:23 +0200
committerBas Nieuwenhuizen <[email protected]>2019-07-29 20:42:53 +0200
commitaac492901a9c717e1c667a5313fdf7ba1b750cf2 (patch)
tree40ada0e9a8fa0e499045f1aed70a9c3e0b1931be /src/amd
parent99d04a5bd6ab41f48d81d2096dbe6d832f1a9774 (diff)
radv: Take variable descriptor counts into account for buffer entries.
Fixes: b5e04e9217b "radv: Support allocating variable size descriptor sets." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111019 Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_descriptor_set.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index bf926288aa0..7d3e6812b4e 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -477,8 +477,17 @@ radv_descriptor_set_create(struct radv_device *device,
struct radv_descriptor_set **out_set)
{
struct radv_descriptor_set *set;
+ uint32_t buffer_count = layout->buffer_count;
+ if (variable_count) {
+ unsigned stride = 1;
+ if (layout->binding[layout->binding_count - 1].type == VK_DESCRIPTOR_TYPE_SAMPLER ||
+ layout->binding[layout->binding_count - 1].type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT)
+ stride = 0;
+ buffer_count = layout->binding[layout->binding_count - 1].buffer_offset +
+ *variable_count * stride;
+ }
unsigned range_offset = sizeof(struct radv_descriptor_set) +
- sizeof(struct radeon_winsys_bo *) * layout->buffer_count;
+ sizeof(struct radeon_winsys_bo *) * buffer_count;
unsigned mem_size = range_offset +
sizeof(struct radv_descriptor_range) * layout->dynamic_offset_count;