From 380112bcb4937a083ea7b4a4ae53da546da670ff Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Thu, 6 Nov 2025 09:59:01 -0400 Subject: [PATCH] Added QCOM helper for driver detections --- src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 6 +++--- src/video_core/shader_environment.h | 8 +++++++- src/video_core/vulkan_common/vulkan_device.h | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index b35a33c326..a53cb13c99 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -376,13 +376,13 @@ PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA, .has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, - .has_broken_spirv_position_input = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY, + .has_broken_spirv_position_input = device.IsQualcomm(), .has_broken_unsigned_image_offsets = false, .has_broken_signed_operations = false, .has_broken_fp16_float_controls = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY, .ignore_nan_fp_comparisons = false, .has_broken_spirv_subgroup_mask_vector_extract_dynamic = - driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY, + device.IsQualcomm(), .has_broken_robust = device.IsNvidia() && device.GetNvidiaArch() <= NvidiaArchitecture::Arch_Pascal, .min_ssbo_alignment = device.GetStorageBufferAlignment(), @@ -449,7 +449,7 @@ GraphicsPipeline* PipelineCache::CurrentGraphicsPipeline() { // Decide per-pipeline FTZ (flush-to-zero) usage based on device float-controls // properties and vendor-specific workarounds, going initially for Qualcomm drivers const bool force_extensions = Settings::values.force_unsupported_extensions.GetValue(); - const bool is_qualcomm = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY; + const bool is_qualcomm = device.IsQualcomm(); const auto& float_control = device.FloatControlProperties(); const bool has_khr_float_controls = device.IsKhrShaderFloatControlsSupported(); const bool denorm_indep_all = float_control.denormBehaviorIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL; diff --git a/src/video_core/shader_environment.h b/src/video_core/shader_environment.h index 95c2d79277..27e9c078f2 100644 --- a/src/video_core/shader_environment.h +++ b/src/video_core/shader_environment.h @@ -222,7 +222,13 @@ template void SerializePipeline(const Key& key, const Envs& envs, const std::filesystem::path& filename, u32 cache_version) { static_assert(std::is_trivially_copyable_v); - static_assert(std::has_unique_object_representations_v); + // Note: we relax the unique object representation requirement because some + // pipeline/key types (e.g. GraphicsPipelineCacheKey) contain unions or + // bitfield-backed types that do not guarantee "unique object + // representations" across compilers/platforms. We still require + // trivially-copyable so the raw byte serialization is well-defined for a + // given build. Be aware that serialized blobs may not be portable across + // builds with different compilers or packing rules. SerializePipeline(std::span(reinterpret_cast(&key), sizeof(key)), std::span(envs.data(), envs.size()), filename, cache_version); } diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 98059c5707..9d5c4c4eae 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -732,6 +732,10 @@ public: return properties.driver.driverID == VK_DRIVER_ID_MOLTENVK; } + bool IsQualcomm() const noexcept { + return properties.driver.driverID == VK_DRIVER_ID_QUALCOMM_PROPRIETARY; + } + NvidiaArchitecture GetNvidiaArch() const noexcept { return nvidia_arch; }