Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/xwidghet/stepmania
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 17, 2016
2 parents 294b1cb + a09c62c commit 6656336
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/BitmapText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
if ( haveTextures && end < m_vpFontPageTextures.size() && m_vpFontPageTextures[start]->m_pTextureMain != m_vpFontPageTextures[end]->m_pTextureMain )
renderNow = true;

if ( (haveTextures && (renderNow || end >= iEndGlyph)) || texUnit == 8 || texUnit > DISPLAY->GetNumTextureUnits() || !PREFSMAN->m_bAllowMultitexture )
// Render if we can't store any more textures without running into software or hardware limitations
if ( haveTextures && (((renderNow || end >= iEndGlyph) || texUnit == 8) || (texUnit == DISPLAY->GetNumTextureUnits() || !PREFSMAN->m_bAllowMultitexture )) )
{
DISPLAY->DrawQuads(&m_aVertices[startingPoint * 4], (end - startingPoint) * 4);

Expand Down
11 changes: 11 additions & 0 deletions src/RageDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ void RageDisplay::SetDefaultRenderStates()
LoadMenuPerspective( 0, 640, 480, 320, 240 ); // 0 FOV = ortho
}

bool RageDisplay::IsD3DInternal()
{
return false;
}



// Matrix stuff
class MatrixStack
Expand Down Expand Up @@ -1043,6 +1049,11 @@ void RageDisplay::SetPresentTime(std::chrono::nanoseconds presentTime)
g_LastFramePresentTime = presentTime;
}

bool RageDisplay::IsD3D()
{
return DISPLAY->IsD3DInternal();
}

RageCompiledGeometry::~RageCompiledGeometry()
{
m_bNeedsNormals = false;
Expand Down
3 changes: 3 additions & 0 deletions src/RageDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class RageDisplay

// Call this when the resolution has been changed externally:
virtual void ResolutionChanged();
bool IsD3D();

virtual bool BeginFrame();
virtual void EndFrame();
Expand Down Expand Up @@ -337,6 +338,8 @@ class RageDisplay
virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
virtual void DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
virtual void DrawCircleInternal( const RageSpriteVertex &v, float radius );

virtual bool IsD3DInternal();

// return RString() if mode change was successful, an error message otherwise.
// bNewDeviceOut is set true if a new device was created and textures
Expand Down
20 changes: 13 additions & 7 deletions src/RageDisplay_D3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,20 +1169,20 @@ void RageDisplay_D3D::SetBlendMode( BlendMode mode )
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ZERO );
g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
// Alpha: iSourceAlpha = GL_ZERO; iDestAlpha = GL_SRC_ALPHA;
/*
g_pd3dDevice->SetRenderState( D3DRS_SRCALPHA, D3DBLEND_ZERO );
g_pd3dDevice->SetRenderState( D3DRS_DESTALPHA, D3DBLEND_SRCALPHA );
*/

g_pd3dDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ZERO );
g_pd3dDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_SRCALPHA );

break;
case BLEND_ALPHA_KNOCK_OUT:
// RGB: iSourceRGB = GL_ZERO; iDestRGB = GL_ONE;
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ZERO );
g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
// Alpha: iSourceAlpha = GL_ZERO; iDestAlpha = GL_ONE_MINUS_SRC_ALPHA;
/*

g_pd3dDevice->SetRenderState( D3DRS_SRCBLENDALPHA, D3DBLEND_ZERO );
g_pd3dDevice->SetRenderState( D3DRS_DESTBLENDALPHA, D3DBLEND_INVSRCALPHA );
*/

break;
case BLEND_ALPHA_MULTIPLY:
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
Expand Down Expand Up @@ -1654,6 +1654,7 @@ void RageDisplay_D3D::SetRenderTarget(unsigned uTexHandle, bool bPreserveTexture

// Need to blend the render targets together, not sure why OpenGL doesn't need this -xwidghet
g_pd3dDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, true);


/* If bPreserveTexture is false, clear the render target. Only clear the depth
* buffer if the target has one; otherwise we're clearing the real depth buffer. */
Expand All @@ -1668,7 +1669,7 @@ void RageDisplay_D3D::SetRenderTarget(unsigned uTexHandle, bool bPreserveTexture
}*/

if (FAILED(g_pd3dDevice->Clear(0, NULL, iBit,
D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0x00000000)))
D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0x00000000)))
LOG->Warn("Failed to clear render target");
}
}
Expand All @@ -1683,6 +1684,11 @@ void RageDisplay_D3D::SetCelShaded( int stage )
// todo: implement me!
}

bool RageDisplay_D3D::IsD3DInternal()
{
return true;
}

/*
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
Expand Down
2 changes: 2 additions & 0 deletions src/RageDisplay_D3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class RageDisplay_D3D: public RageDisplay
void SetSphereEnvironmentMapping( TextureUnit tu, bool b );
void SetCelShaded( int stage );

bool IsD3DInternal();

RageCompiledGeometry* CreateCompiledGeometry();
void DeleteCompiledGeometry( RageCompiledGeometry* p );

Expand Down
5 changes: 5 additions & 0 deletions src/RageDisplay_Null.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ void RageDisplay_Null::EndFrame()
{
ProcessStatsOnFlip();
}

bool RageDisplay_Null::IsD3DInternal()
{
return false;
}


class RageCompiledGeometryNull : public RageCompiledGeometry
Expand Down
2 changes: 2 additions & 0 deletions src/RageDisplay_Null.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class RageDisplay_Null: public RageDisplay
void SetSphereEnvironmentMapping( TextureUnit /* tu */, bool /* b */ ) { }
void SetCelShaded( int /* stage */ ) { }

bool IsD3DInternal();

RageCompiledGeometry* CreateCompiledGeometry();
void DeleteCompiledGeometry( RageCompiledGeometry* );

Expand Down
5 changes: 5 additions & 0 deletions src/RageDisplay_OGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2746,6 +2746,11 @@ void RageDisplay_Legacy::SetCelShaded( int stage )
}
}

bool RageDisplay_Legacy::IsD3DInternal()
{
return false;
}

/*
* Copyright (c) 2001-2011 Chris Danford, Glenn Maynard, Colby Klein
* All rights reserved.
Expand Down
2 changes: 2 additions & 0 deletions src/RageDisplay_OGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class RageDisplay_Legacy: public RageDisplay
void SetSphereEnvironmentMapping( TextureUnit tu, bool b );
void SetCelShaded( int stage );

bool IsD3DInternal();

RageCompiledGeometry* CreateCompiledGeometry();
void DeleteCompiledGeometry( RageCompiledGeometry* p );

Expand Down

0 comments on commit 6656336

Please sign in to comment.