Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8242035: Combine drawPrimitive calls in text drawing flush
Co-authored-by: Ajit Ghaisas <ajit.ghaisas@oracle.com>
  • Loading branch information
jayathirthrao and aghaisas committed Apr 2, 2020
1 parent 97c7a63 commit 9cb40a9bc7246f69cf35f24813b968a7086d2fc2
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLVertexCache.m
@@ -93,10 +93,9 @@
atIndex:MeshVertexBuffer];

[encoder setFragmentTexture:maskCacheTex.texture atIndex: 0];
for (int i = 0; i < maskCacheIndex; i++) {
J2dTraceLn1(J2D_TRACE_INFO, "MTLVertexCache_FlushVertexCache : draw texture at index %d", i);
[encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:i*6 vertexCount:6];
}
J2dTraceLn1(J2D_TRACE_INFO,
"MTLVertexCache_FlushVertexCache : encode %d characters", (vertexCacheIndex / 6));
[encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:vertexCacheIndex];
}
vertexCacheIndex = 0;
maskCacheIndex = 0;
@@ -118,10 +117,9 @@
atIndex:MeshVertexBuffer];
id<MTLTexture> glyphCacheTex = MTLTR_GetGlyphCacheTexture();
[encoder setFragmentTexture:glyphCacheTex atIndex: 0];
for (int i = 0; i < vertexCacheIndex; i = i + 6) {
J2dTraceLn1(J2D_TRACE_INFO, "MTLVertexCache_FlushGlyphVertexCache : draw texture at index %d", (int)(i + 1)/6);
[encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:i vertexCount:6];
}
J2dTraceLn1(J2D_TRACE_INFO,
"MTLVertexCache_FlushGlyphVertexCache : encode %d characters", (vertexCacheIndex / 6));
[encoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:vertexCacheIndex];
}
vertexCacheIndex = 0;
}

0 comments on commit 9cb40a9

Please sign in to comment.