From 159d3974377b88b9aac51a4b1b87075878fade6d Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 23 Oct 2025 20:27:21 +0300 Subject: [PATCH] anv/brw: fix output tcs vertices brw_prog_tcs_data::instances can be divided by vertices per threads on earlier generations. Signed-off-by: Lionel Landwerlin Fixes: a91e0e0d61 ("brw: add support for separate tessellation shader compilation") Reviewed-by: Alyssa Rosenzweig Reviewed-by: Ivan Briano (cherry picked from commit e450297ea9d5b715e6e34a6a3bb7a8b3ec5f4890) Part-of: --- .pick_status.json | 2 +- src/intel/compiler/brw/brw_compile_tcs.cpp | 1 + src/intel/compiler/brw/brw_compiler.h | 3 +++ src/intel/vulkan/genX_gfx_state.c | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 13f54a61142..0899f0395ba 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -494,7 +494,7 @@ "description": "anv/brw: fix output tcs vertices", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a91e0e0d616f857144c8cadfaed734ac5be8e729", "notes": null diff --git a/src/intel/compiler/brw/brw_compile_tcs.cpp b/src/intel/compiler/brw/brw_compile_tcs.cpp index da991e9c8dc..64a6e29fab2 100644 --- a/src/intel/compiler/brw/brw_compile_tcs.cpp +++ b/src/intel/compiler/brw/brw_compile_tcs.cpp @@ -224,6 +224,7 @@ brw_compile_tcs(const struct brw_compiler *compiler, BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID); prog_data->input_vertices = key->input_vertices; + prog_data->output_vertices = nir->info.tess.tcs_vertices_out; prog_data->patch_count_threshold = get_patch_count_threshold(key->input_vertices); if (compiler->use_tcs_multi_patch) { diff --git a/src/intel/compiler/brw/brw_compiler.h b/src/intel/compiler/brw/brw_compiler.h index 76b7afd3be0..5b6da7a1874 100644 --- a/src/intel/compiler/brw/brw_compiler.h +++ b/src/intel/compiler/brw/brw_compiler.h @@ -1175,6 +1175,9 @@ struct brw_tcs_prog_data /** Number of input vertices, 0 means dynamic */ unsigned input_vertices; + /** Number of output vertices */ + unsigned output_vertices; + /** Should the non-SINGLE_PATCH payload provide primitive ID? */ bool include_primitive_id; diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 5c4c125b2ed..d4f7f9eeb7e 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -2550,7 +2550,7 @@ cmd_buffer_flush_gfx_runtime_state(struct anv_gfx_dynamic_state *hw_state, SET(TESS_CONFIG, tess_config, intel_tess_config(dyn->ts.patch_control_points, - tcs_prog_data->instances, + tcs_prog_data->output_vertices, brw_tess_info_domain(tess_info), tcs_prog_data->base.vue_map.num_per_patch_slots, tcs_prog_data->base.vue_map.num_per_vertex_slots,