diff options
author | Alexey Ushakov <Alexey.Ushakov@jetbrains.com> | 2018-04-18 15:55:03 +0300 |
---|---|---|
committer | Alexey Ushakov <Alexey.Ushakov@jetbrains.com> | 2018-04-18 15:55:55 +0300 |
commit | 1ab7aa45b60acba48a5072a0d86969c4edba17be (patch) | |
tree | 6e07182acf988c021a29908d78dca512dab8664e | |
parent | 0b3f4fd78fff2a8dd7f1fed6d56179a208205ce7 (diff) | |
download | jdk8u_jdk-1ab7aa45b60acba48a5072a0d86969c4edba17be.tar.gz |
JRE-722 LCD text rendering performance on OSX 25X slower than grayscalejb8u152-b1235
Handled overlapped interleaved glyphs
-rw-r--r-- | src/share/native/sun/java2d/opengl/OGLTextRenderer.c | 5 | ||||
-rw-r--r-- | src/share/native/sun/java2d/opengl/OGLVertexCache.c | 20 | ||||
-rw-r--r-- | src/share/native/sun/java2d/opengl/OGLVertexCache.h | 3 |
3 files changed, 19 insertions, 9 deletions
diff --git a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c index 84590162e7..75681fe49b 100644 --- a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c +++ b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c @@ -808,9 +808,8 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps, GlyphInfo *ginfo, J2dTracePrimitive("OGLMTVertexCache_enable_failed"); return JNI_FALSE; } - OGLMTVertexCache_addGlyphQuad(oglc, dx1, dy1, dx2, dy2, - cell->tx1, cell->ty1, cell->tx2, cell->ty2, - dtx1, dty1, dtx2, dty2); + OGLMTVertexCache_addGlyphQuad(dx1, dy1, dx2, dy2, cell->tx1, cell->ty1, + cell->tx2, cell->ty2, dtx1, dty1, dtx2, dty2); return JNI_TRUE; } diff --git a/src/share/native/sun/java2d/opengl/OGLVertexCache.c b/src/share/native/sun/java2d/opengl/OGLVertexCache.c index 265a7ee817..53c9a8a652 100644 --- a/src/share/native/sun/java2d/opengl/OGLVertexCache.c +++ b/src/share/native/sun/java2d/opengl/OGLVertexCache.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include <string.h> +#include <float.h> #include "sun_java2d_SunGraphics2D.h" @@ -56,6 +57,8 @@ static jboolean mtUseTxtBarrier = JNI_FALSE; static jint evenLCDGlyphInd = 0; static jint oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET; static jint lcdGlyphInd = 0; +static jfloat evenOx2 = FLT_MIN; +static jfloat oddOx2 = FLT_MIN; static GLuint maskCacheTexID = 0; static jint maskCacheIndex = 0; @@ -365,6 +368,7 @@ void OGLMTVertexCache_flush(jint mask) { // and caches have been invalidated before subsequent Draws are // executed j2d_glTextureBarrierNV(); + evenOx2 = FLT_MIN; } j2d_glDrawArrays(GL_QUADS, 0, evenLCDGlyphInd); evenLCDGlyphInd = 0; @@ -374,6 +378,7 @@ void OGLMTVertexCache_flush(jint mask) { if (mtUseTxtBarrier) { // See the comment above j2d_glTextureBarrierNV(); + oddOx2 = FLT_MIN; } j2d_glDrawArrays(GL_QUADS, ODD_LCD_GLYPHS_OFFSET, oddLCDGlyphInd - ODD_LCD_GLYPHS_OFFSET); @@ -382,8 +387,7 @@ void OGLMTVertexCache_flush(jint mask) { } } -void OGLMTVertexCache_addGlyphQuad(OGLContext *oglc, - jfloat dx1, jfloat dy1, +void OGLMTVertexCache_addGlyphQuad(jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2, jfloat tx1, jfloat ty1, jfloat tx2, jfloat ty2, @@ -392,13 +396,21 @@ void OGLMTVertexCache_addGlyphQuad(OGLContext *oglc, { jint* ind; if (lcdGlyphInd & 0x1) { - if (oddLCDGlyphInd >= OGLMTVC_MAX_INDEX) { + if (oddLCDGlyphInd >= OGLMTVC_MAX_INDEX || + (mtUseTxtBarrier && oddOx2 >= dx1)) + { OGLMTVertexCache_flush(OGLMTVC_FLUSH_ODD); + } else if (mtUseTxtBarrier) { + oddOx2 = dx2; } ind = &oddLCDGlyphInd; } else { - if (evenLCDGlyphInd >= ODD_LCD_GLYPHS_OFFSET) { + if (evenLCDGlyphInd >= ODD_LCD_GLYPHS_OFFSET || + (mtUseTxtBarrier && evenOx2 >= dx1)) + { OGLMTVertexCache_flush(OGLMTVC_FLUSH_EVEN); + } else if (mtUseTxtBarrier) { + evenOx2 = dx2; } ind = &evenLCDGlyphInd; } diff --git a/src/share/native/sun/java2d/opengl/OGLVertexCache.h b/src/share/native/sun/java2d/opengl/OGLVertexCache.h index d610275c7c..5572daa743 100644 --- a/src/share/native/sun/java2d/opengl/OGLVertexCache.h +++ b/src/share/native/sun/java2d/opengl/OGLVertexCache.h @@ -89,8 +89,7 @@ void OGLVertexCache_AddGlyphQuad(OGLContext *oglc, jfloat dx2, jfloat dy2); jboolean OGLMTVertexCache_enable(OGLContext *oglc, jboolean useTxtBarrier); -void OGLMTVertexCache_addGlyphQuad(OGLContext *oglc, - jfloat dx1, jfloat dy1, +void OGLMTVertexCache_addGlyphQuad(jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2, jfloat tx1, jfloat ty1, jfloat tx2, jfloat ty2, |