diff --git a/src/vulkan/runtime/vk_pipeline.c b/src/vulkan/runtime/vk_pipeline.c index b040d340e6c..2a3482e0a9b 100644 --- a/src/vulkan/runtime/vk_pipeline.c +++ b/src/vulkan/runtime/vk_pipeline.c @@ -3682,6 +3682,19 @@ vk_create_rt_pipeline(struct vk_device *device, assert(group->stages[s].shader != NULL); } + /* Activate replay if needed */ + if (pipeline_flags & + VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR) { + const struct vk_device_shader_ops *ops = device->shader_ops; + struct vk_shader *shaders[3] = {}; + for (uint32_t s = 0; s < group->stage_count; s++) + shaders[s] = group->stages[s].shader; + ops->replay_rt_shader_group( + device, group_info->type, + group->stage_count, shaders, + group_info->pShaderGroupCaptureReplayHandle); + } + pipeline->group_count++; } diff --git a/src/vulkan/runtime/vk_shader.h b/src/vulkan/runtime/vk_shader.h index 145473b18d4..b4334ef171d 100644 --- a/src/vulkan/runtime/vk_shader.h +++ b/src/vulkan/runtime/vk_shader.h @@ -313,6 +313,18 @@ struct vk_device_shader_ops { uint32_t shader_count, void *output); + /** Enable a RT shader for replay + * + * The @replay_data pointer is the pointer handed to + * VkRayTracingShaderGroupCreateInfoKHR::pShaderGroupCaptureReplayHandle on + * replay or NULL on capture. + */ + void (*replay_rt_shader_group)(struct vk_device *vk_device, + VkRayTracingShaderGroupTypeKHR type, + uint32_t shader_count, + struct vk_shader **vk_shaders, + const void *replay_data); + /** Bind a set of shaders * * This is roughly equivalent to vkCmdBindShadersEXT()