Skip to content

Commit

Permalink
Merge branch 'pipelined-rendering' into directional-light-and-shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
superdump committed Jun 30, 2021
2 parents 10819b0 + 03cf087 commit df6074d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion pipelined/bevy_pbr2/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ impl FromWorld for PbrShaders {
let render_device = world.get_resource::<RenderDevice>().unwrap();
let shader = Shader::from_wgsl(include_str!("pbr.wgsl"));
let shader_module = render_device.create_shader_module(&shader);
println!("{}", GpuLights::std140_size_static());

// TODO: move this into ViewMeta?
let view_layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
Expand Down
1 change: 0 additions & 1 deletion pipelined/bevy_pbr2/src/render/pbr.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ fn fetch_shadow(light_id: i32, homogeneous_coords: vec4<f32>) -> f32 {

struct FragmentInput {
[[builtin(front_facing)]] is_front: bool;
[[builtin(position)]] clip_position: vec4<f32>;
[[location(0)]] world_position: vec4<f32>;
[[location(1)]] world_normal: vec3<f32>;
[[location(2)]] uv: vec2<f32>;
Expand Down
9 changes: 6 additions & 3 deletions pipelined/bevy_render2/src/view/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use bevy_window::{RawWindowHandleWrapper, WindowId, Windows};
use std::ops::{Deref, DerefMut};
use wgpu::TextureFormat;

// Token to ensure a system runs on the main thread.
#[derive(Default)]
struct NonSendToken;
pub struct NonSendMarker;

pub struct WindowRenderPlugin;

Expand All @@ -21,7 +22,7 @@ impl Plugin for WindowRenderPlugin {
let render_app = app.sub_app_mut(0);
render_app
.init_resource::<WindowSurfaces>()
.init_resource::<NonSendToken>()
.init_resource::<NonSendMarker>()
.add_system_to_stage(RenderStage::Extract, extract_windows.system())
.add_system_to_stage(RenderStage::Prepare, prepare_windows.system());
}
Expand Down Expand Up @@ -81,7 +82,9 @@ pub struct WindowSurfaces {
}

pub fn prepare_windows(
_token: NonSend<NonSendToken>,
// By accessing a NonSend resource, we tell the scheduler to put this system on the main thread,
// which is necessary for some OS s
_marker: NonSend<NonSendMarker>,
mut windows: ResMut<ExtractedWindows>,
mut window_surfaces: ResMut<WindowSurfaces>,
render_device: Res<RenderDevice>,
Expand Down

0 comments on commit df6074d

Please sign in to comment.