radeonsi: support 8 non-ClipVertex clip planes instead of 6

If there are more than 6 planes without gl_ClipVertex and gl_ClipDistance,
add "gl_ClipVertex = gl_Position;" to support up to 8 planes.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35529>
This commit is contained in:
Marek Olšák 2025-05-26 06:30:29 -04:00 committed by Marge Bot
parent 1b594e6745
commit c743c3dd1a
17 changed files with 24 additions and 17 deletions

View file

@ -411,7 +411,6 @@ spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail
spec@khr_texture_compression_astc@miptree-gles srgb-fp@sRGB decode full precision,Fail
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp,Fail
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode full precision,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.0@rasterpos,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_gs_linked,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail

View file

@ -30,8 +30,6 @@ spec@khr_texture_compression_astc@miptree-gles srgb-fp@sRGB decode full precisio
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp,Fail
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode full precision,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
# since Debian 12 (bookworm) uprev

View file

@ -1,6 +1,5 @@
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.0@rasterpos,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_gs_linked,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail

View file

@ -1,4 +1,3 @@
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.0@rasterpos,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_gs_linked,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail

View file

@ -7,7 +7,6 @@ glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-stencil -pixmap,Fail
glx@glx_arb_create_context_no_error@no error,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

1 # LLVM 18.1.2
7 glx@glx_arb_create_context_no_error@no error,Fail
8 glx@glx_ext_no_config_context@no fbconfig,Fail
9 spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail spec@!opengl 1.1@line-smooth-stipple,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
10 spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
11 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
12 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

View file

@ -7,7 +7,6 @@ glx@glx-multi-window-single-context,Fail
glx@glx-swap-event_interval,Fail
glx@glx_arb_create_context_no_error@no error,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

1 # piglit failures
7 glx@glx-swap-event_interval,Fail
8 glx@glx_arb_create_context_no_error@no error,Fail
9 glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
10 spec@!opengl 1.1@line-smooth-stipple,Fail
11 spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail
12 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

View file

@ -9,7 +9,6 @@ glx@glx-swap-event_interval,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
glx@glx-visuals-depth -pixmap,Warn
glx@glx-visuals-stencil -pixmap,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail

1 # LLVM 20-dev (da439d3af47b)
9 glx@glx-visuals-depth -pixmap,Warn
10 glx@glx-visuals-stencil -pixmap,Fail
11 spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail spec@!opengl 1.1@line-smooth-stipple,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
12 spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail
13 spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
14 spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail

View file

@ -5,7 +5,6 @@ glx@glx-swap-event_interval,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-stencil -pixmap,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-clip,Fail
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail

1 # piglit failures
5 glx@glx_ext_no_config_context@no fbconfig,Fail
6 glx@glx-visuals-depth -pixmap,Fail
7 glx@glx-visuals-stencil -pixmap,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
8 spec@!opengl 1.1@line-smooth-stipple,Fail
9 spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-clip,Fail
10 spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail

View file

@ -28,7 +28,6 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode ful
spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb-fp,Fail
spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb-fp@sRGB decode full precision,Fail
spec@oes_shader_io_blocks@compiler@layout-location-aliasing.vert,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
# These are hw bugs related to GS and primitive restart

Can't render this file because it has a wrong number of fields in line 33.

View file

@ -15,7 +15,6 @@ glx@glx_ext_import_context@make current- multi process,Fail
glx@glx_ext_import_context@make current- single process,Fail
glx@glx_ext_import_context@query context info,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@!opengl 1.1@texwrap formats bordercolor-swizzled,Fail
spec@!opengl 1.1@texwrap formats bordercolor-swizzled@GL_R3_G3_B2- swizzled- border color only,Fail

1 # piglit failures
15 glx@glx_ext_import_context@make current- single process,Fail
16 glx@glx_ext_import_context@query context info,Fail
17 glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
18 spec@!opengl 1.1@line-smooth-stipple,Fail
19 spec@!opengl 1.1@texwrap formats bordercolor-swizzled,Fail
20 spec@!opengl 1.1@texwrap formats bordercolor-swizzled@GL_R3_G3_B2- swizzled- border color only,Fail

View file

@ -5,7 +5,6 @@ glx@glx-multi-window-single-context,Fail
glx@glx-swap-event_interval,Fail
glx@glx-visuals-depth -pixmap,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@!opengl 1.1@texwrap formats bordercolor-swizzled,Fail
spec@!opengl 1.1@texwrap formats bordercolor-swizzled@GL_R3_G3_B2- swizzled- border color only,Fail

1 # piglit failures
5 glx@glx-swap-event_interval,Fail
6 glx@glx-visuals-depth -pixmap,Fail
7 glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
8 spec@!opengl 1.1@line-smooth-stipple,Fail
9 spec@!opengl 1.1@texwrap formats bordercolor-swizzled,Fail
10 spec@!opengl 1.1@texwrap formats bordercolor-swizzled@GL_R3_G3_B2- swizzled- border color only,Fail

View file

@ -19,7 +19,6 @@ spec@arb_texture_query_lod@compiler@built-in-functions@texturequerylod-samplercu
spec@arb_texture_query_lod@compiler@built-in-functions@texturequerylod-samplercubeshadow.frag,Crash
spec@arb_uniform_buffer_object@referenced-by-shader,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

1 # piglit failures
19 spec@arb_texture_query_lod@compiler@built-in-functions@texturequerylod-samplercubeshadow.frag,Crash
20 spec@arb_uniform_buffer_object@referenced-by-shader,Fail
21 glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
22 spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
23 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
24 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

View file

@ -18,7 +18,6 @@ glx@glx_ext_import_context@make current- multi process,Fail
glx@glx_ext_import_context@make current- single process,Fail
glx@glx_ext_import_context@query context info,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@!opengl 3.2@gl-3.2-adj-prims cull-back pv-last,Fail
spec@!opengl 3.2@gl-3.2-adj-prims cull-front pv-last,Fail

1 # piglit failures
18 glx@glx_ext_import_context@query context info,Fail
19 glx@glx_ext_no_config_context@no fbconfig,Fail
20 spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail spec@!opengl 1.1@line-smooth-stipple,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
21 spec@!opengl 3.2@gl-3.2-adj-prims cull-back pv-last,Fail
22 spec@!opengl 3.2@gl-3.2-adj-prims cull-front pv-last,Fail
23 spec@!opengl 3.2@gl-3.2-adj-prims line cull-back pv-last,Fail

View file

@ -994,6 +994,7 @@ static void si_dump_shader_key(const struct si_shader *shader, FILE *f)
stage == MESA_SHADER_VERTEX) &&
!key->ge.as_es && !key->ge.as_ls) {
fprintf(f, " mono.remove_streamout = 0x%x\n", key->ge.mono.remove_streamout);
fprintf(f, " mono.write_pos_to_clipvertex = %u\n", key->ge.mono.write_pos_to_clipvertex);
fprintf(f, " opt.kill_outputs = 0x%" PRIx64 "\n", key->ge.opt.kill_outputs);
fprintf(f, " opt.kill_clip_distances = 0x%x\n", key->ge.opt.kill_clip_distances);
fprintf(f, " opt.kill_pointsize = %u\n", key->ge.opt.kill_pointsize);
@ -1121,6 +1122,7 @@ static void si_lower_ngg(struct si_shader *shader, nir_shader *nir,
.vs_output_param_offset = temp_info->vs_output_param_offset,
.has_param_exports = shader->info.nr_param_exports,
.export_clipdist_mask = shader->info.clipdist_mask | shader->info.culldist_mask,
.write_pos_to_clipvertex = shader->key.ge.mono.write_pos_to_clipvertex,
.force_vrs = sel->screen->options.vrs2x2,
.use_gfx12_xfb_intrinsic = !nir->info.use_aco_amd,
.skip_viewport_state_culling = sel->info.writes_viewport_index,
@ -1534,7 +1536,7 @@ static void run_late_optimization_and_lowering_passes(struct si_nir_shader_ctx *
NIR_PASS_V(nir, ac_nir_lower_legacy_vs,
sel->screen->info.gfx_level,
shader->info.clipdist_mask | shader->info.culldist_mask,
false, false,
shader->key.ge.mono.write_pos_to_clipvertex, false,
ctx->temp_info.vs_output_param_offset,
shader->info.nr_param_exports,
shader->key.ge.mono.u.vs_export_prim_id,
@ -1566,6 +1568,7 @@ static void run_late_optimization_and_lowering_passes(struct si_nir_shader_ctx *
.has_pipeline_stats_query = sel->screen->use_ngg,
.gfx_level = sel->screen->info.gfx_level,
.export_clipdist_mask = shader->info.clipdist_mask | shader->info.culldist_mask,
.write_pos_to_clipvertex = shader->key.ge.mono.write_pos_to_clipvertex,
.param_offsets = ctx->temp_info.vs_output_param_offset,
.has_param_exports = shader->info.nr_param_exports,
.disable_streamout = !shader->info.num_streamout_vec4s,

View file

@ -635,6 +635,11 @@ struct si_shader_key_ge {
/* Gfx12: When no streamout buffers are bound, streamout must be disabled. */
unsigned remove_streamout : 1;
/* Emulate 8 clip planes using the CLIP_VERTEX output. Only 6 clip planes are supported
* without this.
*/
unsigned write_pos_to_clipvertex : 1;
} mono;
/* Optimization flags for asynchronous compilation only. */

View file

@ -259,8 +259,10 @@ void si_get_shader_variant_info(struct si_shader *shader,
shader->info.num_streamout_vec4s = DIV_ROUND_UP(num_streamout_dwords, 4);
}
shader->info.clipdist_mask = shader->selector->info.clipdist_mask &
~shader->key.ge.opt.kill_clip_distances;
shader->info.clipdist_mask =
(shader->key.ge.mono.write_pos_to_clipvertex ?
SI_USER_CLIP_PLANE_MASK : shader->selector->info.clipdist_mask) &
~shader->key.ge.opt.kill_clip_distances;
shader->info.culldist_mask = BITFIELD_RANGE(nir->info.clip_distance_array_size,
nir->info.cull_distance_array_size);
}

View file

@ -2474,6 +2474,16 @@ static void si_get_vs_key_outputs(struct si_context *sctx, struct si_shader_sele
if (sctx->gfx_level >= GFX12)
key->ge.mono.remove_streamout = key->ge.opt.remove_streamout;
/* The fixed-func hw only supports 6 clip planes, while gl_ClipVertex supports 8. */
if (!vs->info.clipdist_mask &&
sctx->queued.named.rasterizer->clip_plane_enable & BITFIELD_RANGE(6, 2)) {
key->ge.mono.write_pos_to_clipvertex = 1;
key->ge.opt.kill_clip_distances = SI_USER_CLIP_PLANE_MASK &
~sctx->queued.named.rasterizer->clip_plane_enable;
} else {
key->ge.mono.write_pos_to_clipvertex = 0;
}
}
static void si_clear_vs_key_outputs(struct si_context *sctx, struct si_shader_selector *vs,
@ -2486,6 +2496,7 @@ static void si_clear_vs_key_outputs(struct si_context *sctx, struct si_shader_se
key->ge.opt.ngg_vs_streamout_num_verts_per_prim = 0;
key->ge.mono.u.vs_export_prim_id = 0;
key->ge.mono.remove_streamout = 0;
key->ge.mono.write_pos_to_clipvertex = 0;
}
void si_ps_key_update_framebuffer(struct si_context *sctx)