summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexLoaderX64.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2022-04-13 20:57:38 -0700
committerPokechu22 <Pokechu022@gmail.com>2022-04-22 16:54:38 -0700
commitf722bdf7f1ab5913d035f257ff82865a686b08d6 (patch)
treed47b39d512ac402204183e7d8c1916e62a5e24c2 /Source/Core/VideoCommon/VertexLoaderX64.cpp
parent6f1350ae51fec828c3440721588d10cccd893998 (diff)
VertexLoaderX64: Refactor so that zfreeze is only in one place
(Specifically, the copy for VertexLoaderManager::position_cache. The position matrix index happens elsewhere, and the float path still has special logic to copy to scratch3.)
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderX64.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexLoaderX64.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderX64.cpp b/Source/Core/VideoCommon/VertexLoaderX64.cpp
index 7a4929361d..734fa0819c 100644
--- a/Source/Core/VideoCommon/VertexLoaderX64.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderX64.cpp
@@ -114,6 +114,17 @@ int VertexLoaderX64::ReadVertex(OpArg data, VertexComponentFormat attribute, Com
X64Reg coords = XMM0;
+ const auto write_zfreeze = [&]() { // zfreeze
+ if (native_format == &m_native_vtx_decl.position)
+ {
+ CMP(32, R(count_reg), Imm8(3));
+ FixupBranch dont_store = J_CC(CC_A);
+ LEA(32, scratch3, MScaled(count_reg, SCALE_4, -4));
+ MOVUPS(MPIC(VertexLoaderManager::position_cache, scratch3, SCALE_4), coords);
+ SetJumpTarget(dont_store);
+ }
+ };
+
int elem_size = GetElementSize(format);
int load_bytes = elem_size * count_in;
OpArg dest = MDisp(dst_reg, m_dst_ofs);
@@ -217,16 +228,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, VertexComponentFormat attribute, Com
}
}
- // zfreeze
- if (native_format == &m_native_vtx_decl.position)
- {
- CMP(32, R(count_reg), Imm8(3));
- FixupBranch dont_store = J_CC(CC_A);
- LEA(32, scratch3, MScaled(count_reg, SCALE_4, -4));
- MOVUPS(MPIC(VertexLoaderManager::position_cache, scratch3, SCALE_4), coords);
- SetJumpTarget(dont_store);
- }
- return load_bytes;
+ write_zfreeze();
}
}
@@ -251,15 +253,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, VertexComponentFormat attribute, Com
break;
}
- // zfreeze
- if (native_format == &m_native_vtx_decl.position)
- {
- CMP(32, R(count_reg), Imm8(3));
- FixupBranch dont_store = J_CC(CC_A);
- LEA(32, scratch3, MScaled(count_reg, SCALE_4, -4));
- MOVUPS(MPIC(VertexLoaderManager::position_cache, scratch3, SCALE_4), coords);
- SetJumpTarget(dont_store);
- }
+ write_zfreeze();
return load_bytes;
}