aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Denis Konoplev <dkonoplev@openjdk.org> 2021-04-15 13:50:22 +0000
committerGravatar Jayathirth D V <jdv@openjdk.org> 2021-04-15 13:50:22 +0000
commit0fee6ecac21b232b203c9b2a2cd2a9a6c125d163 (patch)
treeb003f245dcd219d3b2c531856f751c133d41e42b
parent81877f7df20c29e6716a86a1dac3eb0868d768bf (diff)
downloadjdk-0fee6ecac21b232b203c9b2a2cd2a9a6c125d163.tar.gz
jdk-0fee6ecac21b232b203c9b2a2cd2a9a6c125d163.zip
8264318: Lanai: DrawHugeImageTest.java fails on apple M1
Reviewed-by: serb, jdv
-rw-r--r--src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m
index 58aef56095d..22fbd2aa5d7 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLBlitLoops.m
@@ -156,10 +156,11 @@ static void
replaceTextureRegion(MTLContext *mtlc, id<MTLTexture> dest, const SurfaceDataRasInfo *srcInfo,
const MTLRasterFormatInfo *rfi,
int dx1, int dy1, int dx2, int dy2) {
- const int sw = srcInfo->bounds.x2 - srcInfo->bounds.x1;
- const int sh = srcInfo->bounds.y2 - srcInfo->bounds.y1;
- const int dw = dx2 - dx1;
- const int dh = dy2 - dy1;
+ const int sw = MIN(srcInfo->bounds.x2 - srcInfo->bounds.x1, MTL_GPU_FAMILY_MAC_TXT_SIZE);
+ const int sh = MIN(srcInfo->bounds.y2 - srcInfo->bounds.y1, MTL_GPU_FAMILY_MAC_TXT_SIZE);
+ const int dw = MIN(dx2 - dx1, MTL_GPU_FAMILY_MAC_TXT_SIZE);
+ const int dh = MIN(dy2 - dy1, MTL_GPU_FAMILY_MAC_TXT_SIZE);
+
if (dw < sw || dh < sh) {
J2dTraceLn4(J2D_TRACE_ERROR, "replaceTextureRegion: dest size: (%d, %d) less than source size: (%d, %d)", dw, dh, sw, sh);
return;