Vulkan: Disable Optimizations for Qualcomm

Qualcomm driver can not handle the optimized SPIR-V that Blender
creates. According to their driver engineers this is an issue in
shaderc. As we are late in the release process they asked us to disable
the optimizations.

In Blender 4.4 we are planning to update shaderc what might fix the
issue. This should be retested after the update.

Pull Request: https://projects.blender.org/blender/blender/pulls/129775
This commit is contained in:
Jeroen Bakker
2024-11-05 08:05:42 +01:00
parent 007fd95f17
commit f76410329b
2 changed files with 27 additions and 15 deletions

View File

@@ -265,24 +265,31 @@ constexpr int32_t PCI_ID_APPLE = 0x106b;
eGPUDeviceType VKDevice::device_type() const
{
/* According to the vulkan specifications:
*
* If the vendor has a PCI vendor ID, the low 16 bits of vendorID must contain that PCI vendor
* ID, and the remaining bits must be set to zero. Otherwise, the value returned must be a valid
* Khronos vendor ID.
*/
switch (vk_physical_device_properties_.vendorID) {
case PCI_ID_NVIDIA:
return GPU_DEVICE_NVIDIA;
case PCI_ID_INTEL:
return GPU_DEVICE_INTEL;
case PCI_ID_AMD:
case PCI_ID_ATI:
switch (vk_physical_device_driver_properties_.driverID) {
case VK_DRIVER_ID_AMD_PROPRIETARY:
case VK_DRIVER_ID_AMD_OPEN_SOURCE:
case VK_DRIVER_ID_MESA_RADV:
return GPU_DEVICE_ATI;
case PCI_ID_APPLE:
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
case VK_DRIVER_ID_MESA_NVK:
return GPU_DEVICE_NVIDIA;
case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
return GPU_DEVICE_INTEL;
case VK_DRIVER_ID_QUALCOMM_PROPRIETARY:
return GPU_DEVICE_QUALCOMM;
case VK_DRIVER_ID_MOLTENVK:
return GPU_DEVICE_APPLE;
case VK_DRIVER_ID_MESA_LLVMPIPE:
return GPU_DEVICE_SOFTWARE;
default:
break;
return GPU_DEVICE_UNKNOWN;
}
return GPU_DEVICE_UNKNOWN;

View File

@@ -208,6 +208,11 @@ static bool compile_ex(shaderc::Compiler &compiler,
options.SetGenerateDebugInfo();
}
/* WORKAROUND: Qualcomm driver can crash when handling optimized SPIR-V. */
if (GPU_type_matches(GPU_DEVICE_QUALCOMM, GPU_OS_ANY, GPU_DRIVER_ANY)) {
options.SetOptimizationLevel(shaderc_optimization_level_zero);
}
std::string full_name = std::string(shader.name_get()) + "_" + to_stage_name(stage);
shader_module.compilation_result = compiler.CompileGlslToSpv(
shader_module.combined_sources, stage, full_name.c_str(), options);