nvk: Only use view_id for layer in multiview
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Sat, 8 Apr 2023 17:52:23 +0000 (12:52 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:32:05 +0000 (21:32 +0000)
I can't prove that this fixes anything but it seems right.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_compute_pipeline.c
src/nouveau/vulkan/nvk_graphics_pipeline.c
src/nouveau/vulkan/nvk_shader.c
src/nouveau/vulkan/nvk_shader.h

index 8ec0cfc..4fdcb41 100644 (file)
@@ -188,7 +188,7 @@ nvk_compute_pipeline_create(struct nvk_device *device,
    if (result != VK_SUCCESS)
       goto fail;
 
-   nvk_lower_nir(device, nir, &robustness, pipeline_layout);
+   nvk_lower_nir(device, nir, &robustness, false, pipeline_layout);
 
    result = nvk_compile_nir(pdevice, nir, NULL,
                             &pipeline->base.shaders[MESA_SHADER_COMPUTE]);
index f7e9662..02c605b 100644 (file)
@@ -249,7 +249,8 @@ nvk_graphics_pipeline_create(struct nvk_device *device,
       if (result != VK_SUCCESS)
          goto fail;
 
-      nvk_lower_nir(device, nir[stage], &robustness, pipeline_layout);
+      nvk_lower_nir(device, nir[stage], &robustness,
+                    state.rp->view_mask != 0, pipeline_layout);
    }
 
    for (gl_shader_stage stage = 0; stage < MESA_SHADER_STAGES; stage++) {
index 48e97e8..fb38ac8 100644 (file)
@@ -286,6 +286,7 @@ assign_io_locations(nir_shader *nir)
 void
 nvk_lower_nir(struct nvk_device *device, nir_shader *nir,
               const struct vk_pipeline_robustness_state *rs,
+              bool is_multiview,
               const struct vk_pipeline_layout *layout)
 {
    NIR_PASS(_, nir, nir_split_struct_vars, nir_var_function_temp);
@@ -315,8 +316,8 @@ nvk_lower_nir(struct nvk_device *device, nir_shader *nir,
                nir_metadata_block_index | nir_metadata_dominance, NULL);
       NIR_PASS(_, nir, nir_lower_input_attachments,
                &(nir_input_attachment_options) {
-                  .use_layer_id_sysval = true,
-                  .use_view_id_for_layer = true,
+                  .use_layer_id_sysval = is_multiview,
+                  .use_view_id_for_layer = is_multiview,
                });
    }
 
index 8ef98a7..0e223ec 100644 (file)
@@ -113,6 +113,7 @@ nvk_nir_lower_descriptors(nir_shader *nir,
 void
 nvk_lower_nir(struct nvk_device *device, nir_shader *nir,
               const struct vk_pipeline_robustness_state *rs,
+              bool is_multiview,
               const struct vk_pipeline_layout *layout);
 
 VkResult