From 7487371056175406a5408d0c2c1621b64c5bef92 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 11 Sep 2015 15:52:43 -0700 Subject: [PATCH] vk/pipeline_layout: Add dynamic_offset_start and has_dynamic_offsets fields --- src/vulkan/anv_pipeline.c | 7 +++++++ src/vulkan/anv_private.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index dba2a5e7b46..833957a32e2 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -385,16 +385,23 @@ VkResult anv_CreatePipelineLayout( uint32_t sampler_start[VK_SHADER_STAGE_NUM] = { 0, }; for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) { + layout->stage[s].has_dynamic_offsets = false; layout->stage[s].surface_count = 0; layout->stage[s].sampler_count = 0; } + uint32_t num_dynamic_offsets = 0; for (uint32_t i = 0; i < pCreateInfo->descriptorSetCount; i++) { ANV_FROM_HANDLE(anv_descriptor_set_layout, set_layout, pCreateInfo->pSetLayouts[i]); layout->set[i].layout = set_layout; + layout->set[i].dynamic_offset_start = num_dynamic_offsets; + num_dynamic_offsets += set_layout->num_dynamic_buffers; for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) { + if (set_layout->num_dynamic_buffers > 0) + layout->stage[s].has_dynamic_offsets = true; + layout->set[i].stage[s].surface_start = surface_start[s]; surface_start[s] += set_layout->stage[s].surface_count; layout->set[i].stage[s].sampler_start = sampler_start[s]; diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index f556161679f..b290d60cc08 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -664,6 +664,7 @@ anv_descriptor_set_destroy(struct anv_device *device, struct anv_pipeline_layout { struct { struct anv_descriptor_set_layout *layout; + uint32_t dynamic_offset_start; struct { uint32_t surface_start; uint32_t sampler_start; @@ -673,6 +674,7 @@ struct anv_pipeline_layout { uint32_t num_sets; struct { + bool has_dynamic_offsets; uint32_t surface_count; uint32_t sampler_count; } stage[VK_SHADER_STAGE_NUM]; -- 2.30.2