Mesa (main): radv: disable small primitive culling for user sample locations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 27 08:35:52 UTC 2022


Module: Mesa
Branch: main
Commit: db7890637e2e96eceac747d6e90614109799f40b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=db7890637e2e96eceac747d6e90614109799f40b

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Jun 24 10:11:51 2022 +0200

radv: disable small primitive culling for user sample locations

The driver can't assume sample positions at (0.5, 0.5) when user
sample locations are used.

This doesn't fix anything in practice because NGGC is only enabled by
default on GFX10.3 and that extension is currently disabled on GFX10+,
but I would like to expose it at some point.

This fixes dEQP-VK.pipeline.*.sample_locations_ext.verify_location.*
(when the extension is enabled locally).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17228>

---

 src/amd/vulkan/radv_cmd_buffer.c | 6 ++++--
 src/amd/vulkan/radv_pipeline.c   | 1 +
 src/amd/vulkan/radv_private.h    | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index b56ed6740a4..064da750784 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -6681,8 +6681,10 @@ radv_get_ngg_culling_settings(struct radv_cmd_buffer *cmd_buffer, bool vp_y_inve
          : G_028814_CULL_BACK(pa_su_sc_mode_cntl))
       nggc_settings |= radv_nggc_back_face;
 
-   /* Small primitive culling is only valid when conservative overestimation is not used. */
-   if (!pipeline->uses_conservative_overestimate) {
+   /* Small primitive culling is only valid when conservative overestimation is not used. It's also
+    * disabled for user sample locations because small primitive culling assumes a sample
+    * position at (0.5, 0.5). */
+   if (!pipeline->uses_conservative_overestimate && !pipeline->uses_user_sample_locations) {
       nggc_settings |= radv_nggc_small_primitives;
 
       /* small_prim_precision = num_samples / 2^subpixel_bits
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index df50a56047e..d22314c49fa 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -7070,6 +7070,7 @@ radv_graphics_pipeline_init(struct radv_graphics_pipeline *pipeline, struct radv
       pipeline->base.shaders[pipeline->last_vgt_api_stage]->info.has_ngg_culling;
    pipeline->force_vrs_per_vertex =
       pipeline->base.shaders[pipeline->last_vgt_api_stage]->info.force_vrs_per_vertex;
+   pipeline->uses_user_sample_locations = info.ms.sample_locs_enable;
 
    pipeline->base.push_constant_size = pipeline_layout->push_constant_size;
    pipeline->base.dynamic_offset_count = pipeline_layout->dynamic_offset_count;
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 5bc2033a34d..42ba7ba0eaa 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -2105,6 +2105,7 @@ struct radv_graphics_pipeline {
    bool negative_one_to_one;
    bool use_per_attribute_vb_descs;
    bool can_use_simple_input;
+   bool uses_user_sample_locations;
 
    /* Whether the pipeline forces per-vertex VRS (GFX10.3+). */
    bool force_vrs_per_vertex;



More information about the mesa-commit mailing list