Disable usage of check_previous_op for text rendering metal-prototype-branch
authorjdv
Thu, 08 Aug 2019 14:15:54 +0530
branchmetal-prototype-branch
changeset 57682 6b0febcd7b43
parent 57505 c47331043c12
child 57719 328d81bbff39
Disable usage of check_previous_op for text rendering
src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m
src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m	Wed Jul 24 11:08:24 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTextRenderer.m	Thu Aug 08 14:15:54 2019 +0530
@@ -339,8 +339,8 @@
 
     J2dTraceLn(J2D_TRACE_INFO, "MTLTR_DrawGrayscaleGlyphNoCache");
     if (glyphMode != MODE_NO_CACHE_GRAY) {
-        MTLTR_DisableGlyphModeState();
-        CHECK_PREVIOUS_OP(MTL_STATE_MASK_OP);
+        //MTLTR_DisableGlyphModeState();
+        //CHECK_PREVIOUS_OP(MTL_STATE_MASK_OP);
         glyphMode = MODE_NO_CACHE_GRAY;
     }
 
@@ -411,6 +411,7 @@
     glyphMode = MODE_NOT_INITED;
     isCachedDestValid = JNI_FALSE;
     J2dTraceLn1(J2D_TRACE_INFO, "totalGlyphs = %d", totalGlyphs);
+    MTLVertexCache_EnableMaskCache(mtlc, dstOps);
 
     for (glyphCounter = 0; glyphCounter < totalGlyphs; glyphCounter++) {
         J2dTraceLn(J2D_TRACE_INFO, "Entered for loop for glyph list");
@@ -504,7 +505,7 @@
             break;
         }
     }
-
+    MTLVertexCache_FlushVertexCache(mtlc);
     MTLTR_DisableGlyphModeState();
 }
 
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m	Wed Jul 24 11:08:24 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m	Thu Aug 08 14:15:54 2019 +0530
@@ -102,6 +102,8 @@
         vertexBuffer = nil;
     }
     vertexCacheIndex = 0;
+    maskCacheIndex = 0;
+    maskCacheTex = nil;
 }
 
 /**
@@ -180,6 +182,9 @@
 void
 MTLVertexCache_DisableMaskCache(MTLContext *mtlc)
 {
+    // TODO : Once we enable check_previous_op
+    // we will start using DisableMaskCache until then
+    // we are force flusging vertexcache.
     J2dTraceLn(J2D_TRACE_INFO, "MTLVertexCache_DisableMaskCache");
     MTLVertexCache_FlushVertexCache(mtlc);
     MTLVertexCache_RestoreColorState(mtlc);