From 24b1b1f5745d14865d1e1947a8882d5ed58470b4 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 17 Jul 2019 14:19:10 +0200 Subject: [PATCH] radv: add an option for disabling NGG on GFX10 Will be useful for testing the legacy path. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_debug.h | 1 + src/amd/vulkan/radv_device.c | 1 + src/amd/vulkan/radv_pipeline.c | 5 ++++- src/amd/vulkan/radv_private.h | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h index 75e28000e14..723fabda57f 100644 --- a/src/amd/vulkan/radv_debug.h +++ b/src/amd/vulkan/radv_debug.h @@ -52,6 +52,7 @@ enum { RADV_DEBUG_NOTHREADLLVM = 0x400000, RADV_DEBUG_NOBINNING = 0x800000, RADV_DEBUG_NO_LOAD_STORE_OPT = 0x1000000, + RADV_DEBUG_NO_NGG = 0x2000000, }; enum { diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 9e77dc7cb16..b397a9a8aa0 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -476,6 +476,7 @@ static const struct debug_control radv_debug_options[] = { {"nothreadllvm", RADV_DEBUG_NOTHREADLLVM}, {"nobinning", RADV_DEBUG_NOBINNING}, {"noloadstoreopt", RADV_DEBUG_NO_LOAD_STORE_OPT}, + {"nongg", RADV_DEBUG_NO_NGG}, {NULL, 0} }; diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index a3323ae8135..b1b90c8b035 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -173,6 +173,8 @@ static uint32_t get_hash_flags(struct radv_device *device) if (device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH) hash_flags |= RADV_HASH_SHADER_UNSAFE_MATH; + if (device->instance->debug_flags & RADV_DEBUG_NO_NGG) + hash_flags |= RADV_HASH_SHADER_NO_NGG; if (device->instance->perftest_flags & RADV_PERFTEST_SISCHED) hash_flags |= RADV_HASH_SHADER_SISCHED; return hash_flags; @@ -2300,7 +2302,8 @@ radv_fill_shader_keys(struct radv_device *device, keys[MESA_SHADER_VERTEX].vs_common_out.as_es = true; } - if (device->physical_device->rad_info.chip_class >= GFX10) { + if (device->physical_device->rad_info.chip_class >= GFX10 && + !(device->instance->debug_flags & RADV_DEBUG_NO_NGG)) { if (nir[MESA_SHADER_TESS_CTRL]) { keys[MESA_SHADER_TESS_EVAL].vs_common_out.as_ngg = true; } else { diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 29809ea53be..931d4039397 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1391,6 +1391,8 @@ struct radv_shader_module; #define RADV_HASH_SHADER_IS_GEOM_COPY_SHADER (1 << 0) #define RADV_HASH_SHADER_SISCHED (1 << 1) #define RADV_HASH_SHADER_UNSAFE_MATH (1 << 2) +#define RADV_HASH_SHADER_NO_NGG (1 << 3) + void radv_hash_shaders(unsigned char *hash, const VkPipelineShaderStageCreateInfo **stages, -- 2.30.2