Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8262882: Lanai: NetBeans crashes often when switching between dual an…
…d single screen
  • Loading branch information
aghaisas committed Mar 9, 2021
1 parent 42f6a5f commit be067d4468266406a2c299d9b8d4c4932ba4bab1
@@ -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;

0 comments on commit be067d4

Please sign in to comment.