Improve DrawQuads batching in the font render. (#1654)
Currently only identical glyphs are merged into one DrawQuads call. This fixes the comparison so that all glyphs with the same texture can be merged, which greatly improves the font rendering performance.
This commit is contained in:
+1
-1
@@ -422,7 +422,7 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
|
||||
for( int start = iStartGlyph; start < iEndGlyph; )
|
||||
{
|
||||
int end = start;
|
||||
while( end < iEndGlyph && m_vpFontPageTextures[end] == m_vpFontPageTextures[start] )
|
||||
while( end < iEndGlyph && *m_vpFontPageTextures[end] == *m_vpFontPageTextures[start] )
|
||||
end++;
|
||||
|
||||
bool bHaveATexture = !bUseStrokeTexture || (bUseStrokeTexture && m_vpFontPageTextures[start]->m_pTextureStroke);
|
||||
|
||||
@@ -24,6 +24,15 @@ struct FontPageTextures
|
||||
|
||||
/** @brief Set up the initial textures. */
|
||||
FontPageTextures(): m_pTextureMain(NULL), m_pTextureStroke(NULL) {}
|
||||
|
||||
bool operator == (const struct FontPageTextures& other) const {
|
||||
return m_pTextureMain == other.m_pTextureMain &&
|
||||
m_pTextureStroke == other.m_pTextureStroke;
|
||||
}
|
||||
|
||||
bool operator != (const struct FontPageTextures& other) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief The components of a glyph (not technically a character). */
|
||||
|
||||
Reference in New Issue
Block a user