radv: add a LLVM version string workaround for SotTR and ACO
When the LLVM version is too old or missing, SotTR applies shader workarounds and that reduces performance by 2-5% with ACO. SotTR workarounds are applied with LLVM 8 and older, so reporting LLVM 9.0.1 should be fine. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Edmondo Tommasina <edmondo.tommasina@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4984>
This commit is contained in:
parent
91c757b796
commit
1ef03dade1
|
@ -238,6 +238,25 @@ radv_physical_device_init_mem_types(struct radv_physical_device *device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
radv_get_compiler_string(struct radv_physical_device *pdevice)
|
||||||
|
{
|
||||||
|
if (pdevice->use_aco) {
|
||||||
|
/* Some games like SotTR apply shader workarounds if the LLVM
|
||||||
|
* version is too old or if the LLVM version string is
|
||||||
|
* missing. This gives 2-5% performance with SotTR and ACO.
|
||||||
|
*/
|
||||||
|
if (driQueryOptionb(&pdevice->instance->dri_options,
|
||||||
|
"radv_report_llvm9_version_string")) {
|
||||||
|
return "ACO/LLVM 9.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "ACO";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "LLVM " MESA_LLVM_VERSION_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
radv_physical_device_try_create(struct radv_instance *instance,
|
radv_physical_device_try_create(struct radv_instance *instance,
|
||||||
drmDevicePtr drm_device,
|
drmDevicePtr drm_device,
|
||||||
|
@ -334,8 +353,7 @@ radv_physical_device_try_create(struct radv_instance *instance,
|
||||||
|
|
||||||
snprintf(device->name, sizeof(device->name),
|
snprintf(device->name, sizeof(device->name),
|
||||||
"AMD RADV %s (%s)",
|
"AMD RADV %s (%s)",
|
||||||
device->rad_info.name,
|
device->rad_info.name, radv_get_compiler_string(device));
|
||||||
device->use_aco ? "ACO" : "LLVM " MESA_LLVM_VERSION_STRING);
|
|
||||||
|
|
||||||
if (radv_device_get_cache_uuid(device->rad_info.family, device->cache_uuid)) {
|
if (radv_device_get_cache_uuid(device->rad_info.family, device->cache_uuid)) {
|
||||||
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
|
@ -578,6 +596,7 @@ DRI_CONF_BEGIN
|
||||||
DRI_CONF_ADAPTIVE_SYNC("true")
|
DRI_CONF_ADAPTIVE_SYNC("true")
|
||||||
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
|
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
|
||||||
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false")
|
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false")
|
||||||
|
DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING("false")
|
||||||
DRI_CONF_SECTION_END
|
DRI_CONF_SECTION_END
|
||||||
|
|
||||||
DRI_CONF_SECTION_DEBUG
|
DRI_CONF_SECTION_DEBUG
|
||||||
|
@ -1492,7 +1511,7 @@ radv_get_physical_device_properties_1_2(struct radv_physical_device *pdevice,
|
||||||
snprintf(p->driverName, VK_MAX_DRIVER_NAME_SIZE, "radv");
|
snprintf(p->driverName, VK_MAX_DRIVER_NAME_SIZE, "radv");
|
||||||
snprintf(p->driverInfo, VK_MAX_DRIVER_INFO_SIZE,
|
snprintf(p->driverInfo, VK_MAX_DRIVER_INFO_SIZE,
|
||||||
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1 " (%s)",
|
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1 " (%s)",
|
||||||
pdevice->use_aco ? "ACO" : "LLVM " MESA_LLVM_VERSION_STRING);
|
radv_get_compiler_string(pdevice));
|
||||||
p->conformanceVersion = (VkConformanceVersion) {
|
p->conformanceVersion = (VkConformanceVersion) {
|
||||||
.major = 1,
|
.major = 1,
|
||||||
.minor = 2,
|
.minor = 2,
|
||||||
|
|
|
@ -673,4 +673,9 @@ TODO: document the other workarounds.
|
||||||
<option name="vs_position_always_invariant" value="true" />
|
<option name="vs_position_always_invariant" value="true" />
|
||||||
</application>
|
</application>
|
||||||
</device>
|
</device>
|
||||||
|
<device driver="radv">
|
||||||
|
<application name="Shadow Of The Tomb Raider" executable="ShadowOfTheTombRaider">
|
||||||
|
<option name="radv_report_llvm9_version_string" value="true" />
|
||||||
|
</application>
|
||||||
|
</device>
|
||||||
</driconf>
|
</driconf>
|
||||||
|
|
|
@ -421,3 +421,12 @@ DRI_CONF_OPT_END
|
||||||
DRI_CONF_OPT_BEGIN_V(gles_samples_passed_value, def, minimum, maximum) \
|
DRI_CONF_OPT_BEGIN_V(gles_samples_passed_value, def, minimum, maximum) \
|
||||||
DRI_CONF_DESC(en,gettext("GL_SAMPLES_PASSED value when emulated by GL_ANY_SAMPLES_PASSED")) \
|
DRI_CONF_DESC(en,gettext("GL_SAMPLES_PASSED value when emulated by GL_ANY_SAMPLES_PASSED")) \
|
||||||
DRI_CONF_OPT_END
|
DRI_CONF_OPT_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief RADV specific configuration options
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING(def) \
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue