diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-07-16 21:02:46 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-07-16 21:02:46 +0200 |
commit | a5a72cbd201489319856baaec88f02a6607423ae (patch) | |
tree | a260784d8810d6c3f982d77e7c7ebaa5dbf957c7 /src/video_core/renderer_vulkan | |
parent | Merge pull request #4342 from lioncash/endian (diff) | |
download | yuzu-a5a72cbd201489319856baaec88f02a6607423ae.tar yuzu-a5a72cbd201489319856baaec88f02a6607423ae.tar.gz yuzu-a5a72cbd201489319856baaec88f02a6607423ae.tar.bz2 yuzu-a5a72cbd201489319856baaec88f02a6607423ae.tar.lz yuzu-a5a72cbd201489319856baaec88f02a6607423ae.tar.xz yuzu-a5a72cbd201489319856baaec88f02a6607423ae.tar.zst yuzu-a5a72cbd201489319856baaec88f02a6607423ae.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_device.h | 5 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 12 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_device.h b/src/video_core/renderer_vulkan/vk_device.h index ae5c21baa..529744f2d 100644 --- a/src/video_core/renderer_vulkan/vk_device.h +++ b/src/video_core/renderer_vulkan/vk_device.h @@ -122,6 +122,11 @@ public: return properties.limits.maxPushConstantsSize; } + /// Returns the maximum size for shared memory. + u32 GetMaxComputeSharedMemorySize() const { + return properties.limits.maxComputeSharedMemorySize; + } + /// Returns true if ASTC is natively supported. bool IsOptimalAstcSupported() const { return is_optimal_astc_supported; diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 97429cc59..694452fd8 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp @@ -685,13 +685,19 @@ private: } t_smem_uint = TypePointer(spv::StorageClass::Workgroup, t_uint); - const u32 smem_size = specialization.shared_memory_size; + u32 smem_size = specialization.shared_memory_size * 4; if (smem_size == 0) { // Avoid declaring an empty array. return; } - const auto element_count = static_cast<u32>(Common::AlignUp(smem_size, 4) / 4); - const Id type_array = TypeArray(t_uint, Constant(t_uint, element_count)); + const u32 limit = device.GetMaxComputeSharedMemorySize(); + if (smem_size > limit) { + LOG_ERROR(Render_Vulkan, "Shared memory size {} is clamped to host's limit {}", + smem_size, limit); + smem_size = limit; + } + + const Id type_array = TypeArray(t_uint, Constant(t_uint, smem_size / 4)); const Id type_pointer = TypePointer(spv::StorageClass::Workgroup, type_array); Name(type_pointer, "SharedMemory"); |