Module: Mesa Branch: main Commit: 2d5c04ee4aa655bef250b246077e2618c265c421 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d5c04ee4aa655bef250b246077e2618c265c421
Author: Faith Ekstrand <[email protected]> Date: Thu Jan 4 16:42:35 2024 -0600 nvk: Return an nvk_cbuf_map from nvk_lower_nir() There's no need to pass in the whole shader when the only part we're going to write is the cbuf map. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27048> --- src/nouveau/vulkan/nvk_compute_pipeline.c | 3 ++- src/nouveau/vulkan/nvk_graphics_pipeline.c | 3 ++- src/nouveau/vulkan/nvk_shader.c | 6 +++--- src/nouveau/vulkan/nvk_shader.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/nouveau/vulkan/nvk_compute_pipeline.c b/src/nouveau/vulkan/nvk_compute_pipeline.c index b901b8bcb96..bec98c4b3d3 100644 --- a/src/nouveau/vulkan/nvk_compute_pipeline.c +++ b/src/nouveau/vulkan/nvk_compute_pipeline.c @@ -214,7 +214,8 @@ nvk_compute_pipeline_create(struct nvk_device *dev, if(shader == NULL) return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY); - nvk_lower_nir(dev, nir, &robustness, false, pipeline_layout, shader); + nvk_lower_nir(dev, nir, &robustness, false, pipeline_layout, + &shader->cbuf_map); result = nvk_compile_nir(dev, nir, pipeline_flags, &robustness, NULL, cache, shader); diff --git a/src/nouveau/vulkan/nvk_graphics_pipeline.c b/src/nouveau/vulkan/nvk_graphics_pipeline.c index 9be4786fa25..61b489bb01a 100644 --- a/src/nouveau/vulkan/nvk_graphics_pipeline.c +++ b/src/nouveau/vulkan/nvk_graphics_pipeline.c @@ -287,7 +287,8 @@ nvk_graphics_pipeline_create(struct nvk_device *dev, } nvk_lower_nir(dev, nir[stage], &robustness[stage], - state.rp->view_mask != 0, pipeline_layout, shader); + state.rp->view_mask != 0, pipeline_layout, + &shader->cbuf_map); result = nvk_compile_nir(dev, nir[stage], pipeline_flags, &robustness[stage], diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index 14cca62ab17..359b48f3601 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -303,7 +303,7 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, const struct vk_pipeline_robustness_state *rs, bool is_multiview, const struct vk_pipeline_layout *layout, - struct nvk_shader *shader) + struct nvk_cbuf_map *cbuf_map_out) { struct nvk_physical_device *pdev = nvk_device_physical(dev); @@ -357,13 +357,13 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, struct nvk_cbuf_map *cbuf_map = NULL; if (use_nak(pdev, nir->info.stage) && !(pdev->debug_flags & NVK_DEBUG_NO_CBUF)) { - cbuf_map = &shader->cbuf_map; + cbuf_map = cbuf_map_out; } else { /* Codegen sometimes puts stuff in cbuf 1 and adds 1 to our cbuf indices * so we can't really rely on it for lowering to cbufs and instead place * the root descriptors in both cbuf 0 and cbuf 1. */ - shader->cbuf_map = (struct nvk_cbuf_map) { + *cbuf_map_out = (struct nvk_cbuf_map) { .cbuf_count = 2, .cbufs = { { .type = NVK_CBUF_TYPE_ROOT_DESC }, diff --git a/src/nouveau/vulkan/nvk_shader.h b/src/nouveau/vulkan/nvk_shader.h index 867a97c51f2..5bedf488422 100644 --- a/src/nouveau/vulkan/nvk_shader.h +++ b/src/nouveau/vulkan/nvk_shader.h @@ -125,7 +125,7 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, const struct vk_pipeline_robustness_state *rs, bool is_multiview, const struct vk_pipeline_layout *layout, - struct nvk_shader *shader); + struct nvk_cbuf_map *cbuf_map_out); VkResult nvk_compile_nir(struct nvk_device *dev, nir_shader *nir,
