From fbcbbae6620d1d7a348a39f9c515c7bd6f28f042 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 31 Dec 2021 09:42:11 +1000 Subject: [PATCH] crocus: only clamp point size on last stage. This fixes a regression in tests that pass unclamped point size values between stages. This keeps xfb broken since the real way it should work is to have the hw clamp after xfb, but this seems the least evil path. Fixes: 3077d9685682 ("crocus: Clamp VS point sizes to the HW limits as required.") Reviewed-by: Emma Anholt Part-of: --- src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt | 10 ++-------- src/gallium/drivers/crocus/crocus_program.c | 12 +++++++++--- src/gallium/drivers/crocus/crocus_state.c | 12 ++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt b/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt index 9ea8a6b..8699b4f 100644 --- a/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt +++ b/src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt @@ -13,8 +13,6 @@ dEQP-GLES3.functional.rasterization.interpolation.projected.line_loop_wide,Fail dEQP-GLES3.functional.rasterization.interpolation.projected.line_strip_wide,Fail dEQP-GLES3.functional.rasterization.interpolation.projected.lines_wide,Fail KHR-GLES31.core.compressed_format.api.invalid_teximage_with_compressed_format,Fail -KHR-GLES31.core.tessellation_shader.tessellation_control_to_tessellation_evaluation.data_pass_through,Fail -KHR-GLES31.core.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_MaxPatchVertices_Position_PointSize,Fail # frontbuffer reading failures? spec@!opengl 1.1@read-front,Fail @@ -122,9 +120,6 @@ spec@arb_sample_shading@samplemask 8@sample mask_in_one,Fail spec@arb_shader_image_load_store@early-z,Fail spec@arb_shader_image_load_store@early-z@occlusion query test/early-z pass,Fail -spec@arb_tessellation_shader@execution@tcs-input@tcs-input-gl_pointsize,Fail -spec@arb_tessellation_shader@execution@tes-input@tes-input-gl_pointsize,Fail - spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail spec@arb_texture_buffer_object@formats (fs- arb),Crash @@ -158,15 +153,14 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export-tex,Fail spec@ext_packed_float@query-rgba-signed-components,Fail spec@ext_transform_feedback@tessellation triangle_fan flat_first,Fail + +# due to point size clamping in shaders since hw doesn't support it later. spec@ext_transform_feedback@builtin-varyings gl_pointsize,Fail spec@glsl-1.50@execution@geometry@primitive-types gl_line_loop,Fail spec@intel_performance_query@intel_performance_query-issue_2235,Fail -spec@glsl-1.50@execution@gs-redeclares-both-pervertex-blocks,Fail -spec@glsl-1.50@execution@gs-redeclares-pervertex-out-only,Fail - spec@khr_texture_compression_astc@miptree-gl srgb-fp,Fail spec@khr_texture_compression_astc@miptree-gl srgb-fp@sRGB decode full precision,Fail spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index 24fcaf1..ea6d281 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -1200,6 +1200,9 @@ crocus_compile_vs(struct crocus_context *ice, nir_shader_gather_info(nir, impl); } + if (key->clamp_pointsize) + nir_lower_point_size(nir, 1.0, 255.0); + prog_data->use_alt_mode = nir->info.is_arb_asm; crocus_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, @@ -1583,6 +1586,9 @@ crocus_compile_tes(struct crocus_context *ice, nir_shader_gather_info(nir, impl); } + if (key->clamp_pointsize) + nir_lower_point_size(nir, 1.0, 255.0); + crocus_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, &num_system_values, &num_cbufs); crocus_lower_swizzles(nir, &key->base.tex); @@ -1720,6 +1726,9 @@ crocus_compile_gs(struct crocus_context *ice, nir_shader_gather_info(nir, impl); } + if (key->clamp_pointsize) + nir_lower_point_size(nir, 1.0, 255.0); + crocus_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values, &num_system_values, &num_cbufs); crocus_lower_swizzles(nir, &key->base.tex); @@ -2701,9 +2710,6 @@ crocus_create_uncompiled_shader(struct pipe_context *ctx, NIR_PASS_V(nir, brw_nir_lower_storage_image, devinfo); NIR_PASS_V(nir, crocus_lower_storage_image_derefs); - if (nir->info.stage != MESA_SHADER_FRAGMENT && nir->info.stage != MESA_SHADER_COMPUTE) - NIR_PASS_V(nir, nir_lower_point_size, 1.0, 255.0); - nir_sweep(nir); ish->program_id = get_new_program_id(screen); diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c index f8b6fdc..38a04af 100644 --- a/src/gallium/drivers/crocus/crocus_state.c +++ b/src/gallium/drivers/crocus/crocus_state.c @@ -4689,6 +4689,10 @@ crocus_populate_vs_key(const struct crocus_context *ice, last_stage == MESA_SHADER_VERTEX) key->nr_userclip_plane_consts = cso_rast->num_clip_plane_consts; + if (last_stage == MESA_SHADER_VERTEX && + info->outputs_written & (VARYING_BIT_PSIZ)) + key->clamp_pointsize = 1; + #if GFX_VER <= 5 key->copy_edgeflag = (cso_rast->cso.fill_back != PIPE_POLYGON_MODE_FILL || cso_rast->cso.fill_front != PIPE_POLYGON_MODE_FILL); @@ -4732,6 +4736,10 @@ crocus_populate_tes_key(const struct crocus_context *ice, (info->outputs_written & (VARYING_BIT_POS | VARYING_BIT_CLIP_VERTEX)) && last_stage == MESA_SHADER_TESS_EVAL) key->nr_userclip_plane_consts = cso_rast->num_clip_plane_consts; + + if (last_stage == MESA_SHADER_TESS_EVAL && + info->outputs_written & (VARYING_BIT_PSIZ)) + key->clamp_pointsize = 1; } /** @@ -4749,6 +4757,10 @@ crocus_populate_gs_key(const struct crocus_context *ice, (info->outputs_written & (VARYING_BIT_POS | VARYING_BIT_CLIP_VERTEX)) && last_stage == MESA_SHADER_GEOMETRY) key->nr_userclip_plane_consts = cso_rast->num_clip_plane_consts; + + if (last_stage == MESA_SHADER_GEOMETRY && + info->outputs_written & (VARYING_BIT_PSIZ)) + key->clamp_pointsize = 1; } /** -- 2.7.4