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 <samuel.pitoiset@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20073>
(cherry picked from commit b4f940913d)
This commit is contained in:
Samuel Pitoiset 2022-12-12 14:13:46 +01:00 committed by Eric Engestrom
parent a9b3fee4b0
commit a8911c50c8
4 changed files with 12 additions and 11 deletions

View file

@ -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
},

View file

@ -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;
}

View file

@ -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;

View file

@ -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