diff options
| author | 2023-05-02 17:52:41 -0700 | |
|---|---|---|
| committer | 2023-06-03 00:05:58 -0700 | |
| commit | ca4bf3844eb317c816f4b316967c7ae6697473d6 (patch) | |
| tree | ac5ff04295d4babc574a70485ba1b5c4187189c0 /src | |
| parent | android: fix deadzone calculation (diff) | |
| download | yuzu-ca4bf3844eb317c816f4b316967c7ae6697473d6.tar.gz yuzu-ca4bf3844eb317c816f4b316967c7ae6697473d6.tar.xz yuzu-ca4bf3844eb317c816f4b316967c7ae6697473d6.zip | |
video_core: Enable support_descriptor_aliasing on Turnip, disable storage atomic otherwise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 5 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp index 4b3043b65..0ce73f289 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& | |||
| 69 | Id StorageAtomicU64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, Id value, | 69 | Id StorageAtomicU64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, Id value, |
| 70 | Id (Sirit::Module::*atomic_func)(Id, Id, Id, Id, Id), | 70 | Id (Sirit::Module::*atomic_func)(Id, Id, Id, Id, Id), |
| 71 | Id (Sirit::Module::*non_atomic_func)(Id, Id, Id)) { | 71 | Id (Sirit::Module::*non_atomic_func)(Id, Id, Id)) { |
| 72 | if (!ctx.profile.support_descriptor_aliasing) { | ||
| 73 | LOG_WARNING(Shader_SPIRV, "Descriptor aliasing not supported, this cannot be atomic."); | ||
| 74 | return ctx.ConstantNull(ctx.U64); | ||
| 75 | } | ||
| 76 | |||
| 72 | if (ctx.profile.support_int64_atomics) { | 77 | if (ctx.profile.support_int64_atomics) { |
| 73 | const Id pointer{StoragePointer(ctx, ctx.storage_types.U64, &StorageDefinitions::U64, | 78 | const Id pointer{StoragePointer(ctx, ctx.storage_types.U64, &StorageDefinitions::U64, |
| 74 | binding, offset, sizeof(u64))}; | 79 | binding, offset, sizeof(u64))}; |
| @@ -86,6 +91,11 @@ Id StorageAtomicU64(EmitContext& ctx, const IR::Value& binding, const IR::Value& | |||
| 86 | 91 | ||
| 87 | Id StorageAtomicU32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, Id value, | 92 | Id StorageAtomicU32x2(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, Id value, |
| 88 | Id (Sirit::Module::*non_atomic_func)(Id, Id, Id)) { | 93 | Id (Sirit::Module::*non_atomic_func)(Id, Id, Id)) { |
| 94 | if (!ctx.profile.support_descriptor_aliasing) { | ||
| 95 | LOG_WARNING(Shader_SPIRV, "Descriptor aliasing not supported, this cannot be atomic."); | ||
| 96 | return ctx.ConstantNull(ctx.U32[2]); | ||
| 97 | } | ||
| 98 | |||
| 89 | LOG_WARNING(Shader_SPIRV, "Int64 atomics not supported, fallback to non-atomic"); | 99 | LOG_WARNING(Shader_SPIRV, "Int64 atomics not supported, fallback to non-atomic"); |
| 90 | const Id pointer{StoragePointer(ctx, ctx.storage_types.U32x2, &StorageDefinitions::U32x2, | 100 | const Id pointer{StoragePointer(ctx, ctx.storage_types.U32x2, &StorageDefinitions::U32x2, |
| 91 | binding, offset, sizeof(u32[2]))}; | 101 | 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.cpp index 48820b890..9482e91b0 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& device | |||
| 298 | profile = Shader::Profile{ | 298 | profile = Shader::Profile{ |
| 299 | .supported_spirv = device.SupportedSpirvVersion(), | 299 | .supported_spirv = device.SupportedSpirvVersion(), |
| 300 | .unified_descriptor_binding = true, | 300 | .unified_descriptor_binding = true, |
| 301 | #ifdef ANDROID | 301 | .support_descriptor_aliasing = device.IsDescriptorAliasingSupported(), |
| 302 | .support_descriptor_aliasing = false, | ||
| 303 | #else | ||
| 304 | .support_descriptor_aliasing = true, | ||
| 305 | #endif | ||
| 306 | .support_int8 = device.IsInt8Supported(), | 302 | .support_int8 = device.IsInt8Supported(), |
| 307 | .support_int16 = device.IsShaderInt16Supported(), | 303 | .support_int16 = device.IsShaderInt16Supported(), |
| 308 | .support_int64 = device.IsShaderInt64Supported(), | 304 | .support_int64 = device.IsShaderInt64Supported(), |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index f9d8c47ba..3c9d11617 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -295,6 +295,11 @@ public: | |||
| 295 | return features.features.textureCompressionASTC_LDR; | 295 | return features.features.textureCompressionASTC_LDR; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | /// Returns true if descriptor aliasing is natively supported. | ||
| 299 | bool IsDescriptorAliasingSupported() const { | ||
| 300 | return GetDriverID() != VK_DRIVER_ID_QUALCOMM_PROPRIETARY; | ||
| 301 | } | ||
| 302 | |||
| 298 | /// Returns true if the device supports float16 natively. | 303 | /// Returns true if the device supports float16 natively. |
| 299 | bool IsFloat16Supported() const { | 304 | bool IsFloat16Supported() const { |
| 300 | return features.shader_float16_int8.shaderFloat16; | 305 | return features.shader_float16_int8.shaderFloat16; |