mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Eliminate TVtxAttr
This commit is contained in:
@ -393,10 +393,11 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
for (size_t i = 0; i < m_VtxDesc.high.TexCoord.Size(); i++)
|
||||
{
|
||||
has_tc |= m_VtxDesc.high.TexCoord[i] != VertexComponentFormat::NotPresent;
|
||||
has_tc_scale |= !!m_VtxAttr.texCoord[i].Frac;
|
||||
has_tc_scale |= (m_VtxAttr.GetTexFrac(i) != 0);
|
||||
}
|
||||
|
||||
bool need_scale = (m_VtxAttr.ByteDequant && m_VtxAttr.PosFrac) || (has_tc && has_tc_scale) ||
|
||||
bool need_scale = (m_VtxAttr.g0.ByteDequant && m_VtxAttr.g0.PosFrac) ||
|
||||
(has_tc && has_tc_scale) ||
|
||||
(m_VtxDesc.low.Normal != VertexComponentFormat::NotPresent);
|
||||
|
||||
AlignCode16();
|
||||
@ -444,30 +445,30 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
|
||||
// Position
|
||||
{
|
||||
int elem_size = GetElementSize(m_VtxAttr.PosFormat);
|
||||
int pos_elements = m_VtxAttr.PosElements == CoordComponentCount::XY ? 2 : 3;
|
||||
int elem_size = GetElementSize(m_VtxAttr.g0.PosFormat);
|
||||
int pos_elements = m_VtxAttr.g0.PosElements == CoordComponentCount::XY ? 2 : 3;
|
||||
int load_bytes = elem_size * pos_elements;
|
||||
int load_size = GetLoadSize(load_bytes);
|
||||
load_size <<= 3;
|
||||
|
||||
s32 offset = GetAddressImm(ARRAY_POSITION, m_VtxDesc.low.Position, EncodeRegTo64(scratch1_reg),
|
||||
load_size);
|
||||
ReadVertex(m_VtxDesc.low.Position, m_VtxAttr.PosFormat, pos_elements, pos_elements,
|
||||
m_VtxAttr.ByteDequant, m_VtxAttr.PosFrac, &m_native_vtx_decl.position, offset);
|
||||
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);
|
||||
}
|
||||
|
||||
if (m_VtxDesc.low.Normal != VertexComponentFormat::NotPresent)
|
||||
{
|
||||
static const u8 map[8] = {7, 6, 15, 14};
|
||||
const u8 scaling_exponent = map[u32(m_VtxAttr.NormalFormat)];
|
||||
const int limit = m_VtxAttr.NormalElements == NormalComponentCount::NBT ? 3 : 1;
|
||||
const u8 scaling_exponent = map[u32(m_VtxAttr.g0.NormalFormat.Value())];
|
||||
const int limit = m_VtxAttr.g0.NormalElements == NormalComponentCount::NBT ? 3 : 1;
|
||||
|
||||
s32 offset = -1;
|
||||
for (int i = 0; i < (m_VtxAttr.NormalElements == NormalComponentCount::NBT ? 3 : 1); i++)
|
||||
for (int i = 0; i < (m_VtxAttr.g0.NormalElements == NormalComponentCount::NBT ? 3 : 1); i++)
|
||||
{
|
||||
if (!i || m_VtxAttr.NormalIndex3)
|
||||
if (!i || m_VtxAttr.g0.NormalIndex3)
|
||||
{
|
||||
int elem_size = GetElementSize(m_VtxAttr.NormalFormat);
|
||||
int elem_size = GetElementSize(m_VtxAttr.g0.NormalFormat);
|
||||
|
||||
int load_bytes = elem_size * 3;
|
||||
int load_size = GetLoadSize(load_bytes);
|
||||
@ -480,7 +481,7 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
else
|
||||
offset += i * elem_size * 3;
|
||||
}
|
||||
int bytes_read = ReadVertex(m_VtxDesc.low.Normal, m_VtxAttr.NormalFormat, 3, 3, true,
|
||||
int bytes_read = ReadVertex(m_VtxDesc.low.Normal, m_VtxAttr.g0.NormalFormat, 3, 3, true,
|
||||
scaling_exponent, &m_native_vtx_decl.normals[i], offset);
|
||||
|
||||
if (offset == -1)
|
||||
@ -490,7 +491,7 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
}
|
||||
|
||||
m_native_components |= VB_HAS_NRM0;
|
||||
if (m_VtxAttr.NormalElements == NormalComponentCount::NBT)
|
||||
if (m_VtxAttr.g0.NormalElements == NormalComponentCount::NBT)
|
||||
m_native_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
|
||||
}
|
||||
|
||||
@ -503,13 +504,13 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
if (m_VtxDesc.low.Color[i] != VertexComponentFormat::NotPresent)
|
||||
{
|
||||
u32 align = 4;
|
||||
if (m_VtxAttr.color[i].Comp == ColorFormat::RGB565 ||
|
||||
m_VtxAttr.color[i].Comp == ColorFormat::RGBA4444)
|
||||
if (m_VtxAttr.GetColorFormat(i) == ColorFormat::RGB565 ||
|
||||
m_VtxAttr.GetColorFormat(i) == ColorFormat::RGBA4444)
|
||||
align = 2;
|
||||
|
||||
s32 offset = GetAddressImm(ARRAY_COLOR0 + int(i), m_VtxDesc.low.Color[i],
|
||||
EncodeRegTo64(scratch1_reg), align);
|
||||
ReadColor(m_VtxDesc.low.Color[i], m_VtxAttr.color[i].Comp, offset);
|
||||
ReadColor(m_VtxDesc.low.Color[i], m_VtxAttr.GetColorFormat(i), offset);
|
||||
m_native_components |= VB_HAS_COL0 << i;
|
||||
m_native_vtx_decl.colors[i].components = 4;
|
||||
m_native_vtx_decl.colors[i].enable = true;
|
||||
@ -526,22 +527,22 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
m_native_vtx_decl.texcoords[i].type = VAR_FLOAT;
|
||||
m_native_vtx_decl.texcoords[i].integer = false;
|
||||
|
||||
int elements = m_VtxAttr.texCoord[i].Elements == TexComponentCount::S ? 1 : 2;
|
||||
int elements = m_VtxAttr.GetTexElements(i) == TexComponentCount::S ? 1 : 2;
|
||||
if (m_VtxDesc.high.TexCoord[i] != VertexComponentFormat::NotPresent)
|
||||
{
|
||||
m_native_components |= VB_HAS_UV0 << i;
|
||||
|
||||
int elem_size = GetElementSize(m_VtxAttr.texCoord[i].Format);
|
||||
int elem_size = GetElementSize(m_VtxAttr.GetTexFormat(i));
|
||||
int load_bytes = elem_size * (elements + 2);
|
||||
int load_size = GetLoadSize(load_bytes);
|
||||
load_size <<= 3;
|
||||
|
||||
s32 offset = GetAddressImm(ARRAY_TEXCOORD0 + int(i), m_VtxDesc.high.TexCoord[i],
|
||||
EncodeRegTo64(scratch1_reg), load_size);
|
||||
u8 scaling_exponent = m_VtxAttr.texCoord[i].Frac;
|
||||
ReadVertex(m_VtxDesc.high.TexCoord[i], m_VtxAttr.texCoord[i].Format, elements,
|
||||
m_VtxDesc.low.TexMatIdx[i] ? 2 : elements, m_VtxAttr.ByteDequant, scaling_exponent,
|
||||
&m_native_vtx_decl.texcoords[i], offset);
|
||||
u8 scaling_exponent = m_VtxAttr.GetTexFrac(i);
|
||||
ReadVertex(m_VtxDesc.high.TexCoord[i], m_VtxAttr.GetTexFormat(i), elements,
|
||||
m_VtxDesc.low.TexMatIdx[i] ? 2 : elements, m_VtxAttr.g0.ByteDequant,
|
||||
scaling_exponent, &m_native_vtx_decl.texcoords[i], offset);
|
||||
}
|
||||
if (m_VtxDesc.low.TexMatIdx[i])
|
||||
{
|
||||
|
Reference in New Issue
Block a user