case PIPE_CAP_ALPHA_TEST:
case PIPE_CAP_POINT_SIZE_FIXED:
case PIPE_CAP_TWO_SIDED_COLOR:
+ case PIPE_CAP_CLIP_PLANES:
return 1;
default:
* ``PIPE_CAP_POINT_SIZE_FIXED``: Driver supports point-sizes that are fixed,
as opposed to writing gl_PointSize for every point.
* ``PIPE_CAP_TWO_SIDED_COLOR``: Driver supports two-sided coloring.
+* ``PIPE_CAP_CLIP_PLANES``: Driver supports user-defined clip-planes.
.. _pipe_capf:
PIPE_CAP_ALPHA_TEST,
PIPE_CAP_POINT_SIZE_FIXED,
PIPE_CAP_TWO_SIDED_COLOR,
+ PIPE_CAP_CLIP_PLANES,
};
/**
key.lower_point_size = st->lower_point_size &&
!st_point_size_per_vertex(st->ctx);
+ /* _NEW_TRANSFORM */
+ if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx))
+ key.lower_ucp = st->ctx->Transform.ClipPlanesEnabled;
+
st->vp_variant = st_get_vp_variant(st, stvp, &key);
}
f->NewClipControl = ST_NEW_VIEWPORT | ST_NEW_RASTERIZER;
f->NewClipPlane = ST_NEW_CLIP_STATE;
- f->NewClipPlaneEnable = ST_NEW_RASTERIZER;
if (st->clamp_frag_depth_in_shader) {
f->NewClipControl |= ST_NEW_VS_STATE | ST_NEW_GS_STATE |
f->NewDepthClamp = ST_NEW_RASTERIZER;
}
+ if (st->lower_ucp)
+ f->NewClipPlaneEnable = ST_NEW_VS_STATE;
+ else
+ f->NewClipPlaneEnable = ST_NEW_RASTERIZER;
+
f->NewLineState = ST_NEW_RASTERIZER;
f->NewPolygonState = ST_NEW_RASTERIZER;
f->NewPolygonStipple = ST_NEW_POLY_STIPPLE;
!screen->get_param(screen, PIPE_CAP_POINT_SIZE_FIXED);
st->lower_two_sided_color =
!screen->get_param(screen, PIPE_CAP_TWO_SIDED_COLOR);
+ st->lower_ucp =
+ !screen->get_param(screen, PIPE_CAP_CLIP_PLANES);
st->has_hw_atomics =
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
st->has_shareable_shaders &&
!st->clamp_frag_depth_in_shader &&
!st->clamp_vert_color_in_shader &&
- !st->lower_point_size;
+ !st->lower_point_size &&
+ !st->lower_ucp;
st->shader_has_one_variant[MESA_SHADER_FRAGMENT] =
st->has_shareable_shaders &&
boolean lower_alpha_test;
boolean lower_point_size;
boolean lower_two_sided_color;
+ boolean lower_ucp;
/**
* If a shader can be created when we get its source.
point_size_state);
}
+ if (key->lower_ucp) {
+ struct pipe_screen *screen = pipe->screen;
+ bool can_compact = screen->get_param(screen,
+ PIPE_CAP_NIR_COMPACT_ARRAYS);
+
+ bool use_eye = st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] != NULL;
+ gl_state_index16 clipplane_state[MAX_CLIP_PLANES][STATE_LENGTH];
+ for (int i = 0; i < MAX_CLIP_PLANES; ++i) {
+ if (use_eye) {
+ clipplane_state[i][0] = STATE_CLIPPLANE;
+ clipplane_state[i][1] = i;
+ } else {
+ clipplane_state[i][0] = STATE_INTERNAL;
+ clipplane_state[i][1] = STATE_CLIP_INTERNAL;
+ clipplane_state[i][2] = i;
+ }
+ _mesa_add_state_reference(params, clipplane_state[i]);
+ }
+
+ NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_clip_vs, key->lower_ucp,
+ true, can_compact, clipplane_state);
+ NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(vpv->tgsi.ir.nir), true, false);
+ }
+
st_finalize_nir(st, &stvp->Base, stvp->shader_program,
vpv->tgsi.ir.nir);
/** lower glPointSize to gl_PointSize */
boolean lower_point_size;
+
+ /* for user-defined clip-planes */
+ uint8_t lower_ucp;
};