8253931: Lanai: MTLTexturePool refactoring
EncoderManager: added autoreleasepool
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m
index 7ab0e30..090667a 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/EncoderManager.m
@@ -340,22 +340,24 @@
[MTLRenderPassDescriptor renderPassDescriptor];
MTLRenderPassColorAttachmentDescriptor *ca = rpd.colorAttachments[0];
if (renderOptions->isAA && !renderOptions->isTexture) {
- MTLTexturePoolItem *tiBuf = [_mtlc.texturePool getTexture:dest.width
- height:dest.height
- format:MTLPixelFormatBGRA8Unorm];
- [cbw registerPooledTexture:tiBuf];
- _aaDestination = tiBuf.texture;
+ @autoreleasepool {
+ MTLTexturePoolItem *tiBuf = [_mtlc.texturePool getTexture:dest.width
+ height:dest.height
+ format:MTLPixelFormatBGRA8Unorm];
+ [cbw registerPooledTexture:tiBuf];
+ _aaDestination = tiBuf.texture;
- MTLTexturePoolItem *ti = [_mtlc.texturePool getTexture:dest.width
- height:dest.height
- format:_aaDestination.pixelFormat
- isMultiSample:YES];
- [cbw registerPooledTexture:ti];
- ca.texture = ti.texture;
- ca.resolveTexture = _aaDestination;
- ca.clearColor = MTLClearColorMake(0.0f, 0.0f, 0.0f, 0.0f);
- ca.loadAction = MTLLoadActionClear;
- ca.storeAction = MTLStoreActionMultisampleResolve;
+ MTLTexturePoolItem *ti = [_mtlc.texturePool getTexture:dest.width
+ height:dest.height
+ format:_aaDestination.pixelFormat
+ isMultiSample:YES];
+ [cbw registerPooledTexture:ti];
+ ca.texture = ti.texture;
+ ca.resolveTexture = _aaDestination;
+ ca.clearColor = MTLClearColorMake(0.0f, 0.0f, 0.0f, 0.0f);
+ ca.loadAction = MTLLoadActionClear;
+ ca.storeAction = MTLStoreActionMultisampleResolve;
+ }
} else {
ca.texture = dest;
ca.loadAction = MTLLoadActionLoad;