From 9455710aaf912a5e1098371c4a73096408cfa579 Mon Sep 17 00:00:00 2001 From: Vishnu Vardan Date: Sat, 25 Apr 2026 22:08:51 -0400 Subject: [PATCH] mesa/st: remove emulate_gl_clamp from st_context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit emulate_gl_clamp is the negation of screen->caps.gl_clamp. Replace all call sites with !screen->caps.gl_clamp directly. Reviewed-by: Marek Olšák Part-of: --- src/mesa/state_tracker/st_atom_shader.c | 2 +- src/mesa/state_tracker/st_context.c | 4 +--- src/mesa/state_tracker/st_context.h | 1 - src/mesa/state_tracker/st_program.c | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 9f617517329..a990deca5ab 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -75,7 +75,7 @@ get_texture_index(struct gl_context *ctx, const unsigned unit) static void update_gl_clamp(struct st_context *st, struct gl_program *prog, uint32_t *gl_clamp) { - if (!st->emulate_gl_clamp) + if (st->screen->caps.gl_clamp) return; if (!st->ctx->Texture.NumSamplersWithClamp) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 400f7330f27..00bde0fff9b 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -418,7 +418,7 @@ st_init_driver_flags(struct st_context *st) ST_NEW_TES_STATE); } - if (st->emulate_gl_clamp) { + if (!st->screen->caps.gl_clamp) { ST_SET_SHADER_STATES(f->NewSamplersWithClamp, SAMPLERS); ST_SET_SHADER_STATES(f->NewSamplersWithClamp, STATE); } @@ -581,8 +581,6 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, st->alpha_border_color_is_not_w = !!(screen->caps.texture_border_color_quirk & PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_ALPHA_NOT_W); - st->emulate_gl_clamp = - !screen->caps.gl_clamp; st->has_time_elapsed = screen->caps.query_time_elapsed; ctx->Const.GLSLHasHalfFloatPacking = diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index c61b860d87d..32cf610d609 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -200,7 +200,6 @@ struct st_context bool apply_texture_swizzle_to_border_color; bool use_format_with_border_color; bool alpha_border_color_is_not_w; - bool emulate_gl_clamp; bool draw_needs_minmax_index; bool has_hw_atomics; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index b0b0b77b290..1dd38e9d082 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -837,7 +837,7 @@ st_create_common_variant(struct st_context *st, finalize = true; } - if (st->emulate_gl_clamp && + if (!st->screen->caps.gl_clamp && (key->gl_clamp[0] || key->gl_clamp[1] || key->gl_clamp[2])) { nir_lower_tex_options tex_opts = {0}; tex_opts.saturate_s = key->gl_clamp[0]; @@ -1118,7 +1118,7 @@ st_create_fp_variant(struct st_context *st, nir_lower_sample_shading(shader); } - if (st->emulate_gl_clamp && + if (!st->screen->caps.gl_clamp && (key->gl_clamp[0] || key->gl_clamp[1] || key->gl_clamp[2])) { nir_lower_tex_options tex_opts = {0}; tex_opts.saturate_s = key->gl_clamp[0];