To replace NaN from FS with zeros to fix game bugs.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5359>
instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
}
}
+
+ instance->enable_mrt_output_nan_fixup =
+ driQueryOptionb(&instance->dri_options,
+ "radv_enable_mrt_output_nan_fixup");
}
static const char radv_dri_options_xml[] =
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false")
DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING("false")
+ DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP("false")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
struct driOptionCache dri_options;
struct driOptionCache available_dri_options;
+
+ /**
+ * Workarounds for game bugs.
+ */
+ bool enable_mrt_output_nan_fixup;
};
static inline
options->address32_hi = device->physical_device->rad_info.address32_hi;
options->has_ls_vgpr_init_bug = device->physical_device->rad_info.has_ls_vgpr_init_bug;
options->use_ngg_streamout = device->physical_device->use_ngg_streamout;
+ options->enable_mrt_output_nan_fixup = device->instance->enable_mrt_output_nan_fixup;
struct radv_shader_args args = {};
args.options = options;
bool check_ir;
bool has_ls_vgpr_init_bug;
bool use_ngg_streamout;
+ bool enable_mrt_output_nan_fixup;
enum radeon_family family;
enum chip_class chip_class;
uint32_t tess_offchip_block_dw_size;
DRI_CONF_OPT_BEGIN_B(radv_report_llvm9_version_string, def) \
DRI_CONF_DESC(en,gettext("Report LLVM 9.0.1 for games that apply shader workarounds if missing (for ACO only)")) \
DRI_CONF_OPT_END
+
+#define DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP(def) \
+DRI_CONF_OPT_BEGIN_B(radv_enable_mrt_output_nan_fixup, def) \
+ DRI_CONF_DESC(en,gettext("Replace NaN outputs from fragment shaders with zeroes for floating point render target")) \
+DRI_CONF_OPT_END