Do SetDefaultRenderStates in BeginFrame, instead of on init,

so we don't depend on state being preserved long-term, and
so every renderer doesn't have to do this.
This commit is contained in:
Glenn Maynard
2006-07-25 20:10:56 +00:00
parent 90d4dc17d5
commit 9c73aed254
4 changed files with 19 additions and 10 deletions
+12
View File
@@ -121,11 +121,23 @@ RString RageDisplay::GetStats() const
return s;
}
bool RageDisplay::BeginFrame()
{
this->SetDefaultRenderStates();
return true;
}
void RageDisplay::EndFrame()
{
ProcessStatsOnFlip();
}
void RageDisplay::BeginConcurrentRendering()
{
this->SetDefaultRenderStates();
}
void RageDisplay::StatsAddVerts( int iNumVertsRendered ) { g_iVertsRenderedSinceLastCheck += iNumVertsRendered; }
/* Draw a line as a quad. GL_LINES with SmoothLines off can draw line
+2 -2
View File
@@ -152,7 +152,7 @@ public:
/* Call this when the resolution has been changed externally: */
virtual void ResolutionChanged();
virtual bool BeginFrame() = 0;
virtual bool BeginFrame();
virtual void EndFrame();
virtual VideoModeParams GetActualVideoModeParams() const = 0;
bool IsWindowed() const { return this->GetActualVideoModeParams().windowed; }
@@ -167,7 +167,7 @@ public:
// thread before and after rendering.
virtual void BeginConcurrentRenderingMainThread() { }
virtual void EndConcurrentRenderingMainThread() { }
virtual void BeginConcurrentRendering() { }
virtual void BeginConcurrentRendering();
virtual void EndConcurrentRendering() { }
/* return 0 if failed or internal texture resource handle
+2 -4
View File
@@ -621,8 +621,6 @@ RString RageDisplay_D3D::TryVideoMode( const VideoModeParams &_p, bool &bNewDevi
ResolutionChanged();
this->SetDefaultRenderStates();
return RString(); // mode change successful
}
@@ -661,7 +659,6 @@ bool RageDisplay_D3D::BeginFrame()
if( sError != "" )
RageException::Throw( sError );
this->SetDefaultRenderStates();
break;
}
}
@@ -670,7 +667,8 @@ bool RageDisplay_D3D::BeginFrame()
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
g_pd3dDevice->BeginScene();
return true;
return RageDisplay::BeginFrame();
}
static RageTimer g_LastFrameEndedAt( RageZeroTimer );
+3 -4
View File
@@ -598,8 +598,6 @@ RString RageDisplay_OGL::TryVideoMode( const VideoModeParams &p, bool &bNewDevic
InitScalingScript();
}
this->SetDefaultRenderStates();
/* Set vsync the Windows way, if we can. (What other extensions are there
* to do this, for other archs?) */
if( GLExt.wglSwapIntervalEXT )
@@ -629,7 +627,8 @@ bool RageDisplay_OGL::BeginFrame()
glClearColor( 0,0,0,1 );
SetZWrite( true );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
return true;
return RageDisplay::BeginFrame();
}
void RageDisplay_OGL::EndFrame()
@@ -1584,7 +1583,7 @@ void RageDisplay_OGL::EndConcurrentRenderingMainThread()
void RageDisplay_OGL::BeginConcurrentRendering()
{
g_pWind->BeginConcurrentRendering();
SetDefaultRenderStates();
RageDisplay::BeginConcurrentRendering();
}
void RageDisplay_OGL::EndConcurrentRendering()