From 45dc94b1bb48e6c6504831f08c68f8d7d6bd915e Mon Sep 17 00:00:00 2001 From: Vishnu Vardan Date: Sun, 26 Apr 2026 00:23:36 -0400 Subject: [PATCH] mesa/st: remove lower_ucp from st_context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lower_ucp is the negation of screen->caps.clip_planes. Replace all call sites with !screen->caps.clip_planes directly. Reviewed-by: Marek Olšák Part-of: --- src/mesa/state_tracker/st_atom_clip.c | 2 +- src/mesa/state_tracker/st_atom_shader.c | 4 ++-- src/mesa/state_tracker/st_context.c | 10 ++++------ src/mesa/state_tracker/st_context.h | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 08957a22767..e12b2578a43 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -63,7 +63,7 @@ void st_update_clip( struct st_context *st ) if (memcmp(&st->state.clip, &clip, sizeof(clip)) != 0) { st->state.clip = clip; - if (!st->lower_ucp) + if (st->screen->caps.clip_planes) st->pipe->set_clip_state(st->pipe, &clip); } } diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 023fd07824b..51ce17032ce 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -243,7 +243,7 @@ st_update_vp( struct st_context *st ) if (st->lower_point_size) key.export_point_size = !st->ctx->VertexProgram.PointSizeEnabled && !st->ctx->PointSizeIsSet; /* _NEW_TRANSFORM */ - if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx)) + if (!st->screen->caps.clip_planes && st_user_clip_planes_enabled(st->ctx)) key.lower_ucp = st->ctx->Transform.ClipPlanesEnabled; } @@ -292,7 +292,7 @@ st_update_common_program(struct st_context *st, struct gl_program *prog, VARYING_SLOT_BFC0 | VARYING_SLOT_BFC1)); - if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx) && + if (!st->screen->caps.clip_planes && st_user_clip_planes_enabled(st->ctx) && (pipe_shader == MESA_SHADER_GEOMETRY || !st->ctx->GeometryProgram._Current)) key.lower_ucp = st->ctx->Transform.ClipPlanesEnabled; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 995b1a0b740..a969a527d71 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -413,7 +413,7 @@ st_init_driver_flags(struct st_context *st) } ST_SET_STATE(f->NewClipPlaneEnable, ST_NEW_RASTERIZER); - if (st->lower_ucp) { + if (!st->screen->caps.clip_planes) { ST_SET_STATE3(f->NewClipPlaneEnable, ST_NEW_VS_STATE, ST_NEW_GS_STATE, ST_NEW_TES_STATE); } @@ -593,8 +593,6 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, break; default: break; } - st->lower_ucp = - !screen->caps.clip_planes; st->prefer_real_buffer_in_constbuf0 = screen->caps.prefer_real_buffer_in_constbuf0; st->has_conditional_render = @@ -673,7 +671,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, st->screen->caps.shareable_shaders && !st->clamp_vert_color_in_shader && !st->lower_point_size && - (is_gles2 || !st->lower_ucp); + (is_gles2 || st->screen->caps.clip_planes); st->shader_has_one_variant[MESA_SHADER_FRAGMENT] = st->screen->caps.shareable_shaders && @@ -688,13 +686,13 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, st->screen->caps.shareable_shaders && !st->clamp_vert_color_in_shader && !st->lower_point_size && - (is_gles2 || !st->lower_ucp); + (is_gles2 || st->screen->caps.clip_planes); st->shader_has_one_variant[MESA_SHADER_GEOMETRY] = st->screen->caps.shareable_shaders && !st->clamp_vert_color_in_shader && !st->lower_point_size && - (is_gles2 || !st->lower_ucp); + (is_gles2 || st->screen->caps.clip_planes); st->shader_has_one_variant[MESA_SHADER_COMPUTE] = st->screen->caps.shareable_shaders; if (!st->pipe->set_context_param || !util_thread_scheduler_enabled()) diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 000700bd967..c92080fa738 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -162,7 +162,6 @@ struct st_context bool can_bind_const_buffer_as_vertex; bool lower_point_size; bool add_point_size; - bool lower_ucp; bool prefer_real_buffer_in_constbuf0; bool has_conditional_render; bool lower_rect_tex;