vk/pipeline_layout: Add dynamic_offset_start and has_dynamic_offsets fields
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 11 Sep 2015 22:52:43 +0000 (15:52 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 11 Sep 2015 22:52:43 +0000 (15:52 -0700)
src/vulkan/anv_pipeline.c
src/vulkan/anv_private.h

index dba2a5e7b4623dd8f5ecda084a20fb042aacf8bd..833957a32e223c9b32b0a18ff4dbff7d0c96d40a 100644 (file)
@@ -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];
index f556161679f57863e8597836443497cfb4d1c1f9..b290d60cc081eaa95186caed1bc6038198d1b5a5 100644 (file)
@@ -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];