JDK-8330762 : Avoid creating a new MTLBuffer for encoding arguments
  • Type: Sub-task
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: internal
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-04-22
  • Updated: 2024-06-12
  • Resolved: 2024-05-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
internalFixed
Related Reports
Relates :  
Description
We try to use a single command buffer per frame.
We create a MTLBuffer for every shader to store the uniform variables.

In a scenario when we use a same shader more than once in a single command buffer, we create a new MTLBuffer after every draw call for any shader.
The results in allocation of several MTLBuffer objects while encoding commands.
This can be improved by using a MTLHeap instead to gain 2-3 FPS.

Comments
Changeset: 5b28e84d Author: Ambarish Rapte <arapte@openjdk.org> Date: 2024-05-24 17:09:42 +0000 URL: https://git.openjdk.org/jfx-sandbox/commit/5b28e84d67671571287e0f4fee01f08b4a69a715
27-05-2024

A quick run with a change that avoids creating a new MTLBuffer for argument buffer shows that following tests increase FPS from ~25-30% to almost ~80-90% of OpenGL. Polygon QuadCurve Path StokedPolygon LinGradCircle CubicCurve though other tests do not show any significant gain.
21-05-2024