mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 23:31:40 +00:00
VideoLoader: remove VAT_*_FRACBITS
They are used to remove the flush amounts, but as we don't flush anymore on vertex loader changes (only on native vertex format right now), this optimization is now unneeded. This will allow us to hard code the frac factors within the vertex loaders.
This commit is contained in:
parent
9b2909357b
commit
ec28a80e00
6 changed files with 40 additions and 50 deletions
|
@ -93,10 +93,10 @@ TEST_F(VertexLoaderTest, PositionDirectFloatXYZ)
|
|||
m_vtx_attr.g0.PosElements = 1; // XYZ
|
||||
m_vtx_attr.g0.PosFormat = 4; // Float
|
||||
|
||||
VertexLoader loader(m_vtx_desc, m_vtx_attr);
|
||||
VertexLoader* loader = new VertexLoader(m_vtx_desc, m_vtx_attr);
|
||||
|
||||
ASSERT_EQ(3 * sizeof (float), (u32)loader.GetNativeVertexDeclaration().stride);
|
||||
ASSERT_EQ(3 * sizeof (float), (u32)loader.GetVertexSize());
|
||||
ASSERT_EQ(3 * sizeof (float), (u32)loader->GetNativeVertexDeclaration().stride);
|
||||
ASSERT_EQ(3 * sizeof (float), (u32)loader->GetVertexSize());
|
||||
|
||||
// Write some vertices.
|
||||
Input(0.0f); Input(0.0f); Input(0.0f);
|
||||
|
@ -105,9 +105,10 @@ TEST_F(VertexLoaderTest, PositionDirectFloatXYZ)
|
|||
Input(0.0f); Input(0.0f); Input(1.0f);
|
||||
|
||||
// Convert 4 points. "7" -> primitive are points.
|
||||
int count = loader.RunVertices(m_vtx_attr, 7, 4, src, dst);
|
||||
src.Skip(4 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
int count = loader->RunVertices(7, 4, src, dst);
|
||||
src.Skip(4 * loader->GetVertexSize());
|
||||
dst.Skip(count * loader->GetNativeVertexDeclaration().stride);
|
||||
delete loader;
|
||||
|
||||
ExpectOut(0.0f); ExpectOut(0.0f); ExpectOut(0.0f);
|
||||
ExpectOut(1.0f); ExpectOut(0.0f); ExpectOut(0.0f);
|
||||
|
@ -117,10 +118,12 @@ TEST_F(VertexLoaderTest, PositionDirectFloatXYZ)
|
|||
// Test that scale does nothing for floating point inputs.
|
||||
Input(1.0f); Input(2.0f); Input(4.0f);
|
||||
m_vtx_attr.g0.PosFrac = 1;
|
||||
count = loader.RunVertices(m_vtx_attr, 7, 1, src, dst);
|
||||
src.Skip(1 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
loader = new VertexLoader(m_vtx_desc, m_vtx_attr);
|
||||
count = loader->RunVertices(7, 1, src, dst);
|
||||
src.Skip(1 * loader->GetVertexSize());
|
||||
dst.Skip(count * loader->GetNativeVertexDeclaration().stride);
|
||||
ExpectOut(1.0f); ExpectOut(2.0f); ExpectOut(4.0f);
|
||||
delete loader;
|
||||
}
|
||||
|
||||
TEST_F(VertexLoaderTest, PositionDirectU16XY)
|
||||
|
@ -129,10 +132,10 @@ TEST_F(VertexLoaderTest, PositionDirectU16XY)
|
|||
m_vtx_attr.g0.PosElements = 0; // XY
|
||||
m_vtx_attr.g0.PosFormat = 2; // U16
|
||||
|
||||
VertexLoader loader(m_vtx_desc, m_vtx_attr);
|
||||
VertexLoader* loader = new VertexLoader(m_vtx_desc, m_vtx_attr);
|
||||
|
||||
ASSERT_EQ(3 * sizeof (float), (u32)loader.GetNativeVertexDeclaration().stride);
|
||||
ASSERT_EQ(2 * sizeof (u16), (u32)loader.GetVertexSize());
|
||||
ASSERT_EQ(3 * sizeof (float), (u32)loader->GetNativeVertexDeclaration().stride);
|
||||
ASSERT_EQ(2 * sizeof (u16), (u32)loader->GetVertexSize());
|
||||
|
||||
// Write some vertices.
|
||||
Input<u16>(0); Input<u16>(0);
|
||||
|
@ -142,9 +145,10 @@ TEST_F(VertexLoaderTest, PositionDirectU16XY)
|
|||
Input<u16>(12345); Input<u16>(54321);
|
||||
|
||||
// Convert 5 points. "7" -> primitive are points.
|
||||
int count = loader.RunVertices(m_vtx_attr, 7, 5, src, dst);
|
||||
src.Skip(5 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
int count = loader->RunVertices(7, 5, src, dst);
|
||||
src.Skip(5 * loader->GetVertexSize());
|
||||
dst.Skip(count * loader->GetNativeVertexDeclaration().stride);
|
||||
delete loader;
|
||||
|
||||
ExpectOut(0.0f); ExpectOut(0.0f); ExpectOut(0.0f);
|
||||
ExpectOut(1.0f); ExpectOut(2.0f); ExpectOut(0.0f);
|
||||
|
@ -155,10 +159,12 @@ TEST_F(VertexLoaderTest, PositionDirectU16XY)
|
|||
// Test that scale works on U16 inputs.
|
||||
Input<u16>(42); Input<u16>(24);
|
||||
m_vtx_attr.g0.PosFrac = 1;
|
||||
count = loader.RunVertices(m_vtx_attr, 7, 1, src, dst);
|
||||
src.Skip(1 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
loader = new VertexLoader(m_vtx_desc, m_vtx_attr);
|
||||
count = loader->RunVertices(7, 1, src, dst);
|
||||
src.Skip(1 * loader->GetVertexSize());
|
||||
dst.Skip(count * loader->GetNativeVertexDeclaration().stride);
|
||||
ExpectOut(21.0f); ExpectOut(12.0f); ExpectOut(0.0f);
|
||||
delete loader;
|
||||
}
|
||||
|
||||
TEST_F(VertexLoaderTest, PositionDirectFloatXYZSpeed)
|
||||
|
@ -175,7 +181,7 @@ TEST_F(VertexLoaderTest, PositionDirectFloatXYZSpeed)
|
|||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
ResetPointers();
|
||||
int count = loader.RunVertices(m_vtx_attr, 7, 100000, src, dst);
|
||||
int count = loader.RunVertices(7, 100000, src, dst);
|
||||
src.Skip(100000 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
}
|
||||
|
@ -195,7 +201,7 @@ TEST_F(VertexLoaderTest, PositionDirectU16XYSpeed)
|
|||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
ResetPointers();
|
||||
int count = loader.RunVertices(m_vtx_attr, 7, 100000, src, dst);
|
||||
int count = loader.RunVertices(7, 100000, src, dst);
|
||||
src.Skip(100000 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
}
|
||||
|
@ -258,7 +264,7 @@ TEST_F(VertexLoaderTest, LargeFloatVertexSpeed)
|
|||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
ResetPointers();
|
||||
int count = loader.RunVertices(m_vtx_attr, 7, 100000, src, dst);
|
||||
int count = loader.RunVertices(7, 100000, src, dst);
|
||||
src.Skip(100000 * loader.GetVertexSize());
|
||||
dst.Skip(count * loader.GetNativeVertexDeclaration().stride);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue