JDK-8311773 : Cache Fragment functions uniform variable name and id in MTShader.java
  • Type: Sub-task
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: internal
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2023-07-10
  • Updated: 2024-07-06
  • Resolved: 2023-07-12
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
Description
We use MTLArgumentEncoder to pass uniform variables to Fragment functions.
Each time when we set a uniform variable using its name, we map that variable to it's id.
Each of the method needs converting java string to objective c string: This seems to be consuming more memory which can be avoided.
This can be avoided by caching the name to id map on Java side in MTLShader.java 
Comments
I don't see a FPS gain with this change. But this will reduce several calls for allocation of memory for converting string from java to native.
12-07-2023

Changeset: 91c766ea Author: Ambarish Rapte <arapte@openjdk.org> Date: 2023-07-12 10:14:11 +0000 URL: https://git.openjdk.org/jfx-sandbox/commit/91c766eaaea22cd4a73f8f41c397eb9be1ba5553
12-07-2023