Work
...
A working prototype of basic feature-set with Java 2D Metal rendering pipeline has been implemented for -
- 2D Primitives rendering
- implemented AA rendering for some primitives and painting types
- optimised geometry handling (no unnecessary MTLBuffer creation)
- improved stability: fixed some severe memory management problems in primitive handling
- Image rendering.
- improved stability: fixed several memory management problems
- native blit operations (Blit, IsoBlit) for almost all blit primitives (of MTLBlitLoops)
- all 32bpp raster formats with ‘opaque’ flags
- all alpha-composite modes (still unsupported extra-alpha)
- clipping, transform
- textures pool (to avoid reallocations for temporary textures) with restricted size (cleaned with LRU-strategy)
- fast search in pool
- no unnecessary sync
- blit without sampling if possible
- Grayscale Text Rendering
It is available in the lanai repo https://hg.openjdk.java.net/lanai/lanai/
...
in Progress :
- JEP code review has been completed : Refer https://github.com/openjdk/jdk/pull/2403. The JEP has been INTEGRATED into JDK mainline on 15 March 2021.
- Work on Project Lanai is complete and no new work will happen in lanai-dev community.
- Further bug fixing will now be done in 2d-dev/awt-dev communities.
Work in Progress :
Current focus area is - Rendering performance evaluation :
As basic blocks of rendering have been implemented, it is a good time to check on rendering performance to evaluate how Metal rendering in Java 2D fares as compared to OpenGL rendering in Java 2D. As a first step, we are using below test benchmarkings -
- RenderPerfTest (available at - src/demo/share/java2d/RenderPerfTest)
- implemented AA benchmarks
- J2DBench Tests (available at - src/demo/share/java2d/J2DBench) for drawing 2D primitives - line, rectangle, filled rectangle, ellipse, filled ellipse.
...
- Reducing number of MTLRenderEncoders that get created per render pass
- Reducing the number of drawPrimitives calls by batching data whenever possible
- Using setNeedsDisplay flag of MTLLayer and updating the layer content on AppKit thread in a callback
Current numbers from RenderPerfTest (OGL vs Metal):
...
FlatOval(AA)
...
FlatBox
...
Image(AA)
...
RotatedBox
...
RotatedOval(AA)
...
LinGradRotatedOval
...
WiredBubbles(AA)
...
WiredBox
...
Lines
...
FlatQuad(AA)
...
WiredQuad(AA)
...
TextNoAA
...
TextLCD
...
TextGray
...