From 3dbd6cd384b09c1afabe26c607ca60c088515f60 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 26 Jan 2015 00:55:33 +0100 Subject: [PATCH] VertexLoaderX64: save XMM0 if the ABI requires it --- Source/Core/VideoCommon/VertexLoaderX64.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/VertexLoaderX64.cpp b/Source/Core/VideoCommon/VertexLoaderX64.cpp index de3b90b449..50c46da027 100644 --- a/Source/Core/VideoCommon/VertexLoaderX64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderX64.cpp @@ -11,6 +11,8 @@ using namespace Gen; +#define VERTEX_LOADER_REGS {XMM0+16} + static const X64Reg src_reg = ABI_PARAM1; static const X64Reg dst_reg = ABI_PARAM2; static const X64Reg scratch1 = RAX; @@ -293,10 +295,12 @@ void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format) void VertexLoaderX64::GenerateVertexLoader() { + ABI_PushRegistersAndAdjustStack(VERTEX_LOADER_REGS, 8); + // Backup count since we're going to count it down. PUSH(32, R(ABI_PARAM3)); - // We use ABI_PARAM3 for scratch2. + // ABI_PARAM3 is one of the lower registers, so free it for scratch2. MOV(32, R(count_reg), R(ABI_PARAM3)); if (m_VtxDesc.Position & MASK_INDEXED) @@ -427,6 +431,8 @@ void VertexLoaderX64::GenerateVertexLoader() // Get the original count. POP(32, R(ABI_RETURN)); + ABI_PopRegistersAndAdjustStack(VERTEX_LOADER_REGS, 8); + if (m_VtxDesc.Position & MASK_INDEXED) { SUB(32, R(ABI_RETURN), R(skipped_reg));