summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2020-08-06 22:51:01 -0500
committerMarge Bot <eric+marge@anholt.net>2021-06-22 21:09:25 +0000
commitd95d5b146511447294f3d593d6701b6ab389e711 (patch)
treef98acbe8017053fcee256b3fa95575f35dff0aee
parent8cc5080580b2c858097184dd662441bd61ebde0c (diff)
anv: Add support for binding ray-tracing pipelines
This includes not only vkCmdBindPipeline but also descriptor sets and push constants. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8637>
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c51
1 files changed, 47 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index 2d03440042d..d6d029ce67b 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -510,6 +510,17 @@ void anv_CmdBindPipeline(
break;
}
+ case VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR: {
+ struct anv_ray_tracing_pipeline *rt_pipeline =
+ anv_pipeline_to_ray_tracing(pipeline);
+ if (cmd_buffer->state.rt.pipeline == rt_pipeline)
+ return;
+
+ cmd_buffer->state.rt.pipeline = rt_pipeline;
+ cmd_buffer->state.rt.pipeline_dirty = true;
+ break;
+ }
+
default:
assert(!"invalid bind point");
break;
@@ -900,6 +911,16 @@ anv_cmd_buffer_bind_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
pipe_state = &cmd_buffer->state.compute.base;
break;
+ case VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR:
+ stages &= VK_SHADER_STAGE_RAYGEN_BIT_KHR |
+ VK_SHADER_STAGE_ANY_HIT_BIT_KHR |
+ VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR |
+ VK_SHADER_STAGE_MISS_BIT_KHR |
+ VK_SHADER_STAGE_INTERSECTION_BIT_KHR |
+ VK_SHADER_STAGE_CALLABLE_BIT_KHR;
+ pipe_state = &cmd_buffer->state.rt.base;
+ break;
+
default:
unreachable("invalid bind point");
}
@@ -1191,6 +1212,17 @@ void anv_CmdPushConstants(
memcpy(pipe_state->push_constants.client_data + offset, pValues, size);
}
+ if (stageFlags & (VK_SHADER_STAGE_RAYGEN_BIT_KHR |
+ VK_SHADER_STAGE_ANY_HIT_BIT_KHR |
+ VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR |
+ VK_SHADER_STAGE_MISS_BIT_KHR |
+ VK_SHADER_STAGE_INTERSECTION_BIT_KHR |
+ VK_SHADER_STAGE_CALLABLE_BIT_KHR)) {
+ struct anv_cmd_pipeline_state *pipe_state =
+ &cmd_buffer->state.rt.base;
+
+ memcpy(pipe_state->push_constants.client_data + offset, pValues, size);
+ }
cmd_buffer->state.push_constants_dirty |= stageFlags;
}
@@ -1292,11 +1324,22 @@ anv_cmd_buffer_push_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
uint32_t _set)
{
struct anv_cmd_pipeline_state *pipe_state;
- if (bind_point == VK_PIPELINE_BIND_POINT_COMPUTE) {
- pipe_state = &cmd_buffer->state.compute.base;
- } else {
- assert(bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS);
+
+ switch (bind_point) {
+ case VK_PIPELINE_BIND_POINT_GRAPHICS:
pipe_state = &cmd_buffer->state.gfx.base;
+ break;
+
+ case VK_PIPELINE_BIND_POINT_COMPUTE:
+ pipe_state = &cmd_buffer->state.compute.base;
+ break;
+
+ case VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR:
+ pipe_state = &cmd_buffer->state.rt.base;
+ break;
+
+ default:
+ unreachable("invalid bind point");
}
struct anv_push_descriptor_set **push_set =