Prevent crash when AFT draws an AFT

by remember the previous render target.
This commit is contained in:
sigatrev
2015-03-17 21:41:31 -05:00
parent cc5c05a4f1
commit 45a0952a3b
5 changed files with 14 additions and 1 deletions
+2
View File
@@ -244,6 +244,8 @@ public:
*/
virtual unsigned CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; }
virtual unsigned GetRenderTarget() { return 0; }
/* Set the render target, or 0 to resume rendering to the framebuffer. An active render
* target may not be used as a texture. If bPreserveTexture is true, the contents
* of the texture will be preserved from the previous call; otherwise, cleared. If
+8
View File
@@ -2475,6 +2475,14 @@ unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam &param,
return iTexture;
}
unsigned RageDisplay_Legacy::GetRenderTarget( )
{
for( map<unsigned, RenderTarget*>::const_iterator it = g_mapRenderTargets.begin( ); it != g_mapRenderTargets.end( ); ++it )
if( it->second == g_pCurrentRenderTarget )
return it->first;
return 0;
}
void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTexture )
{
if (iTexture == 0)
+1
View File
@@ -71,6 +71,7 @@ public:
bool IsEffectModeSupported( EffectMode effect );
bool SupportsRenderToTexture() const;
unsigned CreateRenderTarget( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut );
unsigned GetRenderTarget();
void SetRenderTarget( unsigned iHandle, bool bPreserveTexture );
bool IsZWriteEnabled() const;
bool IsZTestEnabled() const;
+2 -1
View File
@@ -47,6 +47,7 @@ void RageTextureRenderTarget::Destroy()
void RageTextureRenderTarget::BeginRenderingTo( bool bPreserveTexture )
{
m_iPreviousRenderTarget = DISPLAY->GetRenderTarget( );
DISPLAY->SetRenderTarget( m_iTexHandle, bPreserveTexture );
/* We're rendering to a texture, not the framebuffer.
@@ -69,7 +70,7 @@ void RageTextureRenderTarget::FinishRenderingTo()
DISPLAY->CameraPopMatrix();
DISPLAY->PopMatrix();
DISPLAY->SetRenderTarget( 0 );
DISPLAY->SetRenderTarget( m_iPreviousRenderTarget );
}
// lua start
+1
View File
@@ -27,6 +27,7 @@ private:
void Create();
void Destroy();
unsigned m_iTexHandle;
unsigned m_iPreviousRenderTarget;
};
#endif