diff options
| author | JMC47 <JMC4789@gmail.com> | 2022-04-22 23:24:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-22 23:24:22 -0400 |
| commit | 56bb965ab944bd01bf511df31b7c9d91f8e62bd4 (patch) | |
| tree | a6078a76e52a86d89ec2f53b94bab9aeb0894bd0 /Source/Core/VideoCommon/VertexLoaderARM64.cpp | |
| parent | 2e01dc0c82b5f73215e3425ab45ff6c7ee50b389 (diff) | |
| parent | 784079853d9daa4d5e4de0b49b610ec0e58a2b0c (diff) | |
Merge pull request #10584 from Pokechu22/emboss-single-normal-v2
VideoCommon: Handle emboss texgen with only a single normal
Diffstat (limited to 'Source/Core/VideoCommon/VertexLoaderARM64.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoaderARM64.cpp | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/Source/Core/VideoCommon/VertexLoaderARM64.cpp b/Source/Core/VideoCommon/VertexLoaderARM64.cpp index 330deef548..eff8a29993 100644 --- a/Source/Core/VideoCommon/VertexLoaderARM64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderARM64.cpp @@ -14,7 +14,7 @@ using namespace Arm64Gen; constexpr ARM64Reg src_reg = ARM64Reg::X0; constexpr ARM64Reg dst_reg = ARM64Reg::X1; -constexpr ARM64Reg count_reg = ARM64Reg::W2; +constexpr ARM64Reg remaining_reg = ARM64Reg::W2; constexpr ARM64Reg skipped_reg = ARM64Reg::W17; constexpr ARM64Reg scratch1_reg = ARM64Reg::W16; constexpr ARM64Reg scratch2_reg = ARM64Reg::W15; @@ -209,12 +209,24 @@ int VertexLoaderARM64::ReadVertex(VertexComponentFormat attribute, ComponentForm // Z-Freeze if (native_format == &m_native_vtx_decl.position) { - CMP(count_reg, 3); - FixupBranch dont_store = B(CC_GT); - MOVP2R(EncodeRegTo64(scratch2_reg), VertexLoaderManager::position_cache); - ADD(EncodeRegTo64(scratch1_reg), EncodeRegTo64(scratch2_reg), EncodeRegTo64(count_reg), - ArithOption(EncodeRegTo64(count_reg), ShiftType::LSL, 4)); - m_float_emit.STUR(write_size, coords, EncodeRegTo64(scratch1_reg), -16); + CMP(remaining_reg, 3); + FixupBranch dont_store = B(CC_GE); + MOVP2R(EncodeRegTo64(scratch2_reg), VertexLoaderManager::position_cache.data()); + m_float_emit.STR(128, coords, EncodeRegTo64(scratch2_reg), ArithOption(remaining_reg, true)); + SetJumpTarget(dont_store); + } + else if (native_format == &m_native_vtx_decl.normals[1]) + { + FixupBranch dont_store = CBNZ(remaining_reg); + MOVP2R(EncodeRegTo64(scratch2_reg), VertexLoaderManager::tangent_cache.data()); + m_float_emit.STR(128, IndexType::Unsigned, coords, EncodeRegTo64(scratch2_reg), 0); + SetJumpTarget(dont_store); + } + else if (native_format == &m_native_vtx_decl.normals[2]) + { + FixupBranch dont_store = CBNZ(remaining_reg); + MOVP2R(EncodeRegTo64(scratch2_reg), VertexLoaderManager::binormal_cache.data()); + m_float_emit.STR(128, IndexType::Unsigned, coords, EncodeRegTo64(scratch2_reg), 0); SetJumpTarget(dont_store); } @@ -403,7 +415,7 @@ void VertexLoaderARM64::GenerateVertexLoader() AlignCode16(); if (IsIndexed(m_VtxDesc.low.Position)) MOV(skipped_reg, ARM64Reg::WZR); - MOV(saved_count, count_reg); + ADD(saved_count, remaining_reg, 1); MOVP2R(stride_reg, g_main_cp_state.array_strides.data()); MOVP2R(arraybase_reg, VertexLoaderManager::cached_arraybases.data()); @@ -420,10 +432,10 @@ void VertexLoaderARM64::GenerateVertexLoader() STR(IndexType::Unsigned, scratch1_reg, dst_reg, m_dst_ofs); // Z-Freeze - CMP(count_reg, 3); - FixupBranch dont_store = B(CC_GT); - MOVP2R(EncodeRegTo64(scratch2_reg), VertexLoaderManager::position_matrix_index); - STR(IndexType::Unsigned, scratch1_reg, EncodeRegTo64(scratch2_reg), 0); + CMP(remaining_reg, 3); + FixupBranch dont_store = B(CC_GE); + MOVP2R(EncodeRegTo64(scratch2_reg), VertexLoaderManager::position_matrix_index_cache.data()); + STR(scratch1_reg, EncodeRegTo64(scratch2_reg), ArithOption(remaining_reg, true)); SetJumpTarget(dont_store); m_native_vtx_decl.posmtx.components = 4; @@ -583,8 +595,8 @@ void VertexLoaderARM64::GenerateVertexLoader() const u8* cont = GetCodePtr(); ADD(src_reg, src_reg, m_src_ofs); - SUB(count_reg, count_reg, 1); - CBNZ(count_reg, loop_start); + SUBS(remaining_reg, remaining_reg, 1); + B(CCFlags::CC_GE, loop_start); if (IsIndexed(m_VtxDesc.low.Position)) { @@ -611,5 +623,5 @@ int VertexLoaderARM64::RunVertices(DataReader src, DataReader dst, int count) { m_numLoadedVertices += count; return ((int (*)(u8 * src, u8 * dst, int count)) region)(src.GetPointer(), dst.GetPointer(), - count); + count - 1); } |
