diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index db6e88968d2..f14b475f745 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -590,7 +590,11 @@ Capability about the features and limits of the driver/GPU. that back-facing primitives should use the back-side color as the FS input color. If unset, mesa/st will lower it to gl_FrontFacing reads in the fragment shader. -* ``pipe_caps.clip_planes``: Driver supports user-defined clip-planes. 0 denotes none, 1 denotes MAX_CLIP_PLANES. > 1 overrides MAX. When is 0, pipe_rasterizer_state::clip_plane_enable is unused. +* ``pipe_caps.clip_planes``: Driver supports user-defined clip-planes. 0 denotes + none, 1 denotes MAX_CLIP_PLANES. > 1 overrides MAX. When is 0, + ``set_clip_state()`` will never be called. Instead, user clip planes are + lowered to clip distance writes to CLIP_DIST[] corresponding to + pipe_rasterizer_state::clip_plane_enable bits. * ``pipe_caps.max_vertex_buffers``: Number of supported vertex buffers. * ``pipe_caps.opencl_integer_functions``: Driver supports extended OpenCL-style integer functions. This includes average, saturating addition, saturating subtraction, absolute difference, count leading zeros, and count trailing zeros. * ``pipe_caps.integer_multiply_32x16``: Driver supports integer multiplication between a 32-bit integer and a 16-bit integer. If the second operand is 32-bits, the upper 16-bits are ignored, and the low 16-bits are possibly sign extended as necessary. diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 22b6ac91fdc..54040304d85 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -857,12 +857,6 @@ agx_sampler_view_destroy(struct pipe_context *ctx, FREE(view); } -static void -agx_set_clip_state(struct pipe_context *ctx, - const struct pipe_clip_state *state) -{ -} - static void agx_set_polygon_stipple(struct pipe_context *pctx, const struct pipe_poly_stipple *state) @@ -5550,7 +5544,6 @@ agx_init_state_functions(struct pipe_context *ctx) ctx->delete_tcs_state = agx_delete_shader_state; ctx->delete_tes_state = agx_delete_shader_state; ctx->set_blend_color = agx_set_blend_color; - ctx->set_clip_state = agx_set_clip_state; ctx->set_constant_buffer = agx_set_constant_buffer; ctx->set_shader_buffers = agx_set_shader_buffers; ctx->set_shader_images = agx_set_shader_images; diff --git a/src/gallium/drivers/d3d12/d3d12_context_graphics.cpp b/src/gallium/drivers/d3d12/d3d12_context_graphics.cpp index e8608862990..1bf4a1185e2 100644 --- a/src/gallium/drivers/d3d12/d3d12_context_graphics.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context_graphics.cpp @@ -1484,12 +1484,6 @@ d3d12_set_stencil_ref(struct pipe_context *pctx, ctx->state_dirty |= D3D12_DIRTY_STENCIL_REF; } -static void -d3d12_set_clip_state(struct pipe_context *pctx, - const struct pipe_clip_state *pcs) -{ -} - static struct pipe_stream_output_target * d3d12_create_stream_output_target(struct pipe_context *pctx, struct pipe_resource *pres, @@ -2298,7 +2292,6 @@ d3d12_init_graphics_context_functions(struct d3d12_context *ctx) ctx->base.set_scissor_states = d3d12_set_scissor_states; ctx->base.set_constant_buffer = d3d12_set_constant_buffer; ctx->base.set_framebuffer_state = d3d12_set_framebuffer_state; - ctx->base.set_clip_state = d3d12_set_clip_state; ctx->base.set_blend_color = d3d12_set_blend_color; ctx->base.set_sample_mask = d3d12_set_sample_mask; ctx->base.set_stencil_ref = d3d12_set_stencil_ref; diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h index 14638a034d5..fe1c7f905c6 100644 --- a/src/gallium/drivers/lima/lima_context.h +++ b/src/gallium/drivers/lima/lima_context.h @@ -203,7 +203,6 @@ struct lima_context { LIMA_CONTEXT_DIRTY_STENCIL_REF = (1 << 12), LIMA_CONTEXT_DIRTY_CONST_BUFF = (1 << 13), LIMA_CONTEXT_DIRTY_TEXTURES = (1 << 14), - LIMA_CONTEXT_DIRTY_CLIP = (1 << 15), LIMA_CONTEXT_DIRTY_UNCOMPILED_VS = (1 << 16), LIMA_CONTEXT_DIRTY_UNCOMPILED_FS = (1 << 17), LIMA_CONTEXT_DIRTY_SAMPLE_MASK = (1 << 18), diff --git a/src/gallium/drivers/lima/lima_state.c b/src/gallium/drivers/lima/lima_state.c index a84cedeb13b..550b18523ff 100644 --- a/src/gallium/drivers/lima/lima_state.c +++ b/src/gallium/drivers/lima/lima_state.c @@ -262,16 +262,6 @@ lima_set_stencil_ref(struct pipe_context *pctx, ctx->dirty |= LIMA_CONTEXT_DIRTY_STENCIL_REF; } -static void -lima_set_clip_state(struct pipe_context *pctx, - const struct pipe_clip_state *clip) -{ - struct lima_context *ctx = lima_context(pctx); - ctx->clip = *clip; - - ctx->dirty |= LIMA_CONTEXT_DIRTY_CLIP; -} - static void lima_set_constant_buffer(struct pipe_context *pctx, enum pipe_shader_type shader, uint index, @@ -425,7 +415,6 @@ lima_state_init(struct lima_context *ctx) ctx->base.set_scissor_states = lima_set_scissor_states; ctx->base.set_blend_color = lima_set_blend_color; ctx->base.set_stencil_ref = lima_set_stencil_ref; - ctx->base.set_clip_state = lima_set_clip_state; ctx->base.set_vertex_buffers = lima_set_vertex_buffers; ctx->base.set_constant_buffer = lima_set_constant_buffer; diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index fa9e0d6ecb5..42ad83c48fa 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -479,13 +479,6 @@ panfrost_set_min_samples(struct pipe_context *pipe, unsigned min_samples) ctx->dirty |= PAN_DIRTY_MSAA; } -static void -panfrost_set_clip_state(struct pipe_context *pipe, - const struct pipe_clip_state *clip) -{ - // struct panfrost_context *panfrost = pan_context(pipe); -} - static void panfrost_set_viewport_states(struct pipe_context *pipe, unsigned start_slot, unsigned num_viewports, @@ -1045,7 +1038,6 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags) gallium->set_sample_mask = panfrost_set_sample_mask; gallium->set_min_samples = panfrost_set_min_samples; - gallium->set_clip_state = panfrost_set_clip_state; gallium->set_viewport_states = panfrost_set_viewport_states; gallium->set_scissor_states = panfrost_set_scissor_states; gallium->set_polygon_stipple = panfrost_set_polygon_stipple; diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index f0cbe4247f3..f4dc50a1b24 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2769,7 +2769,6 @@ vc4_update_compiled_fs(struct vc4_context *vc4, uint8_t prim_mode) memset(key, 0, sizeof(*key)); vc4_setup_shared_key(vc4, &key->base, &vc4->fragtex); key->base.shader_state = vc4->prog.bind_fs; - nir_shader *vs = vc4->prog.bind_vs->base.ir.nir; key->ucp_enables = vc4->rasterizer->base.clip_plane_enable; key->is_points = (prim_mode == MESA_PRIM_POINTS); key->is_lines = (prim_mode >= MESA_PRIM_LINES && diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c index 9bfa3aab62d..e1354bbd5f6 100644 --- a/src/gallium/drivers/vc4/vc4_state.c +++ b/src/gallium/drivers/vc4/vc4_state.c @@ -67,12 +67,6 @@ vc4_set_stencil_ref(struct pipe_context *pctx, vc4->dirty |= VC4_DIRTY_STENCIL_REF; } -static void -vc4_set_clip_state(struct pipe_context *pctx, - const struct pipe_clip_state *clip) -{ -} - static void vc4_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask) { @@ -672,7 +666,6 @@ vc4_state_init(struct pipe_context *pctx) { pctx->set_blend_color = vc4_set_blend_color; pctx->set_stencil_ref = vc4_set_stencil_ref; - pctx->set_clip_state = vc4_set_clip_state; pctx->set_sample_mask = vc4_set_sample_mask; pctx->set_constant_buffer = vc4_set_constant_buffer; pctx->set_framebuffer_state = vc4_set_framebuffer_state; diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 9e2282b7800..5078b5ce68e 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2787,12 +2787,6 @@ zink_set_stencil_ref(struct pipe_context *pctx, ctx->stencil_ref_changed = true; } -static void -zink_set_clip_state(struct pipe_context *pctx, - const struct pipe_clip_state *pcs) -{ -} - static void zink_set_tess_state(struct pipe_context *pctx, const float default_outer_level[4], @@ -5475,7 +5469,6 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) ctx->base.set_shader_images = zink_set_shader_images; ctx->base.set_framebuffer_state = zink_set_framebuffer_state; ctx->base.set_stencil_ref = zink_set_stencil_ref; - ctx->base.set_clip_state = zink_set_clip_state; ctx->base.set_blend_color = zink_set_blend_color; ctx->base.set_tess_state = zink_set_tess_state; ctx->base.set_patch_vertices = zink_set_patch_vertices; diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 2ae7037a1c0..379619044b0 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -449,6 +449,9 @@ struct pipe_context { void (*set_min_samples)(struct pipe_context *, unsigned min_samples); + /* Called to set user clip plane state. Unused on GL drivers with + * !caps->clip_planes. + */ void (*set_clip_state)(struct pipe_context *, const struct pipe_clip_state *); diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 5160a0c2229..08957a22767 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -63,6 +63,7 @@ void st_update_clip( struct st_context *st ) if (memcmp(&st->state.clip, &clip, sizeof(clip)) != 0) { st->state.clip = clip; - st->pipe->set_clip_state(st->pipe, &clip); + if (!st->lower_ucp) + st->pipe->set_clip_state(st->pipe, &clip); } }