anv: set number of viewports in clip state (mesh)
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Thu, 9 Dec 2021 16:13:29 +0000 (17:13 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 9 Mar 2022 16:52:59 +0000 (16:52 +0000)
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15303>

src/intel/vulkan/genX_cmd_buffer.c
src/intel/vulkan/genX_pipeline.c

index 0292fcc..0781cdf 100644 (file)
@@ -3670,6 +3670,12 @@ cmd_buffer_emit_clip(struct anv_cmd_buffer *cmd_buffer)
             cmd_buffer->state.gfx.dynamic.viewport.count > 0 ?
             cmd_buffer->state.gfx.dynamic.viewport.count - 1 : 0;
       }
+   } else if (anv_pipeline_is_mesh(pipeline)) {
+      const struct brw_mesh_prog_data *mesh_prog_data = get_mesh_prog_data(pipeline);
+      if (mesh_prog_data->map.start_dw[VARYING_SLOT_VIEWPORT] >= 0) {
+         uint32_t viewport_count = cmd_buffer->state.gfx.dynamic.viewport.count;
+         clip.MaximumVPIndex = viewport_count > 0 ? viewport_count - 1 : 0;
+      }
    }
 
    GENX(3DSTATE_CLIP_pack)(NULL, dwords, &clip);
index 598b209..afd0351 100644 (file)
@@ -1601,6 +1601,12 @@ emit_3dstate_clip(struct anv_graphics_pipeline *pipeline,
       clip.UserClipDistanceClipTestEnableBitmask = last->clip_distance_mask;
       clip.UserClipDistanceCullTestEnableBitmask = last->cull_distance_mask;
 #endif
+   } else if (anv_pipeline_is_mesh(pipeline)) {
+      const struct brw_mesh_prog_data *mesh_prog_data = get_mesh_prog_data(pipeline);
+      if (vp_info && vp_info->viewportCount > 0 &&
+            mesh_prog_data->map.start_dw[VARYING_SLOT_VIEWPORT] >= 0) {
+         clip.MaximumVPIndex = vp_info->viewportCount - 1;
+      }
    }
 
 #if GFX_VER == 7