From 46ab5d63d62ccb70b3502fbdfffcbd04a3eefb65 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Tue, 20 Jan 2015 01:58:11 +0100 Subject: VertexLoader: never reset alpha in 8888 colors Fixes the opening menu of Xenoblade Chronicles. --- Source/Core/VideoCommon/VertexLoaderX64.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderX64.cpp') 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; -- cgit v1.2.3 From 1dcf49237b81b850d5683887e3608fbab8c54b27 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Tue, 20 Jan 2015 02:12:03 +0100 Subject: VertexLoaderX64: support VAT.ByteDequant=0 --- Source/Core/VideoCommon/VertexLoaderX64.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderX64.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderX64.cpp b/Source/Core/VideoCommon/VertexLoaderX64.cpp index 891643a592..de3b90b449 100644 --- a/Source/Core/VideoCommon/VertexLoaderX64.cpp +++ b/Source/Core/VideoCommon/VertexLoaderX64.cpp @@ -67,7 +67,7 @@ OpArg VertexLoaderX64::GetVertexAddr(int array, u64 attribute) } } -int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count_in, int count_out, u8 scaling_exponent, AttributeFormat* native_format) +int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count_in, int count_out, bool dequantize, u8 scaling_exponent, AttributeFormat* native_format) { static const __m128i shuffle_lut[5][3] = { {_mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFF00L), // 1x u8 @@ -120,7 +120,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count CVTDQ2PS(coords, R(coords)); - if (scaling_exponent) + if (dequantize && scaling_exponent) MULPS(coords, M(&scale_factors[scaling_exponent])); } @@ -333,7 +333,8 @@ void VertexLoaderX64::GenerateVertexLoader() } OpArg data = GetVertexAddr(ARRAY_POSITION, m_VtxDesc.Position); - ReadVertex(data, m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements + 2, 3, m_VtxAttr.PosFrac, &m_native_vtx_decl.position); + ReadVertex(data, m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements + 2, 3, + m_VtxAttr.ByteDequant, m_VtxAttr.PosFrac, &m_native_vtx_decl.position); if (m_VtxDesc.Normal) { @@ -348,7 +349,8 @@ void VertexLoaderX64::GenerateVertexLoader() int elem_size = 1 << (m_VtxAttr.NormalFormat / 2); data.offset += i * elem_size * 3; } - data.offset += ReadVertex(data, m_VtxDesc.Normal, m_VtxAttr.NormalFormat, 3, 3, scaling_exponent, &m_native_vtx_decl.normals[i]); + data.offset += ReadVertex(data, m_VtxDesc.Normal, m_VtxAttr.NormalFormat, 3, 3, + true, scaling_exponent, &m_native_vtx_decl.normals[i]); } m_native_components |= VB_HAS_NRM0; @@ -384,7 +386,8 @@ void VertexLoaderX64::GenerateVertexLoader() { data = GetVertexAddr(ARRAY_TEXCOORD0 + i, tc[i]); u8 scaling_exponent = m_VtxAttr.texCoord[i].Frac; - ReadVertex(data, tc[i], m_VtxAttr.texCoord[i].Format, elements, tm[i] ? 2 : elements, scaling_exponent, &m_native_vtx_decl.texcoords[i]); + ReadVertex(data, tc[i], m_VtxAttr.texCoord[i].Format, elements, tm[i] ? 2 : elements, + m_VtxAttr.ByteDequant, scaling_exponent, &m_native_vtx_decl.texcoords[i]); m_native_components |= VB_HAS_UV0 << i; } if (tm[i]) -- cgit v1.2.3