Mesa (main): radv: move use of NGG to the graphics pipeline key

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 4 10:22:22 UTC 2021


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Sep 29 12:01:57 2021 +0200

radv: move use of NGG to the graphics pipeline key

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13099>

---

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

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 9fac3b31b62..5162f19c935 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -217,8 +217,6 @@ radv_get_hash_flags(const struct radv_device *device, bool stats)
 {
    uint32_t hash_flags = 0;
 
-   if (device->instance->debug_flags & RADV_DEBUG_NO_NGG)
-      hash_flags |= RADV_HASH_SHADER_NO_NGG;
    if (device->instance->perftest_flags & RADV_PERFTEST_NGGC)
       hash_flags |= RADV_HASH_SHADER_FORCE_NGG_CULLING;
    if (device->physical_device->cs_wave_size == 32)
@@ -2727,6 +2725,8 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline,
    if (pipeline->device->instance->debug_flags & RADV_DEBUG_INVARIANT_GEOM)
       key.invariant_geom = true;
 
+   key.use_ngg = pipeline->device->physical_device->use_ngg;
+
    return key;
 }
 
@@ -2832,7 +2832,7 @@ radv_fill_shader_info(struct radv_pipeline *pipeline,
          infos[MESA_SHADER_VERTEX].vs.as_es = true;
    }
 
-   if (device->physical_device->use_ngg) {
+   if (pipeline_key->use_ngg) {
       if (nir[MESA_SHADER_TESS_CTRL]) {
          infos[MESA_SHADER_TESS_EVAL].is_ngg = true;
       } else {
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 69179a1b641..5453ccc8fd0 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1654,7 +1654,6 @@ struct radv_event {
    uint64_t *map;
 };
 
-#define RADV_HASH_SHADER_NO_NGG            (1 << 0)
 #define RADV_HASH_SHADER_CS_WAVE32         (1 << 1)
 #define RADV_HASH_SHADER_PS_WAVE32         (1 << 2)
 #define RADV_HASH_SHADER_GE_WAVE32         (1 << 3)
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 169719eb700..5edbd97f095 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -621,7 +621,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
    if (nir->info.stage == MESA_SHADER_GEOMETRY) {
       unsigned nir_gs_flags = nir_lower_gs_intrinsics_per_stream;
 
-      if (device->physical_device->use_ngg && !radv_use_llvm_for_stage(device, stage)) {
+      if (key->use_ngg && !radv_use_llvm_for_stage(device, stage)) {
          /* ACO needs NIR to do some of the hard lifting */
          nir_gs_flags |= nir_lower_gs_intrinsics_count_primitives |
                          nir_lower_gs_intrinsics_count_vertices_per_primitive |
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index 09bc33cebfe..fc1752c3718 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -51,6 +51,7 @@ struct radv_pipeline_key {
    uint32_t has_multiview_view_index : 1;
    uint32_t optimisations_disabled : 1;
    uint32_t invariant_geom : 1;
+   uint32_t use_ngg : 1;
 
    struct {
       uint32_t instance_rate_inputs;



More information about the mesa-commit mailing list