-
Notifications
You must be signed in to change notification settings - Fork 194
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
Support dual source blending #2427
Conversation
I had a look into the clippy errors, and it seems to be in some kind of external crate that I have not changed. |
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 can't leave a full review, since I'm not familiar with the domain and don't trust myself to validate shader output properly (CC @teoxoy), but most of the changes in code don't look controversial to me, assuming the shader output is correct. In addition to spanned commentary, here are some reviewer notes I made for myself:
- Original motivating issue in
wgpu
: Dual Source Blending wgpu#1804 - The
Dual Source Blending
section of theBlending
article from Khronos' wiki was particularly useful for helping me understand the domain here. This source also corroborates the GLSL logic added here, so yay! - This adds support with these ends:
- Front end: only WGSL
- Back ends: all supported backends.
- Q: Do we have sources for these syntaxes?
- @freqmod mentions adding support for DirectX, which I presume to mean HLSL, but I don't see the HLSL represented here. I found HLSL: Support dual-source blending. KhronosGroup/SPIRV-Cross#815, which looks like a potentially helpful model for what to do here (viz., use
SV_Target${index}
).
Regarding HLSL it may be that i only did some work on that in the WGPU patch (and not the naga patch) and mixed up. Regarding example code: there is a shader in https://github.com/freqmod/helicoid/blob/master/helicoid-gpurender/shaders/text.fs.wgsl but it may be useful to get one in this (or the wgpu) repo for proper regression testing. I will look further at this and address the comments later. |
We should definitely have shader snapshot tests for this here, independent of |
|
I accepted the proposed changes that i think are relevant. I will do another upload with manual changes to address the other comments later. |
I would still prefer to have something like secondary_blend_source etc, but since you are more likely to maintain this in the future i think it is better to just go with your name and get this in without further bikeshedding. |
I hope i have seen and addressed all the comments. If there are any minor fixes needed feel free to just do them if you prefer to avoid another review cycle. |
Pushed rebase. It should not be any changes (except adaptions to upstream) since last push. |
How about I can make the change. Otherwise, PR looks great! Thanks for all the changes :) |
second_blend_source is good. I can do an upload. I'll also squash everything as the commits now are quite messy.. |
If you are at it, can you update the WGSL attribute and also I saw a few remaining places (esp. errors) where we still use "alternate". Thanks! |
I will review the squashed version before pushing to fix any small things left. |
Now I have addressed everything I can see. Feel free to do any changes on top of the last upload you need and merge when you are happy. Thanks for working on the review. I'll start to rebase and address the wgpu changes soon. |
reorder validation logic and add one extra error
Thanks! I pushed a few more commits, let me know if they look good and we can land it! |
Thanks. They look good to me, please land it. |
This reverts commit 0491d39.
This reverts commit 0491d39.
This reverts commit 2426fd0.
Support writing shaders with alt blender mode.
Tested on linux with OpenGL, and Vulkan, and on Mac using metal. I have made some changes for Direct X but since I don't have a windows build environment I haven't tested that.
See https://github.com/freqmod/helicoid/tree/master/helicoid-wgpu for usage example.
See gfx-rs/wgpu#1804 (comment) for related issue