VERY experimental Nintendo Switch 2 emulator
C++
video_core: Enable support_descriptor_aliasing on Turnip, disable storage atomic otherwise.
bunnei3571f28cde88
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cppindex 4b3043b657..0ce73f289b 100644--- a/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp+++ b/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp@@ -69,6 +69,11 @@ Id StorageAtomicU32(EmitContext& ctx, const IR::Value& binding, const IR::Value&Id StorageAtomicU64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, Id value,Id (Sirit::Module::*atomic_func)(Id, Id, Id, Id, Id),Id (Sirit::Module::*non_atomic_func)(Id, Id, Id)) {+ if (!ctx.profile.support_descriptor_aliasing) {+ LOG_WARNING(Shader_SPIRV, "Descriptor aliasing not supported, this cannot be atomic.");+ return ctx.ConstantNull(ctx.U64);+ }+if (ctx.profile.support_int64_atomics) {const Id pointer{StoragePointer(ctx, ctx.storage_types.U64, &StorageDefinitions::U64,binding, offset, sizeof(u64))};@@ -86,6 +91,11 @@ Id StorageAtomicU64(EmitContext& ctx, const IR::Value& binding, const IR::Value&Id StorageAtomicU32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, Id value,Id (Sirit::Module::*non_atomic_func)(Id, Id, Id)) {+ if (!ctx.profile.support_descriptor_aliasing) {+ LOG_WARNING(Shader_SPIRV, "Descriptor aliasing not supported, this cannot be atomic.");+ return ctx.ConstantNull(ctx.U32[2]);+ }+LOG_WARNING(Shader_SPIRV, "Int64 atomics not supported, fallback to non-atomic");const Id pointer{StoragePointer(ctx, ctx.storage_types.U32x2, &StorageDefinitions::U32x2,binding, offset, sizeof(u32[2]))};diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cppindex 48820b8905..9482e91b01 100644--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp@@ -298,11 +298,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& deviceprofile = Shader::Profile{.supported_spirv = device.SupportedSpirvVersion(),.unified_descriptor_binding = true,-#ifdef ANDROID- .support_descriptor_aliasing = false,-#else- .support_descriptor_aliasing = true,-#endif+ .support_descriptor_aliasing = device.IsDescriptorAliasingSupported(),.support_int8 = device.IsInt8Supported(),.support_int16 = device.IsShaderInt16Supported(),.support_int64 = device.IsShaderInt64Supported(),diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.hindex f9d8c47ba5..3c9d116172 100644--- a/src/video_core/vulkan_common/vulkan_device.h+++ b/src/video_core/vulkan_common/vulkan_device.h@@ -295,6 +295,11 @@ public:return features.features.textureCompressionASTC_LDR;}+ /// Returns true if descriptor aliasing is natively supported.+ bool IsDescriptorAliasingSupported() const {+ return GetDriverID() != VK_DRIVER_ID_QUALCOMM_PROPRIETARY;+ }+/// Returns true if the device supports float16 natively.bool IsFloat16Supported() const {return features.shader_float16_int8.shaderFloat16;