Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accelerate swing rendering #1028

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ujpv
Copy link

@ujpv ujpv commented Feb 25, 2025

This PR contains:

  1. Simplify work with rendering via BuffferedImage. It also gives some performance grow
  2. Introduce direct raster loading to the VolatileImage
  3. Introduce shared textures on Metal

Perfomance measurements.
BufImg - drawing with SoftwareSwingDrawer. It's a simplified version of the current drawer.
VolImg - drawing with loading native raster directly to the volatile image - VolatileImageSwingDrawer
SharedTexture - AcceleratedSwingDrawer

Render(ms) - time to prepare the offscreen image(without dumping it to Bitmap) but including the synchronization(Surface#flushAndSubmit)
Draw(ms) - time to draw the rendered image to Graphics2D including dumping the image from the texture to a Bitmap if needed.
Total(ms) - time to render the offscreen image and draw it to Graphics2D. Basically time to run SwingRedrawerBase#onRender

MetalSwingRedrawer
Test: ClocksAwt
Size: 3200x2400(real size)
MacBook Pro M1 M1 Max

              Current    BufImg     VolImg   SharedTexture
FPS              64        76         82        122
Render(ms)      8.25      8.16       8.08       8.03
Draw(ms)        7.02      4.62       3.81       0.0008
Total(ms)      15.28     12.79      11.90       8.04

Direct3DSwingRedrawer

TODO

LinuxOpenGLSwingRedrawer

TODO

@kirill-grouchnikov
Copy link
Contributor

How big of a binary size increase does the dependency on com.jetbrains:jbr-api bring?

@ujpv
Copy link
Author

ujpv commented Feb 25, 2025

How big of a binary size increase does the dependency on com.jetbrains:jbr-api bring?

It's 44kb

[I] # ls -l ~/.m2/repository/com/jetbrains/jbr-api/1.4.0/jbr-api-1.4.0.jar
-rw-r--r--  1 user staff  44319 Feb 25 13:57 /Users/user/.m2/repository/com/jetbrains/jbr-api/1.4.0/jbr-api-1.4.0.jar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants