-
Notifications
You must be signed in to change notification settings - Fork 563
8373232: Set default filters and addressing modes for 3D metal textures #2005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back jdv! A progress list of the required criteria for merging this PR into |
| hTexture = mtlTex.getNativeHandle(); | ||
| } | ||
| context.setMap(nativeHandle, map.getType().ordinal(), hTexture); | ||
| context.setMap(nativeHandle, map.getType().ordinal(), hTexture, useMipmap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use mipmapping only when (!PlatformUtil.isEmbedded()) && (i == PhongMaterial.DIFFUSE || i == PhongMaterial.SELF_ILLUM);. We need to pass mipmap information, so that we can pick appropriate sampler state in native code.
|
@jayathirthrao This change is no longer ready for integration - check the PR body for details. |
Webrevs
|
lukostyra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general looks good, but I have one question to double-check something I couldn't find.
The sampler is chosen based on whether we use mipmaps or not. In cases where mipmaps are not used, are we still generating them?
@lukostyra Thanks for the review. We pass this mipmap flag to the native code when texture is getting created. And we use this flag and generate mipmaps only for the textures where this flag is true : https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/native-prism-mtl/MetalTexture.m#L203 So for non-mipmapped 3D textures we don't generate mipmaps. |
lukostyra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for responding. I found one thing that could be improved, will run some tests on this later on.
lukostyra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
I just noticed the ready label, but I think this requires two reviewers. /reviewers 2 |
|
@lukostyra |
arapte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving a few queries regarding the changes.
I expect there should not be any behavior changes, correct ?
| /* | ||
| * Class: com_sun_prism_mtl_MTLContext | ||
| * Method: nSetDeviceParametersFor3D | ||
| * Signature: (J)J |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor : (J)J should be changed to (J)V
| [phongEncoder setFragmentSamplerState:[material getSamplerState:DIFFUSE] | ||
| atIndex:0]; | ||
| [phongEncoder setFragmentTexture:[material getMap:SPECULAR] | ||
| atIndex:1]; | ||
| [phongEncoder setFragmentSamplerState:[material getSamplerState:SPECULAR] | ||
| atIndex:0]; | ||
| [phongEncoder setFragmentTexture:[material getMap:BUMP] | ||
| atIndex:2]; | ||
| [phongEncoder setFragmentSamplerState:[material getSamplerState:BUMP] | ||
| atIndex:0]; | ||
| [phongEncoder setFragmentTexture:[material getMap:SELFILLUMINATION] | ||
| atIndex:3]; | ||
| [phongEncoder setFragmentSamplerState:[material getSamplerState:SELFILLUMINATION] | ||
| atIndex:0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- All
setFragmentSamplerStateare setting at index 0, should it not be 0,1,2,3? - Does this not require any changes to
PhongPS.metal, The shader functions inPhongPS.metaldo not have asamplerparameter. - Currently the
PhongPS.metalfile 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 usingsetFragmentSamplerState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the observations @arapte .
Yes these changes are needed and it also has to be tested properly. So moving this PR back to draft stage.
|
@jayathirthrao This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply issue a |
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.
Progress
Integration blocker
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2005/head:pull/2005$ git checkout pull/2005Update a local copy of the PR:
$ git checkout pull/2005$ git pull https://git.openjdk.org/jfx.git pull/2005/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2005View PR using the GUI difftool:
$ git pr show -t 2005Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2005.diff
Using Webrev
Link to Webrev Comment