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:
@@ -121,11 +121,23 @@ RString RageDisplay::GetStats() const
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RageDisplay::BeginFrame()
|
||||||
|
{
|
||||||
|
this->SetDefaultRenderStates();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void RageDisplay::EndFrame()
|
void RageDisplay::EndFrame()
|
||||||
{
|
{
|
||||||
ProcessStatsOnFlip();
|
ProcessStatsOnFlip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RageDisplay::BeginConcurrentRendering()
|
||||||
|
{
|
||||||
|
this->SetDefaultRenderStates();
|
||||||
|
}
|
||||||
|
|
||||||
void RageDisplay::StatsAddVerts( int iNumVertsRendered ) { g_iVertsRenderedSinceLastCheck += iNumVertsRendered; }
|
void RageDisplay::StatsAddVerts( int iNumVertsRendered ) { g_iVertsRenderedSinceLastCheck += iNumVertsRendered; }
|
||||||
|
|
||||||
/* Draw a line as a quad. GL_LINES with SmoothLines off can draw line
|
/* Draw a line as a quad. GL_LINES with SmoothLines off can draw line
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
/* Call this when the resolution has been changed externally: */
|
/* Call this when the resolution has been changed externally: */
|
||||||
virtual void ResolutionChanged();
|
virtual void ResolutionChanged();
|
||||||
|
|
||||||
virtual bool BeginFrame() = 0;
|
virtual bool BeginFrame();
|
||||||
virtual void EndFrame();
|
virtual void EndFrame();
|
||||||
virtual VideoModeParams GetActualVideoModeParams() const = 0;
|
virtual VideoModeParams GetActualVideoModeParams() const = 0;
|
||||||
bool IsWindowed() const { return this->GetActualVideoModeParams().windowed; }
|
bool IsWindowed() const { return this->GetActualVideoModeParams().windowed; }
|
||||||
@@ -167,7 +167,7 @@ public:
|
|||||||
// thread before and after rendering.
|
// thread before and after rendering.
|
||||||
virtual void BeginConcurrentRenderingMainThread() { }
|
virtual void BeginConcurrentRenderingMainThread() { }
|
||||||
virtual void EndConcurrentRenderingMainThread() { }
|
virtual void EndConcurrentRenderingMainThread() { }
|
||||||
virtual void BeginConcurrentRendering() { }
|
virtual void BeginConcurrentRendering();
|
||||||
virtual void EndConcurrentRendering() { }
|
virtual void EndConcurrentRendering() { }
|
||||||
|
|
||||||
/* return 0 if failed or internal texture resource handle
|
/* return 0 if failed or internal texture resource handle
|
||||||
|
|||||||
@@ -621,8 +621,6 @@ RString RageDisplay_D3D::TryVideoMode( const VideoModeParams &_p, bool &bNewDevi
|
|||||||
|
|
||||||
ResolutionChanged();
|
ResolutionChanged();
|
||||||
|
|
||||||
this->SetDefaultRenderStates();
|
|
||||||
|
|
||||||
return RString(); // mode change successful
|
return RString(); // mode change successful
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,7 +659,6 @@ bool RageDisplay_D3D::BeginFrame()
|
|||||||
if( sError != "" )
|
if( sError != "" )
|
||||||
RageException::Throw( sError );
|
RageException::Throw( sError );
|
||||||
|
|
||||||
this->SetDefaultRenderStates();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,7 +667,8 @@ bool RageDisplay_D3D::BeginFrame()
|
|||||||
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||||
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||||
g_pd3dDevice->BeginScene();
|
g_pd3dDevice->BeginScene();
|
||||||
return true;
|
|
||||||
|
return RageDisplay::BeginFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
static RageTimer g_LastFrameEndedAt( RageZeroTimer );
|
static RageTimer g_LastFrameEndedAt( RageZeroTimer );
|
||||||
|
|||||||
@@ -598,8 +598,6 @@ RString RageDisplay_OGL::TryVideoMode( const VideoModeParams &p, bool &bNewDevic
|
|||||||
InitScalingScript();
|
InitScalingScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetDefaultRenderStates();
|
|
||||||
|
|
||||||
/* Set vsync the Windows way, if we can. (What other extensions are there
|
/* Set vsync the Windows way, if we can. (What other extensions are there
|
||||||
* to do this, for other archs?) */
|
* to do this, for other archs?) */
|
||||||
if( GLExt.wglSwapIntervalEXT )
|
if( GLExt.wglSwapIntervalEXT )
|
||||||
@@ -629,7 +627,8 @@ bool RageDisplay_OGL::BeginFrame()
|
|||||||
glClearColor( 0,0,0,1 );
|
glClearColor( 0,0,0,1 );
|
||||||
SetZWrite( true );
|
SetZWrite( true );
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||||
return true;
|
|
||||||
|
return RageDisplay::BeginFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::EndFrame()
|
void RageDisplay_OGL::EndFrame()
|
||||||
@@ -1584,7 +1583,7 @@ void RageDisplay_OGL::EndConcurrentRenderingMainThread()
|
|||||||
void RageDisplay_OGL::BeginConcurrentRendering()
|
void RageDisplay_OGL::BeginConcurrentRendering()
|
||||||
{
|
{
|
||||||
g_pWind->BeginConcurrentRendering();
|
g_pWind->BeginConcurrentRendering();
|
||||||
SetDefaultRenderStates();
|
RageDisplay::BeginConcurrentRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::EndConcurrentRendering()
|
void RageDisplay_OGL::EndConcurrentRendering()
|
||||||
|
|||||||
Reference in New Issue
Block a user