From c4f7cccaaf09e058ae142f46da6a02a95ac819b4 Mon Sep 17 00:00:00 2001 From: xwidghet Date: Tue, 13 Jun 2017 00:53:40 -0700 Subject: [PATCH] Optimizations to when rendering api calls are done. Results in 60%+ boost in performance in high actor/mesh count scenarios, and ~20% in real world scenarios when not GPU limited. --- src/ActorMultiTexture.cpp | 4 +- src/ActorMultiVertex.cpp | 4 +- src/BitmapText.cpp | 2 - src/GraphDisplay.cpp | 3 - src/GrooveRadar.cpp | 1 - src/Model.cpp | 6 -- src/NoteDisplay.cpp | 2 - src/RageDisplay_D3D.cpp | 173 ++++++++++++++++++++++++-------------- src/RageDisplay_OGL.cpp | 53 ++++++------ src/Sprite.cpp | 5 +- 10 files changed, 142 insertions(+), 111 deletions(-) diff --git a/src/ActorMultiTexture.cpp b/src/ActorMultiTexture.cpp index 3431ea1c80..7924255404 100644 --- a/src/ActorMultiTexture.cpp +++ b/src/ActorMultiTexture.cpp @@ -97,7 +97,6 @@ void ActorMultiTexture::DrawPrimitives() quadVerticies.top = -m_size.y/2.0f; quadVerticies.bottom = +m_size.y/2.0f; - DISPLAY->ClearAllTextures(); for( size_t i = 0; i < m_aTextureUnits.size(); ++i ) { TextureUnit tu = enum_add2(TextureUnit_1, i); @@ -130,7 +129,8 @@ void ActorMultiTexture::DrawPrimitives() for( size_t i = 0; i < m_aTextureUnits.size(); ++i ) DISPLAY->SetTexture( enum_add2(TextureUnit_1, i), 0 ); - DISPLAY->SetEffectMode( EffectMode_Normal ); + if ( m_EffectMode != EffectMode_Normal ) + DISPLAY->SetEffectMode(EffectMode_Normal); } bool ActorMultiTexture::EarlyAbortDraw() const diff --git a/src/ActorMultiVertex.cpp b/src/ActorMultiVertex.cpp index 36aa802916..f200bb43ff 100644 --- a/src/ActorMultiVertex.cpp +++ b/src/ActorMultiVertex.cpp @@ -218,7 +218,6 @@ void ActorMultiVertex::DrawPrimitives() { Actor::SetGlobalRenderStates(); // set Actor-specified render states - DISPLAY->ClearAllTextures(); DISPLAY->SetTexture( TextureUnit_1, _Texture->GetTexHandle() ); Actor::SetTextureRenderStates(); @@ -330,7 +329,8 @@ void ActorMultiVertex::DrawInternal( const AMV_TweenState *TS ) break; } - DISPLAY->SetEffectMode( EffectMode_Normal ); + if ( _EffectMode != EffectMode_Normal ) + DISPLAY->SetEffectMode(EffectMode_Normal); } bool ActorMultiVertex::EarlyAbortDraw() const diff --git a/src/BitmapText.cpp b/src/BitmapText.cpp index 0ef9c8b0b8..4ec16f6d0b 100644 --- a/src/BitmapText.cpp +++ b/src/BitmapText.cpp @@ -424,7 +424,6 @@ void BitmapText::DrawChars( bool bUseStrokeTexture ) bool haveTextures = false; int startingPoint = iStartGlyph; - DISPLAY->ClearAllTextures(); for ( int start = iStartGlyph; start < iEndGlyph; ) { int end = start; @@ -465,7 +464,6 @@ void BitmapText::DrawChars( bool bUseStrokeTexture ) DISPLAY->DrawQuads(&m_aVertices[startingPoint * 4], (end - startingPoint) * 4); // Setup for the next render pass - DISPLAY->ClearAllTextures(); startingPoint = end; haveTextures = false; } diff --git a/src/GraphDisplay.cpp b/src/GraphDisplay.cpp index c435a21278..1e7b69d75b 100644 --- a/src/GraphDisplay.cpp +++ b/src/GraphDisplay.cpp @@ -26,8 +26,6 @@ class GraphLine: public Actor { Actor::SetGlobalRenderStates(); // set Actor-specified render states - DISPLAY->ClearAllTextures(); - // Must call this after setting the texture or else texture // parameters have no effect. Actor::SetTextureRenderStates(); @@ -133,7 +131,6 @@ class GraphBody: public Actor { Actor::SetGlobalRenderStates(); // set Actor-specified render states - DISPLAY->ClearAllTextures(); DISPLAY->SetTexture( TextureUnit_1, m_pTexture->GetTexHandle() ); // Must call this after setting the texture or else texture diff --git a/src/GrooveRadar.cpp b/src/GrooveRadar.cpp index d0c53d50d3..cd76081ff3 100644 --- a/src/GrooveRadar.cpp +++ b/src/GrooveRadar.cpp @@ -146,7 +146,6 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() // draw radar filling const float fRadius = GetUnzoomedWidth()/2.0f*1.1f; - DISPLAY->ClearAllTextures(); DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Modulate ); RageSpriteVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives diff --git a/src/Model.cpp b/src/Model.cpp index a1283c2b2c..145aeb61a9 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -418,7 +418,6 @@ void Model::DrawPrimitives() static const RageColor specular( 0.2f,0.2f,0.2f,1 ); static const float shininess = 1; DISPLAY->SetMaterial( emissive, ambient, diffuse, specular, shininess ); - DISPLAY->ClearAllTextures(); DISPLAY->SetSphereEnvironmentMapping( TextureUnit_1, false ); DrawMesh( i ); } @@ -445,7 +444,6 @@ void Model::DrawPrimitives() float shininess = 1; DISPLAY->SetMaterial( emissive, ambient, diffuse, specular, shininess ); - DISPLAY->ClearAllTextures(); if( pMesh->nMaterialIndex != -1 ) { @@ -453,10 +451,6 @@ void Model::DrawPrimitives() DISPLAY->SetTexture( TextureUnit_1, mat.diffuse.GetCurrentTexture() ? mat.diffuse.GetCurrentTexture()->GetTexHandle() : 0 ); Actor::SetTextureRenderStates(); // set Actor-specified render states } - else - { - // hey why is this otherwise empty else block here? -aj - } DrawMesh( i ); } diff --git a/src/NoteDisplay.cpp b/src/NoteDisplay.cpp index f8aa47c729..b2e924fddc 100644 --- a/src/NoteDisplay.cpp +++ b/src/NoteDisplay.cpp @@ -789,8 +789,6 @@ void NoteDisplay::DrawHoldPart(vector &vpSpr, } } - DISPLAY->ClearAllTextures(); - const float fTexCoordLeft = rect.left; const float fTexCoordRight = rect.right; const float fTexCoordCenter = (fTexCoordLeft+fTexCoordRight)/2; diff --git a/src/RageDisplay_D3D.cpp b/src/RageDisplay_D3D.cpp index 1a60cc5619..505ad6341b 100644 --- a/src/RageDisplay_D3D.cpp +++ b/src/RageDisplay_D3D.cpp @@ -45,6 +45,7 @@ D3DCAPS9 g_DeviceCaps; D3DDISPLAYMODE g_DesktopMode; D3DPRESENT_PARAMETERS g_d3dpp; int g_ModelMatrixCnt=0; +DWORD lastFVF = 0; static bool g_bSphereMapping[NUM_TextureUnit] = { false, false }; // Need default color and depth buffer to restore them after using render targets @@ -715,70 +716,79 @@ const VideoModeParams* RageDisplay_D3D::GetActualVideoModeParams() const void RageDisplay_D3D::SendCurrentMatrices() { - RageMatrix m; - RageMatrixMultiply( &m, GetCentering(), GetProjectionTop() ); + static RageMatrix Centering; + static RageMatrix Projection; - if (g_bInvertY) - { - RageMatrix flip; - RageMatrixScale(&flip, +1, -1, +1); - RageMatrixMultiply(&m, &flip, &m); - } - - // Convert to OpenGL-style "pixel-centered" coords - RageMatrix m2 = GetCenteringMatrix( -0.5f, -0.5f, 0, 0 ); - RageMatrix projection; - RageMatrixMultiply( &projection, &m2, &m ); - g_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)&projection ); - - g_pd3dDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)GetViewTop() ); - g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)GetWorldTop() ); - - FOREACH_ENUM( TextureUnit, tu ) + if ( Centering != *GetCentering() || Projection != *GetProjectionTop() ) { - // Optimization opportunity: Turn off texture transform if not using texture coords. - g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 ); + Centering = *GetCentering(); + Projection = *GetProjectionTop(); - // If no texture is set for this texture unit, don't bother setting it up. - IDirect3DBaseTexture9* pTexture = NULL; - g_pd3dDevice->GetTexture( tu, &pTexture ); - if( pTexture == NULL ) - continue; - pTexture->Release(); + RageMatrix m; + RageMatrixMultiply( &m, GetCentering(), GetProjectionTop() ); - if( g_bSphereMapping[tu] ) + if ( g_bInvertY ) { - static const RageMatrix tex = RageMatrix - ( - 0.5f, 0.0f, 0.0f, 0.0f, - 0.0f, -0.5f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.5f, -0.5f, 0.0f, 1.0f - ); - g_pd3dDevice->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex ); - - // Tell D3D to use transformed reflection vectors as texture co-ordinate 0 - // and then transform this coordinate by the specified texture matrix. - g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR ); + RageMatrix flip; + RageMatrixScale( &flip, +1, -1, +1 ); + RageMatrixMultiply( &m, &flip, &m ); } - else + + // Convert to OpenGL-style "pixel-centered" coords + RageMatrix m2 = GetCenteringMatrix( -0.5f, -0.5f, 0, 0 ); + RageMatrix projection; + RageMatrixMultiply( &projection, &m2, &m ); + g_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)&projection ); + + g_pd3dDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)GetViewTop() ); + g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)GetWorldTop() ); + + FOREACH_ENUM( TextureUnit, tu ) { - /* Direct3D is expecting a 3x3 matrix loaded into the 4x4 in order - * to transform the 2-component texture coordinates. We currently - * only use translate and scale, and ignore the z component entirely, - * so convert the texture matrix from 4x4 to 3x3 by dropping z. */ - - const RageMatrix &tex1 = *GetTextureTop(); - const RageMatrix tex2 = RageMatrix - ( - tex1.m[0][0], tex1.m[0][1], tex1.m[0][3], 0, - tex1.m[1][0], tex1.m[1][1], tex1.m[1][3], 0, - tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0, - 0, 0, 0, 0 - ); - g_pd3dDevice->SetTransform( D3DTRANSFORMSTATETYPE(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex2 ); - - g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU ); + // If no texture is set for this texture unit, don't bother setting it up. + IDirect3DBaseTexture9* pTexture = NULL; + g_pd3dDevice->GetTexture( tu, &pTexture ); + if (pTexture == NULL) + continue; + pTexture->Release(); + + // Optimization opportunity: Turn off texture transform if not using texture coords. + g_pd3dDevice->SetTextureStageState(tu, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); + + if ( g_bSphereMapping[tu] ) + { + static const RageMatrix tex = RageMatrix + ( + 0.5f, 0.0f, 0.0f, 0.0f, + 0.0f, -0.5f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.5f, -0.5f, 0.0f, 1.0f + ); + g_pd3dDevice->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0 + tu), (D3DMATRIX*)&tex ); + + // Tell D3D to use transformed reflection vectors as texture co-ordinate 0 + // and then transform this coordinate by the specified texture matrix. + g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR ); + } + else + { + /* Direct3D is expecting a 3x3 matrix loaded into the 4x4 in order + * to transform the 2-component texture coordinates. We currently + * only use translate and scale, and ignore the z component entirely, + * so convert the texture matrix from 4x4 to 3x3 by dropping z. */ + + const RageMatrix &tex1 = *GetTextureTop(); + const RageMatrix tex2 = RageMatrix + ( + tex1.m[0][0], tex1.m[0][1], tex1.m[0][3], 0, + tex1.m[1][0], tex1.m[1][1], tex1.m[1][3], 0, + tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0, + 0, 0, 0, 0 + ); + g_pd3dDevice->SetTransform( D3DTRANSFORMSTATETYPE(D3DTS_TEXTURE0 + tu), (D3DMATRIX*)&tex2 ); + + g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU ); + } } } } @@ -825,7 +835,12 @@ class RageCompiledGeometrySWD3D : public RageCompiledGeometry g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, (D3DMATRIX*)&m ); } - g_pd3dDevice->SetFVF( D3DFVF_RageModelVertex ); + if ( lastFVF != D3DFVF_RageModelVertex ) + { + lastFVF = D3DFVF_RageModelVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageModelVertex ); + } + g_pd3dDevice->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, // PrimitiveType meshInfo.iVertexStart, // MinIndex @@ -875,7 +890,12 @@ void RageDisplay_D3D::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVer vIndices[i*6+5] = i*4+0; } - g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + if ( lastFVF != D3DFVF_RageSpriteVertex ) + { + lastFVF = D3DFVF_RageSpriteVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + } + SendCurrentMatrices(); g_pd3dDevice->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, // PrimitiveType @@ -911,7 +931,12 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu vIndices[i*6+5] = i*2+3; } - g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + if ( lastFVF != D3DFVF_RageSpriteVertex ) + { + lastFVF = D3DFVF_RageSpriteVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + } + SendCurrentMatrices(); g_pd3dDevice->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, // PrimitiveType @@ -953,7 +978,12 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[] vIndices[i*12+11] = i*3+5; } - g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + if ( lastFVF != D3DFVF_RageSpriteVertex ) + { + lastFVF = D3DFVF_RageSpriteVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + } + SendCurrentMatrices(); g_pd3dDevice->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, // PrimitiveType @@ -969,7 +999,12 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[] void RageDisplay_D3D::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts ) { - g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + if ( lastFVF != D3DFVF_RageSpriteVertex ) + { + lastFVF = D3DFVF_RageSpriteVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + } + SendCurrentMatrices(); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLEFAN, // PrimitiveType @@ -981,7 +1016,12 @@ void RageDisplay_D3D::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts void RageDisplay_D3D::DrawStripInternal( const RageSpriteVertex v[], int iNumVerts ) { - g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + if ( lastFVF != D3DFVF_RageSpriteVertex ) + { + lastFVF = D3DFVF_RageSpriteVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + } + SendCurrentMatrices(); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, // PrimitiveType @@ -993,7 +1033,12 @@ void RageDisplay_D3D::DrawStripInternal( const RageSpriteVertex v[], int iNumVer void RageDisplay_D3D::DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) { - g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + if ( lastFVF != D3DFVF_RageSpriteVertex ) + { + lastFVF = D3DFVF_RageSpriteVertex; + g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); + } + SendCurrentMatrices(); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST, // PrimitiveType diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index c757d8ce2e..cf41ac462d 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -933,26 +933,35 @@ static void SetupVertices( const RageSpriteVertex v[], int iNumVerts ) void RageDisplay_Legacy::SendCurrentMatrices() { - RageMatrix projection; - RageMatrixMultiply( &projection, GetCentering(), GetProjectionTop() ); + static RageMatrix Centering; + static RageMatrix Projection; - if (g_bInvertY) + if ( Centering != *GetCentering() || Projection != *GetProjectionTop() ) { - RageMatrix flip; - RageMatrixScale( &flip, +1, -1, +1 ); - RageMatrixMultiply( &projection, &flip, &projection ); - } - glMatrixMode( GL_PROJECTION ); - glLoadMatrixf( (const float*)&projection ); + Centering = *GetCentering(); + Projection = *GetProjectionTop(); + + RageMatrix projection; + RageMatrixMultiply( &projection, GetCentering(), GetProjectionTop() ); - // OpenGL has just "modelView", whereas D3D has "world" and "view" - RageMatrix modelView; - RageMatrixMultiply( &modelView, GetViewTop(), GetWorldTop() ); - glMatrixMode( GL_MODELVIEW ); - glLoadMatrixf( (const float*)&modelView ); + if ( g_bInvertY ) + { + RageMatrix flip; + RageMatrixScale( &flip, +1, -1, +1 ); + RageMatrixMultiply( &projection, &flip, &projection ); + } + glMatrixMode( GL_PROJECTION ); + glLoadMatrixf( (const float*)&projection ); - glMatrixMode( GL_TEXTURE ); - glLoadMatrixf( (const float*)GetTextureTop() ); + // OpenGL has just "modelView", whereas D3D has "world" and "view" + RageMatrix modelView; + RageMatrixMultiply( &modelView, GetViewTop(), GetWorldTop() ); + glMatrixMode( GL_MODELVIEW ); + glLoadMatrixf( (const float*)&modelView ); + + glMatrixMode( GL_TEXTURE ); + glLoadMatrixf( (const float*)GetTextureTop() ); + } } class RageCompiledGeometrySWOGL : public RageCompiledGeometry @@ -995,8 +1004,6 @@ class RageCompiledGeometrySWOGL : public RageCompiledGeometry } void Draw( int iMeshIndex ) const { - TurnOffHardwareVBO(); - const MeshInfo& meshInfo = m_vMeshInfo[iMeshIndex]; glEnableClientState(GL_VERTEX_ARRAY); @@ -1408,7 +1415,6 @@ void RageDisplay_Legacy::DeleteCompiledGeometry( RageCompiledGeometry* p ) void RageDisplay_Legacy::DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) { - TurnOffHardwareVBO(); SendCurrentMatrices(); SetupVertices( v, iNumVerts ); @@ -1417,7 +1423,6 @@ void RageDisplay_Legacy::DrawQuadsInternal( const RageSpriteVertex v[], int iNum void RageDisplay_Legacy::DrawQuadStripInternal( const RageSpriteVertex v[], int iNumVerts ) { - TurnOffHardwareVBO(); SendCurrentMatrices(); SetupVertices( v, iNumVerts ); @@ -1452,7 +1457,7 @@ void RageDisplay_Legacy::DrawSymmetricQuadStripInternal( const RageSpriteVertex vIndices[i*12+11] = i*3+5; } - TurnOffHardwareVBO(); + // SendCurrentMatrices(); SetupVertices( v, iNumVerts ); @@ -1465,7 +1470,6 @@ void RageDisplay_Legacy::DrawSymmetricQuadStripInternal( const RageSpriteVertex void RageDisplay_Legacy::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts ) { - TurnOffHardwareVBO(); SendCurrentMatrices(); SetupVertices( v, iNumVerts ); @@ -1474,7 +1478,6 @@ void RageDisplay_Legacy::DrawFanInternal( const RageSpriteVertex v[], int iNumVe void RageDisplay_Legacy::DrawStripInternal( const RageSpriteVertex v[], int iNumVerts ) { - TurnOffHardwareVBO(); SendCurrentMatrices(); SetupVertices( v, iNumVerts ); @@ -1483,7 +1486,6 @@ void RageDisplay_Legacy::DrawStripInternal( const RageSpriteVertex v[], int iNum void RageDisplay_Legacy::DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) { - TurnOffHardwareVBO(); SendCurrentMatrices(); SetupVertices( v, iNumVerts ); @@ -1492,7 +1494,6 @@ void RageDisplay_Legacy::DrawTrianglesInternal( const RageSpriteVertex v[], int void RageDisplay_Legacy::DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) { - TurnOffHardwareVBO(); SendCurrentMatrices(); p->Draw( iMeshIndex ); @@ -1500,8 +1501,6 @@ void RageDisplay_Legacy::DrawCompiledGeometryInternal( const RageCompiledGeometr void RageDisplay_Legacy::DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float fLineWidth ) { - TurnOffHardwareVBO(); - if (!(*GetActualVideoModeParams()).bSmoothLines) { /* Fall back on the generic polygon-based line strip. */ diff --git a/src/Sprite.cpp b/src/Sprite.cpp index 70daa2b9f9..7be8697fce 100644 --- a/src/Sprite.cpp +++ b/src/Sprite.cpp @@ -527,7 +527,6 @@ void Sprite::DrawTexture( const TweenState *state ) } } - DISPLAY->ClearAllTextures(); DISPLAY->SetTexture( TextureUnit_1, m_pTexture? m_pTexture->GetTexHandle():0 ); // Must call this after setting the texture or else texture @@ -612,7 +611,9 @@ void Sprite::DrawTexture( const TweenState *state ) v[0].c = v[1].c = v[2].c = v[3].c = state->glow; DISPLAY->DrawQuad( v ); } - DISPLAY->SetEffectMode( EffectMode_Normal ); + + if ( m_EffectMode != EffectMode_Normal ) + DISPLAY->SetEffectMode( EffectMode_Normal ); } bool Sprite::EarlyAbortDraw() const