--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/common.h Mon Jul 08 16:04:25 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/common.h Mon Jul 08 17:17:28 2019 +0530
@@ -29,6 +29,7 @@
#include <simd/SIMD.h>
#define PGRAM_VERTEX_COUNT 6
+#define QUAD_VERTEX_COUNT 4
enum VertexAttributes {
VertexAttributePosition = 0,
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m Mon Jul 08 16:04:25 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m Mon Jul 08 17:17:28 2019 +0530
@@ -342,7 +342,7 @@
J2dTraceImpl(J2D_TRACE_VERBOSE, JNI_TRUE, "MTLBlitLoops_IsoBlit [via blitEncoder]: bdst=%p [tex=%p] %dx%d | src (%d, %d, %d, %d) -> dst (%1.2f, %1.2f, %1.2f, %1.2f)", dstOps, dstTex, dstTex.width, dstTex.height, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
#endif //DEBUG
id <MTLBlitCommandEncoder> blitEncoder = [mtlc createBlitEncoder];
- [blitEncoder copyFromTexture:srcTex sourceSlice:0 sourceLevel:0 sourceOrigin:MTLOriginMake(sx1, sy1, 0) sourceSize:MTLSizeMake(sx2 - sx1, sy2 - sy1, 1) toTexture:dstTex destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(dx1, dy1, 0)];
+ [blitEncoder copyFromTexture:srcTex sourceSlice:0 sourceLevel:0 sourceOrigin:MTLOriginMake(sx1, sy1, 0) sourceSize:MTLSizeMake(mtlc.clipRect.width, mtlc.clipRect.height, 1) toTexture:dstTex destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(dx1, dy1, 0)];
[blitEncoder endEncoding];
} else {
// TODO: support other flags
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m Mon Jul 08 16:04:25 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m Mon Jul 08 17:17:28 2019 +0530
@@ -461,7 +461,8 @@
case sun_java2d_pipe_BufferedOpCodes_END_SHAPE_CLIP:
{
//TODO
- [mtlc endShapeClipDstOps:dstOps];
+ //[mtlc endShapeClipDstOps:dstOps];
+ [mtlc endShapeClip];
}
break;
case sun_java2d_pipe_BufferedOpCodes_RESET_CLIP:
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m Mon Jul 08 16:04:25 2019 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderer.m Mon Jul 08 17:17:28 2019 +0530
@@ -220,13 +220,11 @@
return;
}
- struct Vertex verts[PGRAM_VERTEX_COUNT] = {
- { {x, y, 0.0}},
- { {x, y+h, 0.0}},
- { {x+w, y+h, 0.0}},
- { {x+w, y+h, 0.0}},
- { {x+w, y, 0.0}},
- { {x, y, 0.0},
+ struct Vertex verts[QUAD_VERTEX_COUNT] = {
+ { {x, y, 0.0}},
+ { {x, y+h, 0.0}},
+ { {x+w, y, 0.0}},
+ { {x+w, y+h, 0.0}
}};
@@ -239,7 +237,7 @@
return;
[mtlEncoder setVertexBytes:verts length:sizeof(verts) atIndex:MeshVertexBuffer];
- [mtlEncoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount: PGRAM_VERTEX_COUNT];
+ [mtlEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount: QUAD_VERTEX_COUNT];
[mtlEncoder endEncoding];
}
@@ -281,17 +279,15 @@
jfloat x2 = spanStruct.spns[i * 4 + 2];
jfloat y2 = spanStruct.spns[i * 4 + 3];
- struct Vertex verts[PGRAM_VERTEX_COUNT] = {
+ struct Vertex verts[QUAD_VERTEX_COUNT] = {
{{x1, y1, 0.0}},
- {{x2, y1, 0.0}},
{{x1, y2, 0.0}},
{{x2, y1, 0.0}},
- {{x2, y2, 0.0}},
- {{x1, y2, 0.0},
+ {{x2, y2, 0.0}
}};
[mtlEncoder setVertexBytes:verts length:sizeof(verts) atIndex:MeshVertexBuffer];
- [mtlEncoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:PGRAM_VERTEX_COUNT];
+ [mtlEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:QUAD_VERTEX_COUNT];
}
[mtlEncoder endEncoding];
@@ -321,14 +317,12 @@
dx21, dy21,
dx12, dy12, dest);
- struct Vertex verts[PGRAM_VERTEX_COUNT] = {
+ struct Vertex verts[QUAD_VERTEX_COUNT] = {
{ {fx11, fy11, 0.0}},
{ {fx11+dx21, fy11+dy21, 0.0}},
{ {fx11+dx12, fy11+dy12, 0.0}},
- { {fx11+dx21, fy11+dy21, 0.0}},
- { {fx11 + dx21 + dx12, fy11+ dy21 + dy12, 0.0}},
- { {fx11+dx12, fy11+dy12, 0.0},
- }};
+ { {fx11 + dx21 + dx12, fy11+ dy21 + dy12, 0.0}
+ }};
// Encode render command.
id<MTLRenderCommandEncoder> mtlEncoder = [mtlc createRenderEncoderForDest:dest];
@@ -336,7 +330,7 @@
return;
[mtlEncoder setVertexBytes:verts length:sizeof(verts) atIndex:MeshVertexBuffer];
- [mtlEncoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount: PGRAM_VERTEX_COUNT];
+ [mtlEncoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount: QUAD_VERTEX_COUNT];
[mtlEncoder endEncoding];
}