-
Notifications
You must be signed in to change notification settings - Fork 805
Fix -fvk-invert-y #7447
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
Fix -fvk-invert-y #7447
Conversation
… compiles now also allow fvk-invert-y.
…t; avoids pixel shader from inverting SV_POSITION.y in a lib file
|
Extra context: //dxc -T lib_6_3 test.hlsl -spirv -fvk-invert-y
[shader("vertex")]
float4 test(float4 a : A) : SV_POSITION {
return a;
}Before fix (can't enable -fvk-invert-y without an error, so would end up like this without the flag): After fix: |
llvm-beanz
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.
We'll need a test case, but the code change looks reasonable to me.
@sperron can you or someone from your team take a look at this?
|
I need to look at this carefully. I have some corner cases in mind, and I need to double check if they work. |
s-perron
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 contributing this is a reasonable implementation. As mentioned above add a test. Include multiple shaders in the test. Try to show one shader inverting y while another does not.
I have one concern about usability, but that is outside of the scope of this PR. You could run into trouble if you have a VS->GS->PS pipeline. If the VS and GS are both compiled with invert-y, then they will both invert it and cancel each other out, right? Just something to watch out for.
Yes that's actually a big issue, I guess that is an issue already in some pipelines using the old way (like mine) where each shader is compiled with this flag and it actually doesn't make sense in case GS/DS is used. I'm not sure what the right solution would be though; if you only flip VS/MS then you might miss other cases. The only thing I can think of is an annotation on the entrypoint that tells it that you don't want to flip it. |
…nly supported on GS/VS/DS/MS already. Added test case for fvk-invert-y for lib files
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
|
After another look, it seems like DS/GS/MS/VS aren't the only ones capable of writing to SV_POSITION. I'm not entirely sure if this means HS is excluded on purpose or by accident. But I made it behave as before. |
#7446
This fixes some outdated documentation as well as a compile error when enabling fvk-invert-y on lib files and makes sure that it only gets enabled on SV_POSITION that is used in VS/GS/DS/MS (so PS doesn't get caught in the crossfire).
Also tested the dx-position-w one and that one already has correct behavior here.