From 947ef049dfb8150025340780e0ff0a95dfdd2ddf Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Wed, 7 Feb 2024 21:40:41 -0800 Subject: [PATCH] iris: Add helper to access use_tcs_multi_patch Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_context.h | 1 + src/gallium/drivers/iris/iris_draw.c | 4 +--- src/gallium/drivers/iris/iris_program.c | 11 ++++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 4ba5c79c0b6..66bd81b03be 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -1324,6 +1324,7 @@ iris_cs_push_const_total_size(const struct iris_compiled_shader *shader, uint32_t iris_fs_barycentric_modes(const struct iris_compiled_shader *shader, enum intel_msaa_flags pushed_msaa_flags); +bool iris_use_tcs_multi_patch(struct iris_screen *screen); /* iris_disk_cache.c */ diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index d59ebd8b570..e37b7c4b1db 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -36,7 +36,6 @@ #include "util/u_inlines.h" #include "util/u_transfer.h" #include "util/u_upload_mgr.h" -#include "intel/compiler/brw_compiler.h" #include "compiler/shader_info.h" #include "iris_context.h" #include "iris_defines.h" @@ -66,7 +65,6 @@ iris_update_draw_info(struct iris_context *ice, { struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; const struct intel_device_info *devinfo = screen->devinfo; - const struct brw_compiler *compiler = screen->compiler; if (ice->state.prim_mode != info->mode) { ice->state.prim_mode = info->mode; @@ -87,7 +85,7 @@ iris_update_draw_info(struct iris_context *ice, ice->state.dirty |= IRIS_DIRTY_VF_TOPOLOGY; /* MULTI_PATCH TCS needs this for key->input_vertices */ - if (compiler->use_tcs_multi_patch) + if (iris_use_tcs_multi_patch(screen)) ice->state.stage_dirty |= IRIS_STAGE_DIRTY_UNCOMPILED_TCS; /* Flag constants dirty for gl_PatchVerticesIn if needed. */ diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index d7d323dc3a5..78471220e8b 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1761,7 +1761,6 @@ iris_update_compiled_tcs(struct iris_context *ice) ice->shaders.uncompiled[MESA_SHADER_TESS_CTRL]; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; struct u_upload_mgr *uploader = ice->shaders.uploader_driver; - const struct brw_compiler *compiler = screen->compiler; const struct intel_device_info *devinfo = screen->devinfo; const struct shader_info *tes_info = @@ -1770,7 +1769,7 @@ iris_update_compiled_tcs(struct iris_context *ice) .vue.base.program_string_id = tcs ? tcs->program_id : 0, ._tes_primitive_mode = tes_info->tess._primitive_mode, .input_vertices = - !tcs || compiler->use_tcs_multi_patch ? ice->state.vertices_per_patch : 0, + !tcs || iris_use_tcs_multi_patch(screen) ? ice->state.vertices_per_patch : 0, .quads_workaround = devinfo->ver < 9 && tes_info->tess._primitive_mode == TESS_PRIMITIVE_QUADS && tes_info->tess.spacing == TESS_SPACING_EQUAL, @@ -2857,7 +2856,7 @@ iris_create_shader_state(struct pipe_context *ctx, * and output patches are the same size. This is a bad guess, but we * can't do much better. */ - if (screen->compiler->use_tcs_multi_patch) + if (iris_use_tcs_multi_patch(screen)) key.tcs.input_vertices = info->tess.tcs_vertices_out; key_size = sizeof(key.tcs); @@ -3276,6 +3275,12 @@ iris_fs_barycentric_modes(const struct iris_compiled_shader *shader, return wm_prog_data_barycentric_modes(brw, pushed_msaa_flags); } +bool +iris_use_tcs_multi_patch(struct iris_screen *screen) +{ + return screen->compiler->use_tcs_multi_patch; +} + static void iris_shader_debug_log(void *data, unsigned *id, const char *fmt, ...) {