Prevent crash when AFT draws an AFT
by remember the previous render target.
This commit is contained in:
@@ -244,6 +244,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual unsigned CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; }
|
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
|
/* 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
|
* 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
|
* of the texture will be preserved from the previous call; otherwise, cleared. If
|
||||||
|
|||||||
@@ -2475,6 +2475,14 @@ unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m,
|
|||||||
return iTexture;
|
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 )
|
void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTexture )
|
||||||
{
|
{
|
||||||
if (iTexture == 0)
|
if (iTexture == 0)
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public:
|
|||||||
bool IsEffectModeSupported( EffectMode effect );
|
bool IsEffectModeSupported( EffectMode effect );
|
||||||
bool SupportsRenderToTexture() const;
|
bool SupportsRenderToTexture() const;
|
||||||
unsigned CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
unsigned CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut );
|
||||||
|
unsigned GetRenderTarget();
|
||||||
void SetRenderTarget( unsigned iHandle, bool bPreserveTexture );
|
void SetRenderTarget( unsigned iHandle, bool bPreserveTexture );
|
||||||
bool IsZWriteEnabled() const;
|
bool IsZWriteEnabled() const;
|
||||||
bool IsZTestEnabled() const;
|
bool IsZTestEnabled() const;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ void RageTextureRenderTarget::Destroy()
|
|||||||
|
|
||||||
void RageTextureRenderTarget::BeginRenderingTo( bool bPreserveTexture )
|
void RageTextureRenderTarget::BeginRenderingTo( bool bPreserveTexture )
|
||||||
{
|
{
|
||||||
|
m_iPreviousRenderTarget = DISPLAY->GetRenderTarget( );
|
||||||
DISPLAY->SetRenderTarget( m_iTexHandle, bPreserveTexture );
|
DISPLAY->SetRenderTarget( m_iTexHandle, bPreserveTexture );
|
||||||
|
|
||||||
/* We're rendering to a texture, not the framebuffer.
|
/* We're rendering to a texture, not the framebuffer.
|
||||||
@@ -69,7 +70,7 @@ void RageTextureRenderTarget::FinishRenderingTo()
|
|||||||
DISPLAY->CameraPopMatrix();
|
DISPLAY->CameraPopMatrix();
|
||||||
DISPLAY->PopMatrix();
|
DISPLAY->PopMatrix();
|
||||||
|
|
||||||
DISPLAY->SetRenderTarget( 0 );
|
DISPLAY->SetRenderTarget( m_iPreviousRenderTarget );
|
||||||
}
|
}
|
||||||
|
|
||||||
// lua start
|
// lua start
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ private:
|
|||||||
void Create();
|
void Create();
|
||||||
void Destroy();
|
void Destroy();
|
||||||
unsigned m_iTexHandle;
|
unsigned m_iTexHandle;
|
||||||
|
unsigned m_iPreviousRenderTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user