Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

8257441 Lanai: java/awt/image/VolatileImage/DrawHugeImageTest fails #135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
@@ -229,8 +229,12 @@ void drawTex2Tex(MTLContext *mtlc,
MTLRasterFormatInfo * rfi, jboolean useBlitEncoder, jint hint,
jdouble dx1, jdouble dy1, jdouble dx2, jdouble dy2)
{
const int sw = srcInfo->bounds.x2 - srcInfo->bounds.x1;
const int sh = srcInfo->bounds.y2 - srcInfo->bounds.y1;
int sw = srcInfo->bounds.x2 - srcInfo->bounds.x1;
int sh = srcInfo->bounds.y2 - srcInfo->bounds.y1;

sw = MIN(sw, mtlc.maxTextureSize);
sh = MIN(sh, mtlc.maxTextureSize);

id<MTLTexture> dest = bmtlsdOps->pTexture;

MTLPooledTextureHandle * texHandle = [mtlc.texturePool getTexture:sw height:sh format:rfi->format];
@@ -40,7 +40,10 @@
#include "MTLClip.h"
#include "EncoderManager.h"

#define MTLC_BLIT_TILE_SIZE 128
// Constants from
// https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
#define MTL_GPU_FAMILY_APPLE_1_TXT_SIZE 8192
#define MTL_GPU_FAMILY_APPLE_3_TXT_SIZE 16384

/**
* The MTLCommandBufferWrapper class contains command buffer and
@@ -68,6 +71,7 @@
@property jboolean aaEnabled;

@property (readonly, strong) id<MTLDevice> device;
@property (readonly) jint maxTextureSize;
@property (strong) id<MTLLibrary> library;
@property (strong) id<MTLCommandQueue> commandQueue;
@property (strong) id<MTLCommandQueue> blitCommandQueue;
@@ -115,7 +115,7 @@ @implementation MTLContext {
@synthesize textureFunction,
vertexCacheEnabled, aaEnabled, device, library, pipelineStateStorage,
commandQueue, blitCommandQueue, vertexBuffer,
texturePool, paint=_paint;
texturePool, paint=_paint, maxTextureSize;

extern void initSamplers(id<MTLDevice> device);

@@ -124,6 +124,12 @@ - (id)initWithDevice:(id<MTLDevice>)d shadersLib:(NSString*)shadersLib {
if (self) {
// Initialization code here.
device = d;
if (@available(macOS 10.15, *)) {
maxTextureSize = [d supportsFamily:MTLGPUFamilyApple3] ?
MTL_GPU_FAMILY_APPLE_3_TXT_SIZE : MTL_GPU_FAMILY_APPLE_1_TXT_SIZE;
} else {
maxTextureSize = MTL_GPU_FAMILY_APPLE_1_TXT_SIZE;
}

texturePool = [[MTLTexturePool alloc] initWithDevice:device];
pipelineStateStorage = [[MTLPipelineStatesStorage alloc] initWithDevice:device shaderLibPath:shadersLib];