Minor D3D changes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2625 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-03-08 23:19:02 +00:00
parent d60c1b139a
commit 05d06090fd
6 changed files with 11 additions and 7 deletions

View File

@ -286,7 +286,7 @@ void VertexShaderManager::SetConstants(bool proj_hax_1)
} }
PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]); PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]);
SetVSConstant4fv(C_PROJECTION, &g_fProjectionMatrix[0]); SetVSConstant4fv(C_PROJECTION, &g_fProjectionMatrix[0]);
SetVSConstant4fv(C_PROJECTION+1, &g_fProjectionMatrix[4]); SetVSConstant4fv(C_PROJECTION+1, &g_fProjectionMatrix[4]);
SetVSConstant4fv(C_PROJECTION+2, &g_fProjectionMatrix[8]); SetVSConstant4fv(C_PROJECTION+2, &g_fProjectionMatrix[8]);
SetVSConstant4fv(C_PROJECTION+3, &g_fProjectionMatrix[12]); SetVSConstant4fv(C_PROJECTION+3, &g_fProjectionMatrix[12]);

View File

@ -95,7 +95,7 @@ void PixelShaderCache::SetShader()
newentry.frameCount = frameCount; newentry.frameCount = frameCount;
PixelShaders[uid] = newentry; PixelShaders[uid] = newentry;
D3D::dev->SetFVF(NULL); Renderer::SetFVF(NULL);
D3D::dev->SetPixelShader(shader); D3D::dev->SetPixelShader(shader);
INCSTAT(stats.numPixelShadersCreated); INCSTAT(stats.numPixelShadersCreated);
@ -134,7 +134,7 @@ void PixelShaderCache::Cleanup()
while (iter != PixelShaders.end()) while (iter != PixelShaders.end())
{ {
PSCacheEntry &entry = iter->second; PSCacheEntry &entry = iter->second;
if (entry.frameCount < frameCount-30) if (entry.frameCount < frameCount-400)
{ {
entry.Destroy(); entry.Destroy();
iter = PixelShaders.erase(iter); iter = PixelShaders.erase(iter);

View File

@ -232,6 +232,7 @@ void Renderer::SwapBuffers()
p+=sprintf(p,"CP loads (DL): %i\n",stats.thisFrame.numCPLoadsInDL); p+=sprintf(p,"CP loads (DL): %i\n",stats.thisFrame.numCPLoadsInDL);
p+=sprintf(p,"BP loads: %i\n",stats.thisFrame.numBPLoads); p+=sprintf(p,"BP loads: %i\n",stats.thisFrame.numBPLoads);
p+=sprintf(p,"BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL); p+=sprintf(p,"BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL);
p+=sprintf(p,"Vertex Loaders: %i\n",stats.numVertexLoaders);
D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false); D3D::font.DrawTextScaled(0,30,20,20,0.0f,0xFF00FFFF,st,false);

View File

@ -182,6 +182,10 @@ void Flush()
DVSTARTPROFILE(); DVSTARTPROFILE();
if (collection != C_NOTHING) if (collection != C_NOTHING)
{ {
// setup the pointers
if(g_nativeVertexFmt)
g_nativeVertexFmt->SetupVertexPointers();
u32 usedtextures = 0; u32 usedtextures = 0;
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) { for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
if (bpmem.tevorders[i/2].getEnable(i & 1)) if (bpmem.tevorders[i/2].getEnable(i & 1))
@ -232,8 +236,8 @@ void Flush()
int numVertices = indexGen.GetNumVerts(); int numVertices = indexGen.GetNumVerts();
if (numVertices) if (numVertices)
{ {
PixelShaderCache::SetShader(); // TODO(ector): only do this if shader has changed PixelShaderCache::SetShader();
VertexShaderCache::SetShader(g_nativeVertexFmt->m_components); // TODO(ector): only do this if shader has changed VertexShaderCache::SetShader(g_nativeVertexFmt->m_components);
// set global constants // set global constants
VertexShaderManager::SetConstants(false); VertexShaderManager::SetConstants(false);

View File

@ -105,7 +105,7 @@ void VertexShaderCache::SetShader(u32 components)
{ {
PanicAlert("Failed to compile Vertex Shader:\n\n%s", code); PanicAlert("Failed to compile Vertex Shader:\n\n%s", code);
} }
D3D::dev->SetFVF(NULL); Renderer::SetFVF(NULL);
D3D::dev->SetVertexShader(shader); D3D::dev->SetVertexShader(shader);
} }

View File

@ -52,7 +52,6 @@ void SetVSConstant4fv(int const_number, const float *f)
glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, const_number, f); glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, const_number, f);
} }
void VertexShaderCache::Init() void VertexShaderCache::Init()
{ {
s_displayCompileAlert = true; s_displayCompileAlert = true;