diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 2484a285d67..dcbc559a1b7 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -586,6 +586,8 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st NIR_PASS(_, nir, nir_lower_load_const_to_scalar); NIR_PASS(_, nir, nir_opt_shrink_stores, !instance->drirc.disable_shrink_image_store); + if (nir->info.stage == MESA_SHADER_FRAGMENT && nir->info.fs.uses_discard) + NIR_PASS(_, nir, nir_lower_discard_if, nir_move_terminate_out_of_loops); const nir_opt_access_options opt_access_options = { .is_vulkan = true,