Skip to content
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

Add FullscreenPassNode for post-processing #2027

Closed
wants to merge 15 commits into from
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ path = "examples/shader/animate_shader.rs"
name = "array_texture"
path = "examples/shader/array_texture.rs"

[[example]]
name = "fullscreen_pass"
path = "examples/shader/fullscreen_pass.rs"

[[example]]
name = "hot_shader_reloading"
path = "examples/shader/hot_shader_reloading.rs"
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_render/src/render_graph/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ pub(crate) fn add_base_graph(config: &BaseRenderGraphConfig, world: &mut World)
* bit depth for better performance */
usage: TextureUsage::OUTPUT_ATTACHMENT,
},
None,
None,
),
);
}
Expand Down Expand Up @@ -222,6 +224,8 @@ pub(crate) fn add_base_graph(config: &BaseRenderGraphConfig, world: &mut World)
format: TextureFormat::default(),
usage: TextureUsage::OUTPUT_ATTACHMENT,
},
None,
None,
),
);

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_graph/node_slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl ResourceSlots {

pub fn get(&self, label: impl Into<SlotLabel>) -> Option<RenderResourceId> {
let slot = self.get_slot(label).unwrap();
slot.resource.clone()
slot.resource
}

pub fn get_slot(&self, label: impl Into<SlotLabel>) -> Result<&ResourceSlot, RenderGraphError> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 450

layout(location=0) out vec2 v_Uv;

void main() {
// Setup a single triangle
float x = float((gl_VertexIndex & 1) << 2);
float y = float((gl_VertexIndex & 2) << 1);
v_Uv = vec2(x * 0.5, 1.0-y * 0.5);
gl_Position = vec4(x - 1.0, y - 1.0, 0, 1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pub mod node;

pub mod shaders {
pub const VERTEX_SHADER: &str = include_str!("fullscreen.vert");
pub const NOOP_SHADER: &str = include_str!("noop.frag");
}
Loading