Skip to content

Update Java bindings for HDR support#1147

Draft
javagl wants to merge 11 commits intoKhronosGroup:mainfrom
javagl:update-java-bindings-for-hdr
Draft

Update Java bindings for HDR support#1147
javagl wants to merge 11 commits intoKhronosGroup:mainfrom
javagl:update-java-bindings-for-hdr

Conversation

@javagl
Copy link
Copy Markdown
Contributor

@javagl javagl commented Mar 11, 2026

The PR #1100 added HDR support.

This PR aims at updating the Java bindings accordingly. (EDIT: So it may fix #1144 , eventually...)

What is done until now:

  • Added the UASTC_HDR_6X6_INTERMEDIATE supercompression scheme enum value
  • Added the RGBA_HALF/ASTC_HDR_4x4_RGBA/ASTC_HDR_6x6_RGBA transcode format enum values
  • Added a new KtxBasisCodec class, corresponding to the codec enum, as requested in a review comment
  • Added the new fields that have been added to ktxBasisParams (like uastcHDRUltraQuant etc) to the KtxBasisParams class
  • (Minor corresponding cleanups)

What remains to be done:

  • Wire this to the native side accordingly, e.g. initialize the new fields and fill the native struct
  • Add native versions of the
    KTX_API ktx_bool_t KTX_APIENTRY ktxTexture1_IsTranscodable(ktxTexture1* This);
    functions (for KtxTexture1 and KtxTexture2)
  • There seem to be further methods: getColorModel, getTransferFunction, isHDR ... ? Not yet looked at the details
  • Add tests, if possible

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 11, 2026

CLA assistant check
All committers have signed the CLA.

@MarkCallow
Copy link
Copy Markdown
Collaborator

  • There seem to be further methods: getColorModel, getTransferFunction, isHDR ... ? Not yet looked at the details

The first two are not specific to HDR. getTransferFunction has been around for a while and even longer, at least in native, with a different name, getOETF or something like that. Please add all of these to the Java binding.

@MarkCallow
Copy link
Copy Markdown
Collaborator

I have just create PR #1150 to add everything to the Python binding. Letting you know as it may be helpful.

@javagl
Copy link
Copy Markdown
Contributor Author

javagl commented Mar 19, 2026

I'll have a closer look at the changes and will try add any changes that might be missing here.
(Hopefully, during the weekend or early next week)

@javagl
Copy link
Copy Markdown
Contributor Author

javagl commented Apr 1, 2026

Most of the updates that are specific for the added HDR support should be done now.

(I stumbled over the missing ktxTexture2_IsHDR API entry, but that was fixed in a recent PR - I only had to pull this)

I'll add some further tests for the new functionality.


One thing that is "unrelated" to the HDR changes: I noticed that the bindings for

KTX_API khr_df_model_e KTX_APIENTRY
ktxTexture2_GetColorModel_e(ktxTexture2* This);

KTX_API khr_df_primaries_e KTX_APIENTRY
ktxTexture2_GetPrimaries_e(ktxTexture2* This);

are missing, including the corresponding enum equivalents. I've seen that they have been added in your Python binding update PR as well, so I assume that they should also be part of the Java bindings.

I'll try to allocate some time to add them (this could be a new PR, but 🤷‍♂️ it probably makes sense to just add them here...).

Copy link
Copy Markdown
Collaborator

@MarkCallow MarkCallow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks. Some test coverage using the new tokens would be great, if time allows.

I am waiting for fixes to two other issues. I will hold off on merging this until those arrive to give you a window for adding ktxTexture2_GetColorModel_e and ktxTexture2_GetPrimaries_e to this PR. They should indeed be included in the Java wrapper.

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.

Add HDR support to Java binding

3 participants