-
Notifications
You must be signed in to change notification settings - Fork 505
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
8217853: Cleanup in the D3D native pipeline #789
8217853: Cleanup in the D3D native pipeline #789
Conversation
👋 Welcome back nlisker! A progress list of the required criteria for merging this PR into |
/reviewers 2 |
@nlisker |
Webrevs
|
modules/javafx.graphics/src/main/native-prism-d3d/D3DMeshView.cc
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/D3DMeshView.h
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/hlsl/psMath.h
Outdated
Show resolved
Hide resolved
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.
Providing few minor comments.
I still need to do another pass. All looks good till now.
modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGShape3D.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGShape3D.java
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/hlsl/psMath.h
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/D3DPhongMaterial.h
Outdated
Show resolved
Hide resolved
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.
Found few minor corrections.
I need to do one more pass at the hlsl code.
modules/javafx.graphics/src/main/native-prism-d3d/D3DMeshView.cc
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/D3DMeshView.cc
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/D3DMeshView.cc
Outdated
Show resolved
Hide resolved
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.
Providing few more comments.
modules/javafx.graphics/src/main/native-prism-d3d/hlsl/vsMath.h
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/hlsl/Mtl1VS.hlsl
Outdated
Show resolved
Hide resolved
modules/javafx.graphics/src/main/native-prism-d3d/hlsl/vsMath.h
Outdated
Show resolved
Hide resolved
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.
Looks good to me,
pending one change in vertex shader, ongoing conversation.
modules/javafx.graphics/src/main/native-prism-d3d/hlsl/Mtl1VS.hlsl
Outdated
Show resolved
Hide resolved
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,
suggested a minor correction in comment.
I will re-approve if any more changes.
@@ -26,7 +26,8 @@ | |||
#include "vsDecl.h" | |||
#include "vsMath.h" | |||
|
|||
VsOutput main(VsInput vsInput) { | |||
// VertexType = VsInput as defined the gradle build file |
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:- VertexType = VsInput,
as defined in
the build.gradle
file
@kevinrushforth If this fell through the cracks please add it to the list too :) It's a blocker for future work. |
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.
I found at least three regressions in behavior:
- The ambient light doesn't go back to black when an ambient light is added then removed.
- Adding a second point light (or spot light) causes no lighting to be done, as if there were no lights
- The magenta point light (and spot light) no longer works at all.
See inline comments for the first problem.
To reproduce the second, run the LightingSample
, show a Sphere, select the red point light (correctly shows a red point light on the right), then select the blue point light (no lighting happens).
modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGShape3D.java
Outdated
Show resolved
Hide resolved
At first I couldn't reproduce these, then I found out the launch command of the test app points to the wrong build artifacts, so any changes I made were not reflected in my visual checks. It's the same for other test apps, so it's a good thing it was discovered. Thanks!
I'm also adding a default light mode to the test app to make sure it works correctly when there are no other lights in the scene. |
For reasons that I don't understand, the problem was the order of the semantics declared in the |
8217853_Cleanup_in_the_D3D_native_pipeline
@arapte Please re-review. |
I tested this behavior at commit bb9f802, and can't observe any visual difference with regards to the order of Are you sure that this isn't an artifact of your local build? I notice that Gradle doesn't seem to pick up changes in HLSL headers, so I have to clean the build artifacts to prevent Gradle from skipping |
Can you reproduce Kevin's observation at 1f66f61? If yes, which commit fixed it for you? For me it's the one that changed the order of the fields.
I delete the hlsl shaders every build so that they will be recreated. Still, there could be some caching involved that I couldn't spot. I changed the order of the variables in the struct back and forth and tried several orders to make sure it's not a coincidence and the results were consistant. |
With 1f66f61, I can reproduce Kevin's first observation (ambient light doesn't go back to black), but not the other two. With the next commit 3142908, I can confirm that the ambient light issue is fixed (it goes back to black when I uncheck the ambient light toggle). I've also triple-checked that I'm pointing the I'm running the application on a PC with a dedicated NVIDIA GeForce GTX 970 with driver version 511.23. |
The ambient light issue was on the Java side. The purple light is probably just a false observation because it starts in a position where it doesn't apply its light. The real mystery is the problem with the two point lights. I have an AMD 470. |
Btw, I am running this on an Intel UHD Graphics 630. |
To close the loop on the three problems I reported earlier:
I can confirm that 1 and 2 are fixed, and 3 isn't an issue, but is just how the test app works (it behaves the same with or without this patch, and shows up fine when I animate the sphere). |
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
@nlisker This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 27 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 4a27801.
Your commit was automatically rebased without conflicts. |
If you have time, it would be interesting check if it breaks for you by changing the order of the semantics. It might be worth adding a comment there because it's a rather surprising side effect. |
Which part of the change, exactly, do you mean? The part that moved |
The change that moved |
Refactoring and renaming changes to some of the D3D pipeline files and a few changes on the Java side. These are various "leftovers" from previous issues that we didn't want to touch at the time in order to confine the scope of the changes. They will make future work easier.
Since there are many small changes, I'm giving a full list here:
Java
NGShape3D.java
switch
.NGPointLight,java
- removed unneeded methods that were used byNGShape3D
before the per-lighting methods were extracted (point light doesn't need spotlight-specific methods since they each have their own "add" method).NGSpotLight.java
- removed@Override
annotations as a result of the above change.Native C++
D3DLight
,D3DMeshView
andD3DPhongMaterial
in the header file instead of a more cumbersome initialization in the constructor (this is allowed since C++ 11).D3DLight
w
component tolightOn
since it controls the number of lights for the special pixel shader variant and having it in the 4th position of the color array was confusing.D3DPhongShader.h
vsConstants
there isgAmbinetData[10]
, but it is unused.VSR_LIGHTS
constant since it included both position and color, but color was unused there (it was used directly in the pixel shader), so now it's only the position.D3DMeshView.cc
NGShape3D.java
.D3DPhongShader.h
.Native shaders
eye
doesn't tell me if it's from or to the camera).vsConstants
psConstants
instead.vs2ps
LocalBumpOut
and why is it calledlight
and containsLocalBump
?).Mtl1PS
andpsMath
#ifndef
) toMtl1PS
where they are used for better clarity.Mtl1PS
. The calculation itself remains inpsMath
.No changes in performance were measured and the behavior stayed the same.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/789/head:pull/789
$ git checkout pull/789
Update a local copy of the PR:
$ git checkout pull/789
$ git pull https://git.openjdk.org/jfx pull/789/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 789
View PR using the GUI difftool:
$ git pr show -t 789
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/789.diff