From 521f2fb7073c3f1b84ac293a724d15761b922152 Mon Sep 17 00:00:00 2001 From: Tillsunset <35825944+Tillsunset@users.noreply.github.com> Date: Thu, 3 Nov 2022 06:51:32 -0500 Subject: [PATCH] MacOS: Workaround for Metal stride limitation (#445) --- .../HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp index 0deacddd..6e433466 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp @@ -457,6 +457,12 @@ void PipelineCompiler::InitVertexInputState(const LatteContextRegister& latteReg uint32 bufferStride = (latteRegister.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF; VkVertexInputBindingDescription entry{}; +#if BOOST_OS_MACOS + if (bufferStride % 4 != 0) { + forceLog_printf("MoltenVK error: vertex stride was %d, expected multiple of 4", bufferStride); + bufferStride = 0; + } +#endif entry.stride = bufferStride; if (!fetchType.has_value() || fetchType == LatteConst::VertexFetchType2::VERTEX_DATA) entry.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;