RFR: 8271024: Implement macOS Metal Rendering Pipeline [v20]
Ambarish Rapte
arapte at openjdk.org
Tue Aug 5 18:09:21 UTC 2025
On Tue, 5 Aug 2025 16:21:22 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Ambarish Rapte has updated the pull request incrementally with one additional commit since the last revision:
>>
>> nir: review comments
>
> modules/javafx.graphics/src/main/java/com/sun/prism/mtl/MTLTexture.java line 133:
>
>> 131: arr = new byte[buf.remaining()];
>> 132: buf.get(arr);
>> 133: }
>
> I instrumented the code, and found that `updateTextureByte` is sometimes called with a direct byte buffer, which means that `buf.hasArray()` returns false. In the cases I tested, the format is `BYTE_ALPHA`, so without your change it will correctly call the native method with a null array and the direct byte buffer. This will cause the native method to use the optimized path. With this change, we now create a new byte array, copy from the direct byte buffer to that array, and pass that to the native method. This isn't what we want.
>
> I think you should revert this change, and move the array allocation / copy code to the cases that actually need it. The revert needs to happen now. The allocation / copy code could be done either now or via a follow-up bug.
Moved the copy code to specific cases PixelFormat.BYTE_RGB and PixelFormat.BYTE_GRAY.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1824#discussion_r2255001943
More information about the openjfx-dev
mailing list