aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorDaniel Schürmann <[email protected]>2020-03-04 17:35:26 +0100
committerMarge Bot <[email protected]>2020-03-09 12:29:32 +0000
commitbdd7587414441920743fe476270560722b6beb18 (patch)
treec44d0c39a423b4195924b1eb3b4f6accb1b6cfc7 /src/amd
parent9d64ad2fe791fcdc3c8c8c2115febdea7cd3e1ba (diff)
radv: use nir_lower_discard_to_demote to work around game bugs
Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_debug.h1
-rw-r--r--src/amd/vulkan/radv_device.c3
-rw-r--r--src/amd/vulkan/radv_shader.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index 545eaa51caf..979b448c6ad 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -56,6 +56,7 @@ enum {
RADV_DEBUG_ALL_ENTRYPOINTS = 0x2000000,
RADV_DEBUG_DUMP_META_SHADERS = 0x4000000,
RADV_DEBUG_NO_MEMORY_CACHE = 0x8000000,
+ RADV_DEBUG_DISCARD_TO_DEMOTE = 0x10000000,
};
enum {
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index d59f791cba1..c55e219e6c8 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -599,6 +599,9 @@ radv_handle_per_app_options(struct radv_instance *instance,
* uninitialized data in an indirect draw.
*/
instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
+ } else if (!strcmp(name, "No Man's Sky")) {
+ /* Work around a NMS game bug */
+ instance->debug_flags |= RADV_DEBUG_DISCARD_TO_DEMOTE;
}
}
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 40fa3d783d4..37b8ee45e34 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -445,6 +445,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
NIR_PASS_V(nir, nir_lower_system_values);
NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
NIR_PASS_V(nir, radv_nir_lower_ycbcr_textures, layout);
+ if (device->instance->debug_flags & RADV_DEBUG_DISCARD_TO_DEMOTE)
+ NIR_PASS_V(nir, nir_lower_discard_to_demote);
}
/* Vulkan uses the separate-shader linking model */