From 46ab5d63d62ccb70b3502fbdfffcbd04a3eefb65 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Tue, 20 Jan 2015 01:58:11 +0100 Subject: [PATCH] VertexLoader: never reset alpha in 8888 colors Fixes the opening menu of Xenoblade Chronicles. --- Source/Core/VideoCommon/VertexLoader.cpp | 3 --- Source/Core/VideoCommon/VertexLoader.h | 1 - Source/Core/VideoCommon/VertexLoaderX64.cpp | 7 +++---- Source/Core/VideoCommon/VertexLoaderX64.h | 2 +- Source/Core/VideoCommon/VertexLoader_Color.cpp | 11 +---------- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index f764aae478..4edb6a89ef 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -83,9 +83,6 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) m_posScale = 1.0f / (1U << m_VtxAttr.PosFrac); for (int i = 0; i < 8; i++) m_tcScale[i] = 1.0f / (1U << m_VtxAttr.texCoord[i].Frac); - - for (int i = 0; i < 2; i++) - m_colElements[i] = m_VtxAttr.color[i].Elements; } void VertexLoader::CompileVertexTranslator() diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h index 247dce8f41..009c1ae006 100644 --- a/Source/Core/VideoCommon/VertexLoader.h +++ b/Source/Core/VideoCommon/VertexLoader.h @@ -41,7 +41,6 @@ public: float m_tcScale[8]; int m_tcIndex; int m_colIndex; - int m_colElements[2]; // Matrix components are first in GC format but later in PC format - we need to store it temporarily // when decoding each vertex. diff --git a/Source/Core/VideoCommon/VertexLoaderX64.cpp b/Source/Core/VideoCommon/VertexLoaderX64.cpp index c9b435bae3..891643a592 100644 --- a/Source/Core/VideoCommon/VertexLoaderX64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderX64.cpp @@ -145,7 +145,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count return load_bytes; } -void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format, int elements) +void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format) { int load_bytes = 0; switch (format) @@ -154,8 +154,7 @@ void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format, int eleme case FORMAT_32B_888x: case FORMAT_32B_8888: MOV(32, R(scratch1), data); - // See VertexLoader_Color.cpp for a comment on this condition. - if (format != FORMAT_32B_8888 || !elements) + if (format != FORMAT_32B_8888) OR(32, R(scratch1), Imm32(0xFF000000)); MOV(32, MDisp(dst_reg, m_dst_ofs), R(scratch1)); load_bytes = 3 + (format != FORMAT_24B_888); @@ -363,7 +362,7 @@ void VertexLoaderX64::GenerateVertexLoader() if (col[i]) { data = GetVertexAddr(ARRAY_COLOR + i, col[i]); - ReadColor(data, col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements); + ReadColor(data, col[i], m_VtxAttr.color[i].Comp); m_native_components |= VB_HAS_COL0 << i; m_native_vtx_decl.colors[i].components = 4; m_native_vtx_decl.colors[i].enable = true; diff --git a/Source/Core/VideoCommon/VertexLoaderX64.h b/Source/Core/VideoCommon/VertexLoaderX64.h index 3cf9d7c8ba..206da1cf30 100644 --- a/Source/Core/VideoCommon/VertexLoaderX64.h +++ b/Source/Core/VideoCommon/VertexLoaderX64.h @@ -17,6 +17,6 @@ private: Gen::FixupBranch m_skip_vertex; Gen::OpArg GetVertexAddr(int array, u64 attribute); int ReadVertex(Gen::OpArg data, u64 attribute, int format, int count_in, int count_out, u8 scaling_exponent, AttributeFormat* native_format); - void ReadColor(Gen::OpArg data, u64 attribute, int format, int elements); + void ReadColor(Gen::OpArg data, u64 attribute, int format); void GenerateVertexLoader(); }; diff --git a/Source/Core/VideoCommon/VertexLoader_Color.cpp b/Source/Core/VideoCommon/VertexLoader_Color.cpp index 5f2a8106c7..00255de00a 100644 --- a/Source/Core/VideoCommon/VertexLoader_Color.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Color.cpp @@ -92,18 +92,9 @@ void LOADERDECL Color_ReadDirect_24b_6666(VertexLoader* loader) _SetCol6666(loader, Common::swap32(DataGetPosition() - 1)); DataSkip(3); } -// F|RES: i am not 100 percent sure, but the colElements seems to be important for rendering only -// at least it fixes mario party 4 void LOADERDECL Color_ReadDirect_32b_8888(VertexLoader* loader) { - // TODO (mb2): check this - u32 col = DataReadU32Unswapped(); - - // "kill" the alpha - if (!loader->m_colElements[loader->m_colIndex]) - col |= AMASK; - - _SetCol(loader, col); + _SetCol(loader, DataReadU32Unswapped()); } template