VertexLoader: never reset alpha in 8888 colors
Fixes the opening menu of Xenoblade Chronicles.
This commit is contained in:
parent
80617ec6bd
commit
46ab5d63d6
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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 <typename I>
|
||||
|
|
Loading…
Reference in New Issue