From a8911c50c81c025e733e7ff2c19b8275f827ff60 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 12 Dec 2022 14:13:46 +0100 Subject: [PATCH] radv: do not remove the PointSize built-in for polygon mode as points Determine if it can be removed when generating the graphics pipeline key because of dynamic states. Fixes new CTS dEQP-VK.rasterization.polygon_as_large_points.* and also spec@!opengl 1.1@polygon-offset with Zink/RADV. Cc: 22.3 mesa-stable Signed-off-by: Samuel Pitoiset Reviewed-by: Erik Faye-Lund Reviewed-by: Bas Nieuwenhuizen Part-of: (cherry picked from commit b4f940913d386bad0e25a1e224d0f39631124593) --- .pick_status.json | 2 +- src/amd/vulkan/radv_pipeline.c | 19 ++++++++++--------- src/amd/vulkan/radv_shader.h | 1 + src/gallium/drivers/zink/ci/zink-radv-fails.txt | 1 - 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 7000b3e..6850734 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -571,7 +571,7 @@ "description": "radv: do not remove the PointSize built-in for polygon mode as points", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index ee24e1c..db90a0f 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -2322,16 +2322,9 @@ radv_remove_point_size(const struct radv_pipeline_key *pipeline_key, if (producer->xfb_info) return; - /* Do not remove PSIZ for vertex shaders when the topology is unknown. */ - if (producer->info.stage == MESA_SHADER_VERTEX && - pipeline_key->vs.topology == V_008958_DI_PT_NONE) - return; - /* Do not remove PSIZ if the rasterization primitive uses points. */ if (consumer->info.stage == MESA_SHADER_FRAGMENT && - ((producer->info.stage == MESA_SHADER_VERTEX && - pipeline_key->vs.topology == V_008958_DI_PT_POINTLIST) || - (producer->info.stage == MESA_SHADER_TESS_EVAL && producer->info.tess.point_mode) || + ((producer->info.stage == MESA_SHADER_TESS_EVAL && producer->info.tess.point_mode) || (producer->info.stage == MESA_SHADER_GEOMETRY && producer->info.gs.output_primitive == SHADER_PRIM_POINTS) || (producer->info.stage == MESA_SHADER_MESH && @@ -2500,7 +2493,8 @@ radv_pipeline_link_shaders(const struct radv_device *device, /* Remove PSIZ from shaders when it's not needed. * This is typically produced by translation layers like Zink or D9VK. */ - radv_remove_point_size(pipeline_key, producer, consumer); + if (pipeline_key->enable_remove_point_size) + radv_remove_point_size(pipeline_key, producer, consumer); if (nir_link_opt_varyings(producer, consumer)) { nir_validate_shader(producer, "after nir_link_opt_varyings"); @@ -2960,6 +2954,13 @@ radv_generate_graphics_pipeline_key(const struct radv_graphics_pipeline *pipelin key.dynamic_rasterization_samples = !!(pipeline->active_stages & VK_SHADER_STAGE_FRAGMENT_BIT) && !state->ms; + if (!(pipeline->dynamic_states & RADV_DYNAMIC_PRIMITIVE_TOPOLOGY) && + state->ia && state->ia->primitive_topology != VK_PRIMITIVE_TOPOLOGY_POINT_LIST && + !(pipeline->dynamic_states & RADV_DYNAMIC_POLYGON_MODE) && + state->rs && state->rs->polygon_mode != VK_POLYGON_MODE_POINT) { + key.enable_remove_point_size = true; + } + return key; } diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 8d7d6df..0e3eeea 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -64,6 +64,7 @@ struct radv_pipeline_key { uint32_t primitives_generated_query : 1; uint32_t dynamic_patch_control_points : 1; uint32_t dynamic_rasterization_samples : 1; + uint32_t enable_remove_point_size : 1; struct { uint32_t instance_rate_inputs; diff --git a/src/gallium/drivers/zink/ci/zink-radv-fails.txt b/src/gallium/drivers/zink/ci/zink-radv-fails.txt index 2f26862..2683aef 100644 --- a/src/gallium/drivers/zink/ci/zink-radv-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-radv-fails.txt @@ -379,7 +379,6 @@ spec@!opengl 1.1@polygon-mode-offset@config 6: Expected blue pixel in center,Fai spec@!opengl 1.1@polygon-mode-offset@config 6: Expected white pixel on right edge,Fail spec@!opengl 1.1@polygon-mode-offset@config 6: Expected white pixel on top edge,Fail spec@!opengl 1.1@polygon-mode-offset,Fail -spec@!opengl 1.1@polygon-offset,Fail spec@!opengl 1.5@depth-tex-compare,Fail spec@!opengl 2.0@depth-tex-modes-glsl,Fail spec@!opengl 2.0@gl-2.0-edgeflag,Fail -- 2.7.4