From 1914087998bc296208355dc4b1b2553430b081b2 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 20 Jun 2021 13:47:57 -0700 Subject: Create and use CPArray enum class --- Source/Core/VideoCommon/VertexLoaderARM64.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderARM64.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderARM64.cpp b/Source/Core/VideoCommon/VertexLoaderARM64.cpp index 71fc9e054c..6663e6c8ae 100644 --- a/Source/Core/VideoCommon/VertexLoaderARM64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderARM64.cpp @@ -6,6 +6,7 @@ #include #include "Common/CommonTypes.h" +#include "VideoCommon/CPMemory.h" #include "VideoCommon/DataReader.h" #include "VideoCommon/VertexLoaderManager.h" @@ -59,7 +60,7 @@ VertexLoaderARM64::VertexLoaderARM64(const TVtxDesc& vtx_desc, const VAT& vtx_at WriteProtect(); } -void VertexLoaderARM64::GetVertexAddr(int array, VertexComponentFormat attribute, ARM64Reg reg) +void VertexLoaderARM64::GetVertexAddr(CPArray array, VertexComponentFormat attribute, ARM64Reg reg) { if (IsIndexed(attribute)) { @@ -95,7 +96,7 @@ void VertexLoaderARM64::GetVertexAddr(int array, VertexComponentFormat attribute REV16(scratch1_reg, scratch1_reg); } - if (array == ARRAY_POSITION) + if (array == CPArray::Position) { EOR(scratch2_reg, scratch1_reg, attribute == VertexComponentFormat::Index8 ? LogicalImm(0xFF, 32) : @@ -103,17 +104,18 @@ void VertexLoaderARM64::GetVertexAddr(int array, VertexComponentFormat attribute m_skip_vertex = CBZ(scratch2_reg); } - LDR(IndexType::Unsigned, scratch2_reg, stride_reg, array * 4); + LDR(IndexType::Unsigned, scratch2_reg, stride_reg, static_cast(array) * 4); MUL(scratch1_reg, scratch1_reg, scratch2_reg); - LDR(IndexType::Unsigned, EncodeRegTo64(scratch2_reg), arraybase_reg, array * 8); + LDR(IndexType::Unsigned, EncodeRegTo64(scratch2_reg), arraybase_reg, + static_cast(array) * 8); ADD(EncodeRegTo64(reg), EncodeRegTo64(scratch1_reg), EncodeRegTo64(scratch2_reg)); } else ADD(reg, src_reg, m_src_ofs); } -s32 VertexLoaderARM64::GetAddressImm(int array, VertexComponentFormat attribute, +s32 VertexLoaderARM64::GetAddressImm(CPArray array, VertexComponentFormat attribute, Arm64Gen::ARM64Reg reg, u32 align) { if (IsIndexed(attribute) || (m_src_ofs > 255 && (m_src_ofs & (align - 1)))) @@ -448,8 +450,8 @@ void VertexLoaderARM64::GenerateVertexLoader() int load_size = GetLoadSize(load_bytes); load_size <<= 3; - s32 offset = GetAddressImm(ARRAY_POSITION, m_VtxDesc.low.Position, EncodeRegTo64(scratch1_reg), - load_size); + s32 offset = GetAddressImm(CPArray::Position, m_VtxDesc.low.Position, + EncodeRegTo64(scratch1_reg), load_size); ReadVertex(m_VtxDesc.low.Position, m_VtxAttr.g0.PosFormat, pos_elements, pos_elements, m_VtxAttr.g0.ByteDequant, m_VtxAttr.g0.PosFrac, &m_native_vtx_decl.position, offset); } @@ -470,7 +472,7 @@ void VertexLoaderARM64::GenerateVertexLoader() int load_bytes = elem_size * 3; int load_size = GetLoadSize(load_bytes); - offset = GetAddressImm(ARRAY_NORMAL, m_VtxDesc.low.Normal, EncodeRegTo64(scratch1_reg), + offset = GetAddressImm(CPArray::Normal, m_VtxDesc.low.Normal, EncodeRegTo64(scratch1_reg), load_size << 3); if (offset == -1) @@ -488,7 +490,7 @@ void VertexLoaderARM64::GenerateVertexLoader() } } - for (size_t i = 0; i < m_VtxDesc.low.Color.Size(); i++) + for (u8 i = 0; i < m_VtxDesc.low.Color.Size(); i++) { m_native_vtx_decl.colors[i].components = 4; m_native_vtx_decl.colors[i].type = VAR_UNSIGNED_BYTE; @@ -501,7 +503,7 @@ void VertexLoaderARM64::GenerateVertexLoader() m_VtxAttr.GetColorFormat(i) == ColorFormat::RGBA4444) align = 2; - s32 offset = GetAddressImm(ARRAY_COLOR0 + int(i), m_VtxDesc.low.Color[i], + s32 offset = GetAddressImm(CPArray::Color0 + i, m_VtxDesc.low.Color[i], EncodeRegTo64(scratch1_reg), align); ReadColor(m_VtxDesc.low.Color[i], m_VtxAttr.GetColorFormat(i), offset); m_native_vtx_decl.colors[i].components = 4; @@ -513,7 +515,7 @@ void VertexLoaderARM64::GenerateVertexLoader() } } - for (size_t i = 0; i < m_VtxDesc.high.TexCoord.Size(); i++) + for (u8 i = 0; i < m_VtxDesc.high.TexCoord.Size(); i++) { m_native_vtx_decl.texcoords[i].offset = m_dst_ofs; m_native_vtx_decl.texcoords[i].type = VAR_FLOAT; @@ -527,7 +529,7 @@ void VertexLoaderARM64::GenerateVertexLoader() int load_size = GetLoadSize(load_bytes); load_size <<= 3; - s32 offset = GetAddressImm(ARRAY_TEXCOORD0 + int(i), m_VtxDesc.high.TexCoord[i], + s32 offset = GetAddressImm(CPArray::TexCoord0 + i, m_VtxDesc.high.TexCoord[i], EncodeRegTo64(scratch1_reg), load_size); u8 scaling_exponent = m_VtxAttr.GetTexFrac(i); ReadVertex(m_VtxDesc.high.TexCoord[i], m_VtxAttr.GetTexFormat(i), elements, -- cgit v1.2.3 From b5fd35f95145ecc8f88a179229ed69b390eb76be Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 22 Apr 2021 20:57:56 -0700 Subject: Refactor OpcodeDecoding and FIFO analyzer to use callbacks --- Source/Core/VideoCommon/VertexLoaderARM64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/VertexLoaderARM64.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderARM64.cpp b/Source/Core/VideoCommon/VertexLoaderARM64.cpp index 6663e6c8ae..75afefed16 100644 --- a/Source/Core/VideoCommon/VertexLoaderARM64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderARM64.cpp @@ -405,7 +405,7 @@ void VertexLoaderARM64::GenerateVertexLoader() MOV(skipped_reg, ARM64Reg::WZR); MOV(saved_count, count_reg); - MOVP2R(stride_reg, g_main_cp_state.array_strides); + MOVP2R(stride_reg, g_main_cp_state.array_strides.data()); MOVP2R(arraybase_reg, VertexLoaderManager::cached_arraybases); if (need_scale) -- cgit v1.2.3 From d039b1bc0dfaba2a88036468b6d971bb1d7e463d Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 13 May 2021 16:05:31 -0700 Subject: VideoCommon: Move VertexLoaderManager logic out of CPState --- Source/Core/VideoCommon/VertexLoaderARM64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/VertexLoaderARM64.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderARM64.cpp b/Source/Core/VideoCommon/VertexLoaderARM64.cpp index 75afefed16..106f1cfd9e 100644 --- a/Source/Core/VideoCommon/VertexLoaderARM64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderARM64.cpp @@ -406,7 +406,7 @@ void VertexLoaderARM64::GenerateVertexLoader() MOV(saved_count, count_reg); MOVP2R(stride_reg, g_main_cp_state.array_strides.data()); - MOVP2R(arraybase_reg, VertexLoaderManager::cached_arraybases); + MOVP2R(arraybase_reg, VertexLoaderManager::cached_arraybases.data()); if (need_scale) MOVP2R(scale_reg, scale_factors); -- cgit v1.2.3 From 27cb7044669c62922be6f68913007d2567ce2480 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 26 Jun 2021 12:48:28 -0700 Subject: Eliminate VarType for ComponentFormat --- Source/Core/VideoCommon/VertexLoaderARM64.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderARM64.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderARM64.cpp b/Source/Core/VideoCommon/VertexLoaderARM64.cpp index 106f1cfd9e..330deef548 100644 --- a/Source/Core/VideoCommon/VertexLoaderARM64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderARM64.cpp @@ -221,7 +221,7 @@ int VertexLoaderARM64::ReadVertex(VertexComponentFormat attribute, ComponentForm native_format->components = count_out; native_format->enable = true; native_format->offset = m_dst_ofs; - native_format->type = VAR_FLOAT; + native_format->type = ComponentFormat::Float; native_format->integer = false; m_dst_ofs += sizeof(float) * count_out; @@ -429,7 +429,7 @@ void VertexLoaderARM64::GenerateVertexLoader() m_native_vtx_decl.posmtx.components = 4; m_native_vtx_decl.posmtx.enable = true; m_native_vtx_decl.posmtx.offset = m_dst_ofs; - m_native_vtx_decl.posmtx.type = VAR_UNSIGNED_BYTE; + m_native_vtx_decl.posmtx.type = ComponentFormat::UByte; m_native_vtx_decl.posmtx.integer = true; m_src_ofs += sizeof(u8); m_dst_ofs += sizeof(u32); @@ -493,7 +493,7 @@ void VertexLoaderARM64::GenerateVertexLoader() for (u8 i = 0; i < m_VtxDesc.low.Color.Size(); i++) { m_native_vtx_decl.colors[i].components = 4; - m_native_vtx_decl.colors[i].type = VAR_UNSIGNED_BYTE; + m_native_vtx_decl.colors[i].type = ComponentFormat::UByte; m_native_vtx_decl.colors[i].integer = false; if (m_VtxDesc.low.Color[i] != VertexComponentFormat::NotPresent) @@ -509,7 +509,7 @@ void VertexLoaderARM64::GenerateVertexLoader() m_native_vtx_decl.colors[i].components = 4; m_native_vtx_decl.colors[i].enable = true; m_native_vtx_decl.colors[i].offset = m_dst_ofs; - m_native_vtx_decl.colors[i].type = VAR_UNSIGNED_BYTE; + m_native_vtx_decl.colors[i].type = ComponentFormat::UByte; m_native_vtx_decl.colors[i].integer = false; m_dst_ofs += 4; } @@ -518,7 +518,7 @@ void VertexLoaderARM64::GenerateVertexLoader() for (u8 i = 0; i < m_VtxDesc.high.TexCoord.Size(); i++) { m_native_vtx_decl.texcoords[i].offset = m_dst_ofs; - m_native_vtx_decl.texcoords[i].type = VAR_FLOAT; + m_native_vtx_decl.texcoords[i].type = ComponentFormat::Float; m_native_vtx_decl.texcoords[i].integer = false; int elements = m_VtxAttr.GetTexElements(i) == TexComponentCount::S ? 1 : 2; @@ -540,7 +540,7 @@ void VertexLoaderARM64::GenerateVertexLoader() { m_native_vtx_decl.texcoords[i].components = 3; m_native_vtx_decl.texcoords[i].enable = true; - m_native_vtx_decl.texcoords[i].type = VAR_FLOAT; + m_native_vtx_decl.texcoords[i].type = ComponentFormat::Float; m_native_vtx_decl.texcoords[i].integer = false; LDRB(IndexType::Unsigned, scratch2_reg, src_reg, texmatidx_ofs[i]); -- cgit v1.2.3