Path: blob/master/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexturePool.h
41159 views
/*1* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef MTLTexturePool_h_Included26#define MTLTexturePool_h_Included27#include <time.h>28#import "MTLUtils.h"2930@class MTLPoolCell;3132@interface MTLTexturePoolItem : NSObject33@property (readwrite, retain) id<MTLTexture> texture;34@property (readwrite) bool isBusy;35@property (readwrite) time_t lastUsed;36@property (readwrite) bool isMultiSample;37@property (readwrite, assign) MTLTexturePoolItem* prev;38@property (readwrite, retain) MTLTexturePoolItem* next;39@property (readwrite, assign) MTLPoolCell* cell;4041- (id) initWithTexture:(id<MTLTexture>)tex cell:(MTLPoolCell*)cell;42@end4344@interface MTLPooledTextureHandle : NSObject45@property (readonly, assign) id<MTLTexture> texture;46@property (readonly) MTLRegion rect;47- (void) releaseTexture;48@end4950// NOTE: owns all MTLTexture objects51@interface MTLTexturePool : NSObject52@property (readwrite, retain) id<MTLDevice> device;5354- (id) initWithDevice:(id<MTLDevice>)device;55- (MTLPooledTextureHandle *) getTexture:(int)width height:(int)height format:(MTLPixelFormat)format;56- (MTLPooledTextureHandle *) getTexture:(int)width height:(int)height format:(MTLPixelFormat)format57isMultiSample:(bool)isMultiSample;58@end5960@interface MTLPoolCell : NSObject61@property (readwrite, retain) MTLTexturePoolItem* available;62@property (readwrite, assign) MTLTexturePoolItem* availableTail;63@property (readwrite, retain) MTLTexturePoolItem* occupied;64- (MTLTexturePoolItem *)createItem:(id<MTLDevice>)dev65width:(int)width66height:(int)height67format:(MTLPixelFormat)format68isMultiSample:(bool)isMultiSample;69- (NSUInteger)cleanIfBefore:(time_t)lastUsedTimeToRemove;70- (void)releaseItem:(MTLTexturePoolItem *)item;71@end7273#endif /* MTLTexturePool_h_Included */747576