D3D supports setting multiple shader constants at once, so let's add support for that. Very tiny speedup. Also remove the annoying black window in the background when configuring D3D before starting a game. Also make sure to write all values when converting normals - might help the cpu's write gather cache.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4255 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-09-12 15:00:08 +00:00
parent e31cc7d1fe
commit 52ea8a0fd1
7 changed files with 118 additions and 89 deletions

View File

@ -62,7 +62,7 @@ void SetVSConstant4f(int const_number, float f1, float f2, float f3, float f4)
void SetVSConstant4fv(int const_number, const float *f)
{
if( lastVSconstants[const_number][0] != f[0] ||
if (lastVSconstants[const_number][0] != f[0] ||
lastVSconstants[const_number][1] != f[1] ||
lastVSconstants[const_number][2] != f[2] ||
lastVSconstants[const_number][3] != f[3])
@ -75,6 +75,24 @@ void SetVSConstant4fv(int const_number, const float *f)
}
}
void SetMultiVSConstant4fv(int const_number, int count, const float *f)
{
for (int i = 0; i < count; i++)
{
if (lastVSconstants[const_number + i][0] != f[0 + i*4] ||
lastVSconstants[const_number + i][1] != f[1 + i*4] ||
lastVSconstants[const_number + i][2] != f[2 + i*4] ||
lastVSconstants[const_number + i][3] != f[3 + i*4])
{
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, const_number + i, f + i * 4);
lastVSconstants[const_number + i][0] = f[0 + i*4];
lastVSconstants[const_number + i][1] = f[1 + i*4];
lastVSconstants[const_number + i][2] = f[2 + i*4];
lastVSconstants[const_number + i][3] = f[3 + i*4];
}
}
}
void VertexShaderCache::Init()
{
for( int i=0;i<(C_FOGPARAMS+8)*4;i++)