From 308744e789728b1ee69dca782afdfa4ff7f4bcc8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 3 Sep 2025 10:40:48 -0400 Subject: [PATCH] zink: mark dirty_gfx_stages using util function more extensible for mesh Part-of: --- src/gallium/drivers/zink/zink_context.c | 4 ++-- src/gallium/drivers/zink/zink_context.h | 6 ++++++ src/gallium/drivers/zink/zink_program.h | 13 +++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index bfcaa23ceae..187b3955b5d 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1591,7 +1591,7 @@ zink_set_inlinable_constants(struct pipe_context *pctx, if (shader == MESA_SHADER_COMPUTE) ctx->compute_dirty = true; else - ctx->dirty_gfx_stages |= bit; + zink_update_dirty_gfx_stages(ctx, bit); ctx->inlinable_uniforms_valid_mask |= bit; key->inline_uniforms = true; } @@ -1636,7 +1636,7 @@ invalidate_inlined_uniforms(struct zink_context *ctx, mesa_shader_stage pstage) return; } assert(!zink_screen(ctx->base.screen)->optimal_keys || (pstage == MESA_SHADER_GEOMETRY && ctx->is_generated_gs_bound)); - ctx->dirty_gfx_stages |= bit; + zink_update_dirty_gfx_stages(ctx, bit); struct zink_shader_key *key = &ctx->gfx_pipeline_state.shader_keys.key[pstage]; key->inline_uniforms = false; } diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 8b0cc212ee9..1ca29b56c7b 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -115,6 +115,12 @@ zink_resource_access_is_write(VkAccessFlags flags) void zink_fence_wait(struct pipe_context *ctx); +static ALWAYS_INLINE void +zink_update_dirty_gfx_stages(struct zink_context *ctx, uint32_t pstages) +{ + ctx->dirty_gfx_stages |= pstages; +} + void zink_wait_on_batch(struct zink_context *ctx, uint64_t batch_id); void diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h index 8ad7003da3d..8714ca0fc51 100644 --- a/src/gallium/drivers/zink/zink_program.h +++ b/src/gallium/drivers/zink/zink_program.h @@ -29,6 +29,7 @@ extern "C" { #endif #include "util/u_prim.h" +#include "zink_context.h" struct compute_pipeline_cache_entry { struct zink_compute_pipeline_state state; @@ -247,7 +248,7 @@ zink_program_has_descriptors(const struct zink_program *pg) static inline struct zink_fs_key_base * zink_set_fs_base_key(struct zink_context *ctx) { - ctx->dirty_gfx_stages |= BITFIELD_BIT(MESA_SHADER_FRAGMENT); + zink_update_dirty_gfx_stages(ctx, BITFIELD_BIT(MESA_SHADER_FRAGMENT)); return zink_screen(ctx->base.screen)->optimal_keys ? &ctx->gfx_pipeline_state.shader_keys_optimal.key.fs : &ctx->gfx_pipeline_state.shader_keys.key[MESA_SHADER_FRAGMENT].key.fs.base; @@ -265,7 +266,7 @@ static inline struct zink_fs_key * zink_set_fs_key(struct zink_context *ctx) { assert(!zink_screen(ctx->base.screen)->optimal_keys); - ctx->dirty_gfx_stages |= BITFIELD_BIT(MESA_SHADER_FRAGMENT); + zink_update_dirty_gfx_stages(ctx, BITFIELD_BIT(MESA_SHADER_FRAGMENT)); return &ctx->gfx_pipeline_state.shader_keys.key[MESA_SHADER_FRAGMENT].key.fs; } @@ -279,7 +280,7 @@ zink_get_fs_key(const struct zink_context *ctx) static inline struct zink_gs_key * zink_set_gs_key(struct zink_context *ctx) { - ctx->dirty_gfx_stages |= BITFIELD_BIT(MESA_SHADER_GEOMETRY); + zink_update_dirty_gfx_stages(ctx, BITFIELD_BIT(MESA_SHADER_GEOMETRY)); assert(!zink_screen(ctx->base.screen)->optimal_keys); return &ctx->gfx_pipeline_state.shader_keys.key[MESA_SHADER_GEOMETRY].key.gs; } @@ -298,7 +299,7 @@ zink_set_tcs_key_patches(struct zink_context *ctx, uint8_t patch_vertices) &ctx->gfx_pipeline_state.shader_keys.key[MESA_SHADER_TESS_CTRL].key.tcs; if (tcs->patch_vertices == patch_vertices) return false; - ctx->dirty_gfx_stages |= BITFIELD_BIT(MESA_SHADER_TESS_CTRL); + zink_update_dirty_gfx_stages(ctx, BITFIELD_BIT(MESA_SHADER_TESS_CTRL)); tcs->patch_vertices = patch_vertices; return true; } @@ -320,7 +321,7 @@ zink_update_gs_key_rectangular_line(struct zink_context *ctx); static inline struct zink_vs_key * zink_set_vs_key(struct zink_context *ctx) { - ctx->dirty_gfx_stages |= BITFIELD_BIT(MESA_SHADER_VERTEX); + zink_update_dirty_gfx_stages(ctx, BITFIELD_BIT(MESA_SHADER_VERTEX)); assert(!zink_screen(ctx->base.screen)->optimal_keys); return &ctx->gfx_pipeline_state.shader_keys.key[MESA_SHADER_VERTEX].key.vs; } @@ -378,7 +379,7 @@ zink_get_shader_key_base(const struct zink_context *ctx, mesa_shader_stage pstag static inline struct zink_shader_key_base * zink_set_shader_key_base(struct zink_context *ctx, mesa_shader_stage pstage) { - ctx->dirty_gfx_stages |= BITFIELD_BIT(pstage); + zink_update_dirty_gfx_stages(ctx, BITFIELD_BIT(pstage)); assert(!zink_screen(ctx->base.screen)->optimal_keys); return &ctx->gfx_pipeline_state.shader_keys.key[pstage].base; }