Skip to content
This repository has been archived by the owner. It is now read-only.

8251242: Tile based rendering results in artifacts in last column while using metal pipeline #76

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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);