mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
OpenGL: commit rodolfoosvaldobogado's (what a name!) speedup patches.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4322 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -32,6 +32,7 @@ void IndexGenerator::Start(unsigned short *startptr)
|
||||
index = 0;
|
||||
numPrims = 0;
|
||||
adds = 0;
|
||||
indexLen = 0;
|
||||
onlyLists = true;
|
||||
}
|
||||
|
||||
@ -45,6 +46,7 @@ void IndexGenerator::AddList(int numVerts)
|
||||
*ptr++ = index+i*3+1;
|
||||
*ptr++ = index+i*3+2;
|
||||
}
|
||||
indexLen += numVerts;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
@ -62,6 +64,7 @@ void IndexGenerator::AddStrip(int numVerts)
|
||||
*ptr++ = index+i+(wind?1:2);
|
||||
wind = !wind;
|
||||
}
|
||||
indexLen += numTris * 3;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
@ -77,6 +80,7 @@ void IndexGenerator::AddLineList(int numVerts)
|
||||
*ptr++ = index+i*2;
|
||||
*ptr++ = index+i*2+1;
|
||||
}
|
||||
indexLen += numVerts;
|
||||
index += numVerts;
|
||||
numPrims += numLines;
|
||||
adds++;
|
||||
@ -91,6 +95,7 @@ void IndexGenerator::AddLineStrip(int numVerts)
|
||||
*ptr++ = index+i;
|
||||
*ptr++ = index+i+1;
|
||||
}
|
||||
indexLen += numLines * 2;
|
||||
index += numVerts;
|
||||
numPrims += numLines;
|
||||
adds++;
|
||||
@ -107,6 +112,7 @@ void IndexGenerator::AddFan(int numVerts)
|
||||
*ptr++ = index+i+1;
|
||||
*ptr++ = index+i+2;
|
||||
}
|
||||
indexLen += numTris * 3;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
@ -126,6 +132,7 @@ void IndexGenerator::AddQuads(int numVerts)
|
||||
*ptr++ = index+i*4+2;
|
||||
*ptr++ = index+i*4+3;
|
||||
}
|
||||
indexLen += numTris * 3;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
|
@ -35,12 +35,14 @@ public:
|
||||
int GetNumPrims() {return numPrims;} //returns numprimitives
|
||||
int GetNumVerts() {return index;} //returns numprimitives
|
||||
int GetNumAdds() {return adds;}
|
||||
int GetindexLen() {return indexLen;}
|
||||
bool GetOnlyLists() {return onlyLists;}
|
||||
private:
|
||||
unsigned short *ptr;
|
||||
int numPrims;
|
||||
int index;
|
||||
int adds;
|
||||
int indexLen;
|
||||
bool onlyLists;
|
||||
};
|
||||
|
||||
|
@ -602,7 +602,8 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int count)
|
||||
// Flush if our vertex format is different from the currently set.
|
||||
if (g_nativeVertexFmt != NULL && g_nativeVertexFmt != m_NativeFmt)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
//Don't flush here we can join some primitives, let the vertex manager do this work
|
||||
//VertexManager::Flush();
|
||||
// Also move the Set() here?
|
||||
}
|
||||
g_nativeVertexFmt = m_NativeFmt;
|
||||
|
@ -122,11 +122,12 @@ void VertexShaderManager::SetConstants()
|
||||
for (int i = istart; i < iend; ++i)
|
||||
{
|
||||
u32 color = *(const u32*)(xfmemptr + 3);
|
||||
float NormalizationCoef = 1 / 255.0f;
|
||||
SetVSConstant4f(C_LIGHTS + 5 * i,
|
||||
((color >> 24) & 0xFF) / 255.0f,
|
||||
((color >> 16) & 0xFF) / 255.0f,
|
||||
((color >> 8) & 0xFF) / 255.0f,
|
||||
((color) & 0xFF) / 255.0f);
|
||||
((color >> 24) & 0xFF) * NormalizationCoef,
|
||||
((color >> 16) & 0xFF) * NormalizationCoef,
|
||||
((color >> 8) & 0xFF) * NormalizationCoef,
|
||||
((color) & 0xFF) * NormalizationCoef);
|
||||
xfmemptr += 4;
|
||||
|
||||
for (int j = 0; j < 4; ++j, xfmemptr += 3)
|
||||
@ -466,11 +467,11 @@ void VertexShaderManager::SetMaterialColor(int index, u32 data)
|
||||
int ind = index * 4;
|
||||
|
||||
nMaterialsChanged |= (1 << index);
|
||||
|
||||
s_fMaterials[ind++] = ((data >> 24) & 0xFF) / 255.0f;
|
||||
s_fMaterials[ind++] = ((data >> 16) & 0xFF) / 255.0f;
|
||||
s_fMaterials[ind++] = ((data >> 8) & 0xFF) / 255.0f;
|
||||
s_fMaterials[ind] = ( data & 0xFF) / 255.0f;
|
||||
float NormalizationCoef = 1 / 255.0f;
|
||||
s_fMaterials[ind++] = ((data >> 24) & 0xFF) * NormalizationCoef;
|
||||
s_fMaterials[ind++] = ((data >> 16) & 0xFF) * NormalizationCoef;
|
||||
s_fMaterials[ind++] = ((data >> 8) & 0xFF) * NormalizationCoef;
|
||||
s_fMaterials[ind] = ( data & 0xFF) * NormalizationCoef;
|
||||
}
|
||||
|
||||
void VertexShaderManager::TranslateView(float x, float y)
|
||||
|
Reference in New Issue
Block a user