diff --git a/.pick_status.json b/.pick_status.json index 983f7f99c13..4e0ba027fa0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -64,7 +64,7 @@ "description": "vulkan/runtime: track dynamic descriptor offsets for RT pipelines", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "69a04151db48e4d06072dab38e33129b6681230a", "notes": null diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 0aa70819fb2..12b0711a888 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -1247,7 +1247,8 @@ void anv_CmdPushDescriptorSetWithTemplate2KHR( void anv_cmd_buffer_set_rt_state(struct vk_command_buffer *vk_cmd_buffer, VkDeviceSize scratch_size, - uint32_t ray_queries) + uint32_t ray_queries, + const uint8_t *dynamic_descriptor_offsets) { struct anv_cmd_buffer *cmd_buffer = container_of(vk_cmd_buffer, struct anv_cmd_buffer, vk); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 572041c428b..16f26065ca1 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -6113,7 +6113,8 @@ anv_cmd_buffer_ensure_rcs_companion(struct anv_cmd_buffer *cmd_buffer); void anv_cmd_buffer_set_rt_state(struct vk_command_buffer *vk_cmd_buffer, VkDeviceSize scratch_size, - uint32_t ray_queries); + uint32_t ray_queries, + const uint8_t *dynamic_descriptor_offsets); void anv_cmd_buffer_set_stack_size(struct vk_command_buffer *vk_cmd_buffer, diff --git a/src/vulkan/runtime/vk_pipeline.c b/src/vulkan/runtime/vk_pipeline.c index 6eecd1e3923..2d58ae83750 100644 --- a/src/vulkan/runtime/vk_pipeline.c +++ b/src/vulkan/runtime/vk_pipeline.c @@ -2352,6 +2352,8 @@ struct vk_rt_pipeline { VkDeviceSize stack_size; VkDeviceSize scratch_size; uint32_t ray_queries; + + uint8_t dynamic_descriptor_offsets[MESA_VK_MAX_DESCRIPTOR_SETS]; }; static struct vk_rt_stage @@ -2409,7 +2411,8 @@ vk_rt_pipeline_cmd_bind(struct vk_command_buffer *cmd_buffer, ops->cmd_set_rt_state(cmd_buffer, rt_pipeline->scratch_size, - rt_pipeline->ray_queries); + rt_pipeline->ray_queries, + rt_pipeline->dynamic_descriptor_offsets); if (rt_pipeline->stack_size > 0) ops->cmd_set_stack_size(cmd_buffer, rt_pipeline->stack_size); @@ -2900,6 +2903,17 @@ vk_create_rt_pipeline(struct vk_device *device, goto fail_stages; } + if (pipeline_layout != NULL) { + uint32_t dynamic_desc_offset = 0; + for (uint32_t i = 0; i < pipeline_layout->set_count; i++) { + if (pipeline_layout->set_layouts[i] != NULL) { + pipeline->dynamic_descriptor_offsets[i] = dynamic_desc_offset; + dynamic_desc_offset += + pipeline_layout->set_layouts[i]->dynamic_descriptor_count; + } + } + } + pipeline->stages = pipeline_stages; pipeline->groups = pipeline_groups; diff --git a/src/vulkan/runtime/vk_shader.h b/src/vulkan/runtime/vk_shader.h index a2caea1c667..38d82eed52f 100644 --- a/src/vulkan/runtime/vk_shader.h +++ b/src/vulkan/runtime/vk_shader.h @@ -331,7 +331,8 @@ struct vk_device_shader_ops { /** Sets scratch size & ray query count for RT pipelines */ void (*cmd_set_rt_state)(struct vk_command_buffer *cmd_buffer, VkDeviceSize scratch_size, - uint32_t ray_queries); + uint32_t ray_queries, + const uint8_t *dynamic_descriptor_offsets); /** Sets stack size for RT pipelines */ void (*cmd_set_stack_size)(struct vk_command_buffer *cmd_buffer,