zink: mark dirty_gfx_stages using util function

more extensible for mesh

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37358>
This commit is contained in:
Mike Blumenkrantz
2025-09-03 10:40:48 -04:00
parent dce29ae35f
commit 308744e789
3 changed files with 15 additions and 8 deletions
+2 -2
View File
@@ -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;
}
+6
View File
@@ -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
+7 -6
View File
@@ -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;
}