mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VertexLoaders: make positions more compact
This commit is contained in:
@ -131,12 +131,13 @@ void VertexLoader::CompileVertexTranslator()
|
||||
WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements));
|
||||
|
||||
m_VertexSize += VertexLoader_Position::GetSize(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements);
|
||||
m_native_vtx_decl.position.components = 3;
|
||||
int pos_elements = m_VtxAttr.PosElements + 2;
|
||||
m_native_vtx_decl.position.components = pos_elements;
|
||||
m_native_vtx_decl.position.enable = true;
|
||||
m_native_vtx_decl.position.offset = nat_offset;
|
||||
m_native_vtx_decl.position.type = VAR_FLOAT;
|
||||
m_native_vtx_decl.position.integer = false;
|
||||
nat_offset += 12;
|
||||
nat_offset += pos_elements * sizeof(float);
|
||||
|
||||
// Normals
|
||||
if (m_VtxDesc.Normal != NOT_PRESENT)
|
||||
|
@ -370,8 +370,9 @@ void VertexLoaderARM64::GenerateVertexLoader()
|
||||
load_size <<= 3;
|
||||
|
||||
s32 offset = GetAddressImm(ARRAY_POSITION, m_VtxDesc.Position, EncodeRegTo64(scratch1_reg), load_size);
|
||||
ReadVertex(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements + 2, 3,
|
||||
m_VtxAttr.ByteDequant, m_VtxAttr.PosFrac, &m_native_vtx_decl.position, offset);
|
||||
int pos_elements = m_VtxAttr.PosElements + 2;
|
||||
ReadVertex(m_VtxDesc.Position, m_VtxAttr.PosFormat, pos_elements, pos_elements,
|
||||
m_VtxAttr.ByteDequant, m_VtxAttr.PosFrac, &m_native_vtx_decl.position, offset);
|
||||
}
|
||||
|
||||
if (m_VtxDesc.Normal)
|
||||
|
@ -332,7 +332,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,
|
||||
int pos_elements = 2 + m_VtxAttr.PosElements;
|
||||
ReadVertex(data, m_VtxDesc.Position, m_VtxAttr.PosFormat, pos_elements, pos_elements,
|
||||
m_VtxAttr.ByteDequant, m_VtxAttr.PosFrac, &m_native_vtx_decl.position);
|
||||
|
||||
if (m_VtxDesc.Normal)
|
||||
@ -408,7 +409,7 @@ void VertexLoaderX64::GenerateVertexLoader()
|
||||
m_native_vtx_decl.texcoords[i].offset = m_dst_ofs;
|
||||
PXOR(XMM0, R(XMM0));
|
||||
CVTSI2SS(XMM0, R(scratch1));
|
||||
SHUFPS(XMM0, R(XMM0), 0x45);
|
||||
SHUFPS(XMM0, R(XMM0), 0x45); // 000X -> 0X00
|
||||
MOVUPS(MDisp(dst_reg, m_dst_ofs), XMM0);
|
||||
m_dst_ofs += sizeof(float) * 3;
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ void LOADERDECL Pos_ReadDirect(VertexLoader* loader)
|
||||
DataReader dst(g_vertex_manager_write_ptr, nullptr);
|
||||
DataReader src(g_video_buffer_read_ptr, nullptr);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
dst.Write(i < N ? PosScale(src.Read<T>(), scale) : 0.f);
|
||||
for (int i = 0; i < N; ++i)
|
||||
dst.Write(PosScale(src.Read<T>(), scale));
|
||||
|
||||
g_vertex_manager_write_ptr = dst.GetPointer();
|
||||
g_video_buffer_read_ptr = src.GetPointer();
|
||||
@ -50,8 +50,8 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader)
|
||||
auto const scale = loader->m_posScale;
|
||||
DataReader dst(g_vertex_manager_write_ptr, nullptr);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
dst.Write(i < N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
|
||||
for (int i = 0; i < N; ++i)
|
||||
dst.Write(PosScale(Common::FromBigEndian(data[i]), scale));
|
||||
|
||||
g_vertex_manager_write_ptr = dst.GetPointer();
|
||||
LOG_VTX();
|
||||
|
Reference in New Issue
Block a user