[OpenJDK 2D-Dev] RFR: 8264475: CopyArea ignores clip state in metal rendering pipeline

Jayathirth D V jdv at openjdk.java.net
Wed Mar 31 07:34:42 UTC 2021

On Wed, 31 Mar 2021 07:27:45 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

> In MTLBlitLoops.copyArea() we use standalone encoder which has no clip state information because of which we ignore clip parameters set in rect clip and shape clip. We need to query and use encoders from EncoderManager to honour clip states in copyArea.

src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLTexurePool.m line 206:

> 204:                                                            mipmapped:NO];
> 205:     textureDescriptor.usage = MTLTextureUsageRenderTarget |
> 206:         MTLTextureUsageShaderRead;

In copyArea we use intermediate texture queried from TexturePool as render target. If we dont set any MTLTextureUsage, we are getting assertion errors when Metal API validation is enabled because by default we can only do texture shader read(https://developer.apple.com/documentation/metal/mtltexturedescriptor/1515783-usage?language=objc). To avoid these assertion errors in Metal API validation we need to set appropriate MTLTextureUsage parameters.


PR: https://git.openjdk.java.net/jdk/pull/3283

More information about the 2d-dev mailing list