VertexLoaderX64: support VAT.ByteDequant=0
This commit is contained in:
parent
46ab5d63d6
commit
1dcf49237b
|
@ -187,7 +187,7 @@ struct TVtxAttr
|
||||||
u8 NormalFormat;
|
u8 NormalFormat;
|
||||||
ColorAttr color[2];
|
ColorAttr color[2];
|
||||||
TexAttr texCoord[8];
|
TexAttr texCoord[8];
|
||||||
u8 ByteDequant;
|
bool ByteDequant;
|
||||||
u8 NormalIndex3;
|
u8 NormalIndex3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,6 @@ void VertexLoaderBase::SetVAT(const VAT& vat)
|
||||||
m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
|
m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
|
||||||
m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
|
m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
|
||||||
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
|
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
|
||||||
|
|
||||||
if (!m_VtxAttr.ByteDequant)
|
|
||||||
{
|
|
||||||
ERROR_LOG(VIDEO, "ByteDequant is set to zero");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void VertexLoaderBase::AppendToString(std::string *dest) const
|
void VertexLoaderBase::AppendToString(std::string *dest) const
|
||||||
|
|
|
@ -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] = {
|
static const __m128i shuffle_lut[5][3] = {
|
||||||
{_mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFF00L), // 1x u8
|
{_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));
|
CVTDQ2PS(coords, R(coords));
|
||||||
|
|
||||||
if (scaling_exponent)
|
if (dequantize && scaling_exponent)
|
||||||
MULPS(coords, M(&scale_factors[scaling_exponent]));
|
MULPS(coords, M(&scale_factors[scaling_exponent]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,8 @@ void VertexLoaderX64::GenerateVertexLoader()
|
||||||
}
|
}
|
||||||
|
|
||||||
OpArg data = GetVertexAddr(ARRAY_POSITION, m_VtxDesc.Position);
|
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)
|
if (m_VtxDesc.Normal)
|
||||||
{
|
{
|
||||||
|
@ -348,7 +349,8 @@ void VertexLoaderX64::GenerateVertexLoader()
|
||||||
int elem_size = 1 << (m_VtxAttr.NormalFormat / 2);
|
int elem_size = 1 << (m_VtxAttr.NormalFormat / 2);
|
||||||
data.offset += i * elem_size * 3;
|
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;
|
m_native_components |= VB_HAS_NRM0;
|
||||||
|
@ -384,7 +386,8 @@ void VertexLoaderX64::GenerateVertexLoader()
|
||||||
{
|
{
|
||||||
data = GetVertexAddr(ARRAY_TEXCOORD0 + i, tc[i]);
|
data = GetVertexAddr(ARRAY_TEXCOORD0 + i, tc[i]);
|
||||||
u8 scaling_exponent = m_VtxAttr.texCoord[i].Frac;
|
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;
|
m_native_components |= VB_HAS_UV0 << i;
|
||||||
}
|
}
|
||||||
if (tm[i])
|
if (tm[i])
|
||||||
|
|
|
@ -16,7 +16,7 @@ private:
|
||||||
u32 m_dst_ofs = 0;
|
u32 m_dst_ofs = 0;
|
||||||
Gen::FixupBranch m_skip_vertex;
|
Gen::FixupBranch m_skip_vertex;
|
||||||
Gen::OpArg GetVertexAddr(int array, u64 attribute);
|
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);
|
int ReadVertex(Gen::OpArg data, u64 attribute, int format, int count_in, int count_out, bool dequantize, u8 scaling_exponent, AttributeFormat* native_format);
|
||||||
void ReadColor(Gen::OpArg data, u64 attribute, int format);
|
void ReadColor(Gen::OpArg data, u64 attribute, int format);
|
||||||
void GenerateVertexLoader();
|
void GenerateVertexLoader();
|
||||||
};
|
};
|
||||||
|
|
|
@ -159,6 +159,7 @@ TEST_F(VertexLoaderTest, PositionDirectU16XY)
|
||||||
// Test that scale works on U16 inputs.
|
// Test that scale works on U16 inputs.
|
||||||
Input<u16>(42); Input<u16>(24);
|
Input<u16>(42); Input<u16>(24);
|
||||||
m_vtx_attr.g0.PosFrac = 1;
|
m_vtx_attr.g0.PosFrac = 1;
|
||||||
|
m_vtx_attr.g0.ByteDequant = 1;
|
||||||
loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
|
loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
|
||||||
count = loader->RunVertices(7, 1, src, dst);
|
count = loader->RunVertices(7, 1, src, dst);
|
||||||
src.Skip(1 * loader->m_VertexSize);
|
src.Skip(1 * loader->m_VertexSize);
|
||||||
|
|
Loading…
Reference in New Issue