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>
This commit is contained in:
Faith Ekstrand 2024-01-04 16:42:35 -06:00 committed by Marge Bot
parent f62b5582ea
commit 2d5c04ee4a
4 changed files with 8 additions and 6 deletions

View file

@ -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);

View file

@ -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],

View file

@ -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 },

View file

@ -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,