Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Work

...

A working prototype of basic feature-set with Java 2D Metal rendering pipeline has been implemented for - 

  1. 2D Primitives rendering
    1. implemented AA rendering for some primitives and painting types
    2. investigated multisampling AA rendering, tried on AA parallelogram rendering
    3. optimised geometry handling (no unnecessary MTLBuffer creation)
    4. improved stability: fixed some severe memory management problems in primitive handling
  2. Image rendering. 
    1. improved stability: fixed several memory management problems
    2. native blit operations (Blit, IsoBlit) for almost all blit primitives (of MTLBlitLoops)
    3. all 32bpp raster formats with ‘opaque’ flags
    4. all alpha-composite modes (still unsupported extra-alpha)
    5. clipping, transform
    6. textures pool (to avoid reallocations for temporary textures) with restricted size (cleaned with LRU-strategy)
      1. fast search in pool
      2. no unnecessary sync
      3. blit without sampling if possible
  3. 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 - 

  1. RenderPerfTest (available at - src/demo/share/java2d/RenderPerfTest)
    1. implemented AA benchmarks
  2. J2DBench Tests (available at - src/demo/share/java2d/J2DBench) for drawing 2D primitives - line, rectangle, filled rectangle, ellipse, filled ellipse.

...

  1. Reducing number of MTLRenderEncoders that get created per render pass
  2. Reducing the number of drawPrimitives calls by batching data whenever possible
  3. 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)

...

71(18)

...

72(5)

...

FlatBox(AA)

...

87(90)

...

87(6)

...

Image(AA)

...

91(90)

...

88(88)

...

RotatedBox(AA)

...

88(84)

...

89(6)

...

RotatedOval(AA)

...

77(19)

...

78(8)

...

LinGradRotatedOval

...

74

...

WiredBubbles(AA)

...

44(14)

...

46(5)

...

WiredBox

...

85

...

88

...

Lines

...

85

...

85

...

FlatQuad(AA)

...

71(9)

...

73(1)

...

WiredQuad(AA)

...

57(13)

...

60(5)

...

TextNoAA

...

94

...

62

...

TextLCD

...

57

...

TextGray

...

88

...