freedreno/a6xx: Do clip-plane lowering in backend

Our GS-lowered-to-quasi-VS confuses core nir passes, so handle clip-
plane lowering ourself.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17341>
This commit is contained in:
Rob Clark 2022-07-04 07:55:43 -07:00 committed by Marge Bot
parent 5352cd02f8
commit c2c2da91a8
4 changed files with 18 additions and 23 deletions

View File

@ -289,26 +289,6 @@ spec@ext_transform_feedback@tessellation triangle_fan flat_first,Fail
spec@ext_transform_feedback@tessellation triangle_strip flat_first,Fail
spec@glsl-1.30@execution@texelfetch fs sampler3d 1x129x9-98x129x9,Fail
spec@glsl-1.30@execution@texelfetch fs sampler3d 98x1x9-98x129x9,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-const-accept,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-different-from-position,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-enables,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-equal-to-position,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-homogeneity,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-primitives-lines,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-primitives-points,Fail
spec@glsl-1.50@execution@compatibility@clipping@gs-clip-vertex-primitives-triangle-strip,Fail
# The precompile without UCP lowering triggers an assertion failure:
# "shader_io_get_unique_index: Assertion `!"illegal slot in get unique index\n"'
# failed." We shouldn't crash if clipvertex is written without actually doing
# clipping, we should just drop the output on the floor.
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-const-accept,Crash
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-const-reject,Crash
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-different-from-position,Crash
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-enables,Crash
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-equal-to-position,Crash
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-homogeneity,Crash
spec@glsl-1.50@execution@compatibility@clipping@vs-gs-clip-vertex-primitives-triangle-strip,Crash
spec@glsl-1.50@execution@compatibility@vs-gs-texcoord-array-2,Crash
spec@glsl-1.50@execution@compatibility@vs-gs-texcoord-array,Crash

View File

@ -4369,8 +4369,12 @@ emit_instructions(struct ir3_context *ctx)
ctx->so->num_samp =
BITSET_LAST_BIT(ctx->s->info.textures_used) + ctx->s->info.num_images;
/* Save off clip+cull information. */
ctx->so->clip_mask = MASK(ctx->s->info.clip_distance_array_size);
/* Save off clip+cull information. Note that in OpenGL clip planes may
* be individually enabled/disabled, and some gens handle lowering in
* backend, so we also need to consider the shader key:
*/
ctx->so->clip_mask = ctx->so->key.ucp_enables |
MASK(ctx->s->info.clip_distance_array_size);
ctx->so->cull_mask = MASK(ctx->s->info.cull_distance_array_size)
<< ctx->s->info.clip_distance_array_size;

View File

@ -152,6 +152,7 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
.fs = ctx->prog.fs,
.key = {
.rasterflat = ctx->rasterizer->flatshade,
.ucp_enables = ctx->rasterizer->clip_plane_enable,
.layer_zero = !gs_info || !(gs_info->outputs_written & VARYING_BIT_LAYER),
.sample_shading = (ctx->min_samples > 1),
.msaa = (ctx->framebuffer.samples > 1),

View File

@ -426,6 +426,14 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return is_a2xx(screen);
case PIPE_CAP_CLIP_PLANES:
/* Gens that support GS, have GS lowered into a quasi-VS which confuses
* the frontend clip-plane lowering. So we handle this in the backend
*
*/
if (pscreen->get_shader_param(pscreen, PIPE_SHADER_GEOMETRY,
PIPE_SHADER_CAP_MAX_INSTRUCTIONS))
return 1;
/* On a3xx, there is HW support for GL user clip planes that
* occasionally has to fall back to shader key-based lowering to clip
* distances in the VS, and we don't support clip distances so that is
@ -439,8 +447,10 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
* On a5xx-a6xx, we have the HW clip distances hooked up, so we just let
* mesa/st lower desktop GL's clip planes to clip distances in the last
* vertex shader stage.
*
* NOTE: but see comment above about geometry shaders
*/
return !is_a5xx(screen) && !is_a6xx(screen);
return !is_a5xx(screen);
/* Stream output. */
case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS: