RFR: 8373232: Set default filters and addressing modes for 3D metal textures [v2]
Ambarish Rapte
arapte at openjdk.org
Wed Dec 17 07:26:13 UTC 2025
On Tue, 16 Dec 2025 11:49:31 GMT, Jayathirth D V <jdv at openjdk.org> wrote:
>> Currently we don't set any texture filtering & addressing modes for 3D textures in Metal pipeline.
>> Default 3D texture filtering is "nearest" for Metal textures, but we use "linear" filtering by default for 3D textures in case of OpenGL.
>> Default addressing mode is "clamp_to_edge" in Metal textures, but we use "repeat" addressing mode for 3D textures in OpenGL.
>>
>> Metal should use same default filtering & addressing modes for 3D textures as in OpenGL pipeline.
>> Under this issue we are trying only to match defaults of Metal to OpenGL pipeline.
>>
>> We don't update the filters/addressing modes for 3D textures once created.
>> We have open enhancements like https://bugs.openjdk.org/browse/JDK-8324594 where we might provide API's to set sampler states for 3D textures in future.
>>
>> Functional and performance testing is green with this update.
>
> Jayathirth D V has updated the pull request incrementally with one additional commit since the last revision:
>
> create sampler states only once
Leaving a few queries regarding the changes.
I expect there should not be any behavior changes, correct ?
modules/javafx.graphics/src/main/native-prism-mtl/MetalContext.m line 1156:
> 1154: * Class: com_sun_prism_mtl_MTLContext
> 1155: * Method: nSetDeviceParametersFor3D
> 1156: * Signature: (J)J
minor : `(J)J` should be changed to `(J)V`
modules/javafx.graphics/src/main/native-prism-mtl/MetalMeshView.m line 244:
> 242: atIndex:3];
> 243: [phongEncoder setFragmentSamplerState:[material getSamplerState:SELFILLUMINATION]
> 244: atIndex:0];
1. All `setFragmentSamplerState` are setting at index 0, should it not be 0,1,2,3?
2. Does this not require any changes to `PhongPS.metal`, The shader functions in `PhongPS.metal` do not have a `sampler` parameter.
3. Currently the `PhongPS.metal` file creates two samplers in shader file itself and uses those for sampling. May be that should be modified to use these samplers that are set using `setFragmentSamplerState`
-------------
Changes requested by arapte (Reviewer).
PR Review: https://git.openjdk.org/jfx/pull/2005#pullrequestreview-3586288154
PR Review Comment: https://git.openjdk.org/jfx/pull/2005#discussion_r2625834766
PR Review Comment: https://git.openjdk.org/jfx/pull/2005#discussion_r2625892527
More information about the openjfx-dev
mailing list