-
-
Notifications
You must be signed in to change notification settings - Fork 893
Shaders: runtime and shader node codegen #2985
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6a0c07a
shader-rt: initial
Firestar99 5981022
shader-rt: fix recursion when generating shader node
Firestar99 17f2da0
shader-rt: replace gpu node's args and ret types with `Raster<GPU>`
Firestar99 2e660be
shader-rt: properly cfg out the gpu node
Firestar99 716dcba
shader-rt: fix `impl Context` in the wrong places
Firestar99 e9ae52d
shader-rt: disable gpu blend node, needs two images
Firestar99 b25b059
shader-rt: connect shader runtime
Firestar99 6a116fd
shader-rt: pass WgpuExecutor by reference
Firestar99 1c89d7a
shader-rt: correct bindings with derpy arg buffer
Firestar99 2495421
shader-rt: manual pipeline layout, fixing errors when bindings got DCE'd
Firestar99 8fc9eb7
shader-rt: correct RT format, working invert gpu node
Firestar99 16c67ec
shader-rt: cleanup codegen with common sym struct
Firestar99 1128271
shader-rt: correct arg buffer handling
Firestar99 676aea3
shader-nodes feature: put shader nodes behind feature gate
Firestar99 e3e0fbe
shader-nodes feature: rename any `gpu_node` to `shader-node`
Firestar99 7c7fea2
shaders-rt: fix wgpu label name
Firestar99 aba44eb
shaders-rt: explain fullscreen_vertex coordinates with a drawing
Firestar99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use glam::{Vec2, Vec4}; | ||
use spirv_std::spirv; | ||
|
||
/// webgpu NDC is like OpenGL: (-1.0 .. 1.0, -1.0 .. 1.0, 0.0 .. 1.0) | ||
/// https://www.w3.org/TR/webgpu/#coordinate-systems | ||
/// | ||
/// So to make a fullscreen triangle around a box at (-1..1): | ||
/// | ||
/// ```norun | ||
/// 3 + | ||
/// |\ | ||
/// 2 | \ | ||
/// | \ | ||
/// 1 +-----+ | ||
/// | |\ | ||
/// 0 | 0 | \ | ||
/// | | \ | ||
/// -1 +-----+-----+ | ||
/// -1 0 1 2 3 | ||
/// ``` | ||
const FULLSCREEN_VERTICES: [Vec2; 3] = [Vec2::new(-1., -1.), Vec2::new(-1., 3.), Vec2::new(3., -1.)]; | ||
|
||
#[spirv(vertex)] | ||
pub fn fullscreen_vertex(#[spirv(vertex_index)] vertex_index: u32, #[spirv(position)] gl_position: &mut Vec4) { | ||
// broken on edition 2024 branch | ||
// let vertex = unsafe { *FULLSCREEN_VERTICES.index_unchecked(vertex_index as usize) }; | ||
let vertex = FULLSCREEN_VERTICES[vertex_index as usize]; | ||
*gl_position = Vec4::from((vertex, 0., 1.)); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.