VideoCommon: A minor speed up.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5772 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nodchip 2010-06-23 03:02:15 +00:00
parent 5e81298ef0
commit 5cf491af64
1 changed files with 7 additions and 1 deletions

View File

@ -72,6 +72,8 @@ int colElements[2];
float posScale; float posScale;
float tcScale[8]; float tcScale[8];
static float texCoordFrac[32];
using namespace Gen; using namespace Gen;
void LOADERDECL PosMtx_ReadDirect_UByte() void LOADERDECL PosMtx_ReadDirect_UByte()
@ -178,6 +180,10 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
VertexLoader_Position::Init(); VertexLoader_Position::Init();
VertexLoader_TextCoord::Init(); VertexLoader_TextCoord::Init();
for (int i = 0; i < 32; ++i) {
texCoordFrac[i] = 1.0f / (1 << i);
}
m_VtxDesc = vtx_desc; m_VtxDesc = vtx_desc;
SetVAT(vtx_attr.g0.Hex, vtx_attr.g1.Hex, vtx_attr.g2.Hex); SetVAT(vtx_attr.g0.Hex, vtx_attr.g1.Hex, vtx_attr.g2.Hex);
@ -574,7 +580,7 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int count)
posScale = 1.0f / float(1 << m_VtxAttr.PosFrac); posScale = 1.0f / float(1 << m_VtxAttr.PosFrac);
if (m_NativeFmt->m_components & VB_HAS_UVALL) if (m_NativeFmt->m_components & VB_HAS_UVALL)
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
tcScale[i] = 1.0f / float(1 << m_VtxAttr.texCoord[i].Frac); tcScale[i] = texCoordFrac[m_VtxAttr.texCoord[i].Frac];
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
colElements[i] = m_VtxAttr.color[i].Elements; colElements[i] = m_VtxAttr.color[i].Elements;