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

8262882: Lanai: NetBeans crashes often when switching between dual and single screen #211

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
@@ -194,6 +194,9 @@ void drawTex2Tex(MTLContext *mtlc,
[computeEncoder setBuffer:swizzled offset:0 atIndex:1];

NSUInteger threadGroupSize = computePipelineState.maxTotalThreadsPerThreadgroup;
if (threadGroupSize == 0) {
threadGroupSize = 1;
}
NSUInteger pixelCount = buff.length / srcInfo->pixelStride;
MTLSize threadsPerGroup = MTLSizeMake(threadGroupSize, 1, 1);
MTLSize threadGroups = MTLSizeMake((pixelCount + threadGroupSize - 1) / threadGroupSize,
@@ -92,8 +92,13 @@ - (void) dealloc {
[self onComplete];

[_pooledTextures release];
_pooledTextures = nil;

[_commandBuffer release];
_commandBuffer = nil;

[_lock release];
_lock = nil;
[super dealloc];
}

@@ -164,19 +169,54 @@ - (id)initWithDevice:(id<MTLDevice>)d shadersLib:(NSString*)shadersLib {
- (void)dealloc {
J2dTraceLn(J2D_TRACE_INFO, "MTLContext.dealloc");

self.texturePool = nil;
// TODO : Check that texturePool is completely released.
// texturePool content is released in MTLCommandBufferWrapper.onComplete()
//self.texturePool = nil;
self.vertexBuffer = nil;
self.commandQueue = nil;
self.blitCommandQueue = nil;
self.pipelineStateStorage = nil;
[_encoderManager release];
[_samplerManager release];
[_stencilManager release];
[_composite release];
[_paint release];
[_transform release];
[_tempTransform release];
[_clip release];

if (_encoderManager != nil) {
[_encoderManager release];
_encoderManager = nil;
}

if (_samplerManager != nil) {
[_samplerManager release];
_samplerManager = nil;
}

if (_stencilManager != nil) {
[_stencilManager release];
_stencilManager = nil;
}

if (_composite != nil) {
[_composite release];
_composite = nil;
}

if (_paint != nil) {
[_paint release];
_paint = nil;
}

if (_transform != nil) {
[_transform release];
_transform = nil;
}

if (_tempTransform != nil) {
[_tempTransform release];
_tempTransform = nil;
}

if (_clip != nil) {
[_clip release];
_clip = nil;
}

[super dealloc];
}

@@ -656,14 +656,13 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
CHECK_PREVIOUS_OP(MTL_OP_OTHER);
jlong pConfigInfo = NEXT_LONG(b);
CONTINUE_IF_NULL(mtlc);
MTLGC_DestroyMTLGraphicsConfig(pConfigInfo);

// the previous method will call glX/wglMakeCurrent(None),
// so we should nullify the current mtlc and dstOps to avoid
// calling glFlush() (or similar) while no context is current
if (mtlc != NULL) {
[mtlc.encoderManager endEncoder];
}

MTLGC_DestroyMTLGraphicsConfig(pConfigInfo);

mtlc = NULL;
// dstOps = NULL;
break;