Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251242: Tile based rendering results in artifacts in last column whi…
…le using metal pipeline
  • Loading branch information
aghaisas committed Aug 19, 2020
1 parent ecf4165 commit 3fe25357190d5935e50f74d24c9e259858a47af1
Showing with 16 additions and 10 deletions.
  1. +16 −10 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m
@@ -696,6 +696,7 @@ jboolean clipDestCoords(

SurfaceData_IntersectBoundsXYXY(&srcInfo.bounds,
0, 0, srcOps->width, srcOps->height);

SurfaceData_IntersectBlitBounds(&dstInfo.bounds, &srcInfo.bounds,
srcx - dstx, srcy - dsty);

@@ -721,15 +722,6 @@ jboolean clipDestCoords(
srcy = srcOps->yOffset + srcy;
const int srcLength = width * height * 4; // NOTE: assume that src format is MTLPixelFormatBGRA8Unorm

#ifdef DEBUG
void *pDstEnd = dstInfo.rasBase + (height - 1)*dstInfo.scanStride + width*dstInfo.pixelStride;
if (pDst + srcLength > pDstEnd) {
J2dTraceLn6(J2D_TRACE_ERROR, "MTLBlitLoops_SurfaceToSwBlit: length mismatch: dstx=%d, dsty=%d, w=%d, h=%d, pixStride=%d, scanStride=%d",
dstx, dsty, width, height, dstInfo.pixelStride, dstInfo.scanStride);
return;
}
#endif //DEBUG

// Create MTLBuffer (or use static)
MTLRasterFormatInfo rfi = RasterFormatInfos[dsttype];
const jboolean directCopy = rfi.permuteMap == NULL;
@@ -789,7 +781,21 @@ jboolean clipDestCoords(

// Perform conversion if necessary
if (directCopy) {
memcpy(pDst, mtlbuf.contents, srcLength);
if ((dstInfo.scanStride == width * dstInfo.pixelStride) &&
(height == (dstInfo.bounds.y2 - dstInfo.bounds.y1))) {
// mtlbuf.contents have same dimensions as of pDst
memcpy(pDst, mtlbuf.contents, srcLength);
} else {
// mtlbuf.contents have smaller dimensions than pDst
// copy each row from mtlbuf.contents at appropriate position in pDst
// Note : pDst is already addjusted for offsets using PtrAddBytes above

int rowSize = width * dstInfo.pixelStride;
for (int y = 0; y < height; y++) {
memcpy(pDst, mtlbuf.contents + (y * rowSize), rowSize);
pDst = PtrAddBytes(pDst, dstInfo.scanStride);
}
}
} else {
J2dTraceLn6(J2D_TRACE_VERBOSE,"MTLBlitLoops_SurfaceToSwBlit: dsttype=%d, raster conversion will be performed, dest rfi: %d, %d, %d, %d, hasA=%d",
dsttype, rfi.permuteMap[0], rfi.permuteMap[1], rfi.permuteMap[2], rfi.permuteMap[3], rfi.hasAlpha);

0 comments on commit 3fe2535

Please sign in to comment.