diff --git a/src/nouveau/vulkan/nvk_cmd_buffer.c b/src/nouveau/vulkan/nvk_cmd_buffer.c index 9d69e782445..cb52fe41d3a 100644 --- a/src/nouveau/vulkan/nvk_cmd_buffer.c +++ b/src/nouveau/vulkan/nvk_cmd_buffer.c @@ -371,23 +371,22 @@ nvk_CmdBindPipeline(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(nvk_pipeline, pipeline, _pipeline); + for (unsigned s = 0; s < ARRAY_SIZE(pipeline->shaders); s++) { + if (!pipeline->shaders[s].bo) + continue; + + nouveau_ws_push_ref(cmd->push, pipeline->shaders[s].bo, + NOUVEAU_WS_BO_RD); + } + switch (pipelineBindPoint) { case VK_PIPELINE_BIND_POINT_GRAPHICS: - for (unsigned s = 0; s < ARRAY_SIZE(pipeline->shaders); s++) { - if (!pipeline->shaders[s].bo) - continue; - - nouveau_ws_push_ref(cmd->push, pipeline->shaders[s].bo, - NOUVEAU_WS_BO_RD); - } - cmd->state.gfx.pipeline = (struct nvk_graphics_pipeline *)pipeline; + assert(pipeline->type == NVK_PIPELINE_GRAPHICS); + nvk_cmd_bind_graphics_pipeline(cmd, (void *)pipeline); break; case VK_PIPELINE_BIND_POINT_COMPUTE: assert(pipeline->type == NVK_PIPELINE_COMPUTE); - nouveau_ws_push_ref(cmd->push, - pipeline->shaders[MESA_SHADER_COMPUTE].bo, - NOUVEAU_WS_BO_RD); - cmd->state.cs.pipeline = (struct nvk_compute_pipeline *)pipeline; + nvk_cmd_bind_compute_pipeline(cmd, (void *)pipeline); break; default: unreachable("Unhandled bind point"); diff --git a/src/nouveau/vulkan/nvk_cmd_buffer.h b/src/nouveau/vulkan/nvk_cmd_buffer.h index d4d145dcad7..c326be53f06 100644 --- a/src/nouveau/vulkan/nvk_cmd_buffer.h +++ b/src/nouveau/vulkan/nvk_cmd_buffer.h @@ -100,6 +100,11 @@ void nvk_cmd_buffer_begin_graphics(struct nvk_cmd_buffer *cmd, void nvk_cmd_buffer_begin_compute(struct nvk_cmd_buffer *cmd, const VkCommandBufferBeginInfo *pBeginInfo); +void nvk_cmd_bind_graphics_pipeline(struct nvk_cmd_buffer *cmd, + struct nvk_graphics_pipeline *pipeline); +void nvk_cmd_bind_compute_pipeline(struct nvk_cmd_buffer *cmd, + struct nvk_compute_pipeline *pipeline); + static inline struct nvk_descriptor_state * nvk_get_descriptors_state(struct nvk_cmd_buffer *cmd, VkPipelineBindPoint bind_point) diff --git a/src/nouveau/vulkan/nvk_cmd_dispatch.c b/src/nouveau/vulkan/nvk_cmd_dispatch.c index 64ed69c90d2..229cee4278d 100644 --- a/src/nouveau/vulkan/nvk_cmd_dispatch.c +++ b/src/nouveau/vulkan/nvk_cmd_dispatch.c @@ -72,6 +72,13 @@ gp100_cp_launch_desc_set_cb(uint32_t *qmd, unsigned index, NVC0C0_QMDV02_01_DEF_SET(qmd, CONSTANT_BUFFER_VALID, index, TRUE); } +void +nvk_cmd_bind_compute_pipeline(struct nvk_cmd_buffer *cmd, + struct nvk_compute_pipeline *pipeline) +{ + cmd->state.cs.pipeline = pipeline; +} + VKAPI_ATTR void VKAPI_CALL nvk_CmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, diff --git a/src/nouveau/vulkan/nvk_cmd_draw.c b/src/nouveau/vulkan/nvk_cmd_draw.c index 4299f7a34c7..cc172e295a1 100644 --- a/src/nouveau/vulkan/nvk_cmd_draw.c +++ b/src/nouveau/vulkan/nvk_cmd_draw.c @@ -5,3 +5,10 @@ nvk_cmd_buffer_begin_graphics(struct nvk_cmd_buffer *cmd, const VkCommandBufferBeginInfo *pBeginInfo) { } + +void +nvk_cmd_bind_graphics_pipeline(struct nvk_cmd_buffer *cmd, + struct nvk_graphics_pipeline *pipeline) +{ + cmd->state.gfx.pipeline = pipeline; +}