radv: use nir_lower_discard_to_demote to work around game bugs

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047>
This commit is contained in:
Daniel Schürmann
2020-03-04 17:35:26 +01:00
committed by Marge Bot
parent 9d64ad2fe7
commit bdd7587414
3 changed files with 6 additions and 0 deletions

View File

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

View File

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

View File

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