mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
vulkan/runtime: track dynamic descriptor offsets for RT pipelines
Dynamic descriptors are mapped an array of offsets provided through
vkCmdBindDescriptorSets*() commands.
When pipelines are compiled with independent sets layouts, the
implementation might have to do additional runtime calculation to
figure out what offset in the contiguous array maps to what dynamic
descriptor in the pipeline layout.
For graphics pipelines you can always compute that information when
binding the shaders. There is always a limited amount of shaders (5
max).
For ray tracing pipelines, there could be lots of shaders to process
at every pipeline binding call. Besides there is no interface from the
runtime to the driver to list all the shaders used at the moment.
So do that tracking in the runtime and pass the information down to
the driver through the cmd_set_rt_state() vfunc.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 69a04151db ("vulkan/runtime: add ray tracing pipeline support")
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38678>
This commit is contained in:
parent
a4e9e660d4
commit
5c53c6e693
4 changed files with 21 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -6125,7 +6125,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,
|
||||
|
|
|
|||
|
|
@ -2679,6 +2679,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
|
||||
|
|
@ -2736,7 +2738,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);
|
||||
|
|
@ -3490,6 +3493,17 @@ vk_create_rt_pipeline(struct vk_device *device,
|
|||
goto fail_pipeline;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue