From f410c1142fb71f4af0e0903179298f88e3da4327 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Thu, 9 Dec 2021 17:13:29 +0100 Subject: [PATCH] anv: set number of viewports in clip state (mesh) Reviewed-by: Caio Oliveira Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 6 ++++++ src/intel/vulkan/genX_pipeline.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 0292fcc..0781cdf 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -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); diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 598b209..afd0351 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -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 -- 2.7.4