MacOS: Workaround for Metal stride limitation (#445)

This commit is contained in:
Tillsunset 2022-11-03 06:51:32 -05:00 committed by GitHub
parent a129d22a57
commit 521f2fb707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -457,6 +457,12 @@ void PipelineCompiler::InitVertexInputState(const LatteContextRegister& latteReg
uint32 bufferStride = (latteRegister.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF; uint32 bufferStride = (latteRegister.GetRawView()[bufferBaseRegisterIndex + 2] >> 11) & 0xFFFF;
VkVertexInputBindingDescription entry{}; 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; entry.stride = bufferStride;
if (!fetchType.has_value() || fetchType == LatteConst::VertexFetchType2::VERTEX_DATA) if (!fetchType.has_value() || fetchType == LatteConst::VertexFetchType2::VERTEX_DATA)
entry.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; entry.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;