|
|
@ -1,28 +1,28 @@
|
|
|
|
use std::{iter, num::NonZeroU32, ops::Range, rc::Rc};
|
|
|
|
|
|
|
|
use std::cell::RefCell;
|
|
|
|
use std::cell::RefCell;
|
|
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
use std::thread::current;
|
|
|
|
use std::thread::current;
|
|
|
|
use std::time::Duration;
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
use std::{iter, num::NonZeroU32, ops::Range, rc::Rc};
|
|
|
|
|
|
|
|
|
|
|
|
use bytemuck::{Pod, Zeroable};
|
|
|
|
|
|
|
|
use bytemuck::__core::mem;
|
|
|
|
use bytemuck::__core::mem;
|
|
|
|
|
|
|
|
use bytemuck::{Pod, Zeroable};
|
|
|
|
use cgmath::{
|
|
|
|
use cgmath::{
|
|
|
|
Decomposed, Deg, Euler, InnerSpace, Matrix4, Point3, Quaternion, Rad, Rotation3, Transform,
|
|
|
|
vec3, Decomposed, Deg, Euler, InnerSpace, Matrix4, Point3, Quaternion, Rad, Rotation3,
|
|
|
|
vec3, Vector3,
|
|
|
|
Transform, Vector3,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use futures::executor::LocalPool;
|
|
|
|
use futures::executor::LocalPool;
|
|
|
|
use imgui::*;
|
|
|
|
|
|
|
|
use imgui::sys::ImGuiContext;
|
|
|
|
use imgui::sys::ImGuiContext;
|
|
|
|
|
|
|
|
use imgui::*;
|
|
|
|
use imgui_wgpu::{Renderer as ImguiRenderer, RendererConfig as ImguiRendererConfig};
|
|
|
|
use imgui_wgpu::{Renderer as ImguiRenderer, RendererConfig as ImguiRendererConfig};
|
|
|
|
use legion::*;
|
|
|
|
|
|
|
|
use legion::world::SubWorld;
|
|
|
|
use legion::world::SubWorld;
|
|
|
|
|
|
|
|
use legion::*;
|
|
|
|
use rapier3d::parry::motion::RigidMotionComposition;
|
|
|
|
use rapier3d::parry::motion::RigidMotionComposition;
|
|
|
|
|
|
|
|
use wgpu::util::DeviceExt;
|
|
|
|
use wgpu::{
|
|
|
|
use wgpu::{
|
|
|
|
BackendBit, BindGroup, BindGroupLayout, Buffer, BufferBindingType, CommandEncoder, Device,
|
|
|
|
BackendBit, BindGroup, BindGroupLayout, Buffer, BufferBindingType, CommandEncoder, Device,
|
|
|
|
Features, FragmentState, Instance, Queue, Surface, SwapChain, SwapChainDescriptor,
|
|
|
|
Features, FragmentState, Instance, Queue, Surface, SwapChain, SwapChainDescriptor,
|
|
|
|
SwapChainFrame, TextureView, VertexState,
|
|
|
|
SwapChainFrame, TextureView, VertexState,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use wgpu::util::DeviceExt;
|
|
|
|
|
|
|
|
use winit_24::dpi::PhysicalSize;
|
|
|
|
use winit_24::dpi::PhysicalSize;
|
|
|
|
use winit_24::platform::unix::x11::ffi::Time;
|
|
|
|
use winit_24::platform::unix::x11::ffi::Time;
|
|
|
|
use winit_24::window::Window;
|
|
|
|
use winit_24::window::Window;
|
|
|
@ -223,7 +223,6 @@ impl RenderState {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create a render pass with the ability to add external bindings
|
|
|
|
// Create a render pass with the ability to add external bindings
|
|
|
|
pub fn create_render_pass(
|
|
|
|
pub fn create_render_pass(
|
|
|
|
device: &Device,
|
|
|
|
device: &Device,
|
|
|
@ -232,8 +231,6 @@ impl RenderState {
|
|
|
|
uniform_size: u64,
|
|
|
|
uniform_size: u64,
|
|
|
|
label: Option<&str>,
|
|
|
|
label: Option<&str>,
|
|
|
|
) -> Option<Pass> {
|
|
|
|
) -> Option<Pass> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The g-buffers camera projection matrix that we stream data to
|
|
|
|
// The g-buffers camera projection matrix that we stream data to
|
|
|
|
let uniform_buf = device.create_buffer(&wgpu::BufferDescriptor {
|
|
|
|
let uniform_buf = device.create_buffer(&wgpu::BufferDescriptor {
|
|
|
|
label: Some(format!("{} uniform-buffer", label.unwrap_or("unnamed")).as_str()),
|
|
|
|
label: Some(format!("{} uniform-buffer", label.unwrap_or("unnamed")).as_str()),
|
|
|
@ -243,8 +240,7 @@ impl RenderState {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Uniform bind group for the view matrix
|
|
|
|
// Uniform bind group for the view matrix
|
|
|
|
let bind_group_layout =
|
|
|
|
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
|
|
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
|
|
|
|
|
|
|
label: Some(format!("{} bind group layout", label.unwrap_or("unnamed")).as_str()),
|
|
|
|
label: Some(format!("{} bind group layout", label.unwrap_or("unnamed")).as_str()),
|
|
|
|
entries: &[wgpu::BindGroupLayoutEntry {
|
|
|
|
entries: &[wgpu::BindGroupLayoutEntry {
|
|
|
|
binding: 0, // global
|
|
|
|
binding: 0, // global
|
|
|
@ -261,16 +257,14 @@ impl RenderState {
|
|
|
|
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
|
|
|
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
|
|
|
label: Some(format!("{} uniform bind group", label.unwrap_or("unnamed")).as_str()),
|
|
|
|
label: Some(format!("{} uniform bind group", label.unwrap_or("unnamed")).as_str()),
|
|
|
|
layout: &bind_group_layout,
|
|
|
|
layout: &bind_group_layout,
|
|
|
|
entries: &[
|
|
|
|
entries: &[wgpu::BindGroupEntry {
|
|
|
|
wgpu::BindGroupEntry {
|
|
|
|
|
|
|
|
binding: 0,
|
|
|
|
binding: 0,
|
|
|
|
resource: wgpu::BindingResource::Buffer {
|
|
|
|
resource: wgpu::BindingResource::Buffer {
|
|
|
|
buffer: &uniform_buf,
|
|
|
|
buffer: &uniform_buf,
|
|
|
|
offset: 0,
|
|
|
|
offset: 0,
|
|
|
|
size: wgpu::BufferSize::new(uniform_size),
|
|
|
|
size: wgpu::BufferSize::new(uniform_size),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let vs_module =
|
|
|
|
let vs_module =
|
|
|
@ -316,9 +310,7 @@ impl RenderState {
|
|
|
|
slope_scale: 2.0,
|
|
|
|
slope_scale: 2.0,
|
|
|
|
clamp: 0.0,
|
|
|
|
clamp: 0.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clamp_depth: device.features().contains(
|
|
|
|
clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING),
|
|
|
|
wgpu::Features::DEPTH_CLAMPING
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
multisample: wgpu::MultisampleState::default(),
|
|
|
|
multisample: wgpu::MultisampleState::default(),
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -455,7 +447,8 @@ impl RenderState {
|
|
|
|
let bind_group_layout =
|
|
|
|
let bind_group_layout =
|
|
|
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
|
|
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
|
|
|
label: Some("g-buffer input pass bindgroup layout (cam)"),
|
|
|
|
label: Some("g-buffer input pass bindgroup layout (cam)"),
|
|
|
|
entries: &[wgpu::BindGroupLayoutEntry {
|
|
|
|
entries: &[
|
|
|
|
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
binding: 0, // global
|
|
|
|
binding: 0, // global
|
|
|
|
visibility: wgpu::ShaderStage::VERTEX,
|
|
|
|
visibility: wgpu::ShaderStage::VERTEX,
|
|
|
|
ty: wgpu::BindingType::Buffer {
|
|
|
|
ty: wgpu::BindingType::Buffer {
|
|
|
@ -464,7 +457,27 @@ impl RenderState {
|
|
|
|
has_dynamic_offset: false,
|
|
|
|
has_dynamic_offset: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
count: None,
|
|
|
|
count: None,
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
|
|
|
|
binding: 1, // texture2DArray
|
|
|
|
|
|
|
|
visibility: wgpu::ShaderStage::FRAGMENT,
|
|
|
|
|
|
|
|
ty: wgpu::BindingType::Texture {
|
|
|
|
|
|
|
|
multisampled: false,
|
|
|
|
|
|
|
|
sample_type: wgpu::TextureSampleType::Depth,
|
|
|
|
|
|
|
|
view_dimension: wgpu::TextureViewDimension::D2Array,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
count: None,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
|
|
|
|
binding: 2, // samplerShadow
|
|
|
|
|
|
|
|
visibility: wgpu::ShaderStage::FRAGMENT,
|
|
|
|
|
|
|
|
ty: wgpu::BindingType::Sampler {
|
|
|
|
|
|
|
|
filtering: false,
|
|
|
|
|
|
|
|
comparison: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
count: None,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//sudo rm /usr/bin/ld
|
|
|
|
//sudo rm /usr/bin/ld
|
|
|
@ -474,16 +487,14 @@ impl RenderState {
|
|
|
|
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
|
|
|
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
|
|
|
label: Some("g-buffers uniform bind group"),
|
|
|
|
label: Some("g-buffers uniform bind group"),
|
|
|
|
layout: &bind_group_layout,
|
|
|
|
layout: &bind_group_layout,
|
|
|
|
entries: &[
|
|
|
|
entries: &[wgpu::BindGroupEntry {
|
|
|
|
wgpu::BindGroupEntry {
|
|
|
|
binding: 0, // globals
|
|
|
|
binding: 0,
|
|
|
|
|
|
|
|
resource: wgpu::BindingResource::Buffer {
|
|
|
|
resource: wgpu::BindingResource::Buffer {
|
|
|
|
buffer: &uniform_buf,
|
|
|
|
buffer: &uniform_buf,
|
|
|
|
offset: 0,
|
|
|
|
offset: 0,
|
|
|
|
size: wgpu::BufferSize::new(uniform_size),
|
|
|
|
size: wgpu::BufferSize::new(uniform_size),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let vs_module =
|
|
|
|
let vs_module =
|
|
|
@ -529,9 +540,7 @@ impl RenderState {
|
|
|
|
slope_scale: 2.0,
|
|
|
|
slope_scale: 2.0,
|
|
|
|
clamp: 0.0,
|
|
|
|
clamp: 0.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clamp_depth: device.features().contains(
|
|
|
|
clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING),
|
|
|
|
wgpu::Features::DEPTH_CLAMPING
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
multisample: wgpu::MultisampleState::default(),
|
|
|
|
multisample: wgpu::MultisampleState::default(),
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -543,7 +552,6 @@ impl RenderState {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let shadow_pass = {
|
|
|
|
let shadow_pass = {
|
|
|
|
let uniform_size = mem::size_of::<ShadowUniforms>() as wgpu::BufferAddress;
|
|
|
|
let uniform_size = mem::size_of::<ShadowUniforms>() as wgpu::BufferAddress;
|
|
|
|
|
|
|
|
|
|
|
@ -581,16 +589,14 @@ impl RenderState {
|
|
|
|
// Create bind group
|
|
|
|
// Create bind group
|
|
|
|
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
|
|
|
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
|
|
|
layout: &bind_group_layout,
|
|
|
|
layout: &bind_group_layout,
|
|
|
|
entries: &[
|
|
|
|
entries: &[wgpu::BindGroupEntry {
|
|
|
|
wgpu::BindGroupEntry {
|
|
|
|
|
|
|
|
binding: 0,
|
|
|
|
binding: 0,
|
|
|
|
resource: wgpu::BindingResource::Buffer {
|
|
|
|
resource: wgpu::BindingResource::Buffer {
|
|
|
|
buffer: &uniform_buf,
|
|
|
|
buffer: &uniform_buf,
|
|
|
|
offset: 0,
|
|
|
|
offset: 0,
|
|
|
|
size: wgpu::BufferSize::new(uniform_size),
|
|
|
|
size: wgpu::BufferSize::new(uniform_size),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
|
|
|
|
label: Some("Shadow uniform bind group"),
|
|
|
|
label: Some("Shadow uniform bind group"),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -704,7 +710,8 @@ impl RenderState {
|
|
|
|
proj: *mx_projection.as_ref(),
|
|
|
|
proj: *mx_projection.as_ref(),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let g_buffer_camera_projection_uniform = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
|
|
|
let g_buffer_camera_projection_uniform =
|
|
|
|
|
|
|
|
device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
|
|
|
label: Some("g-buffer camera projection uniform buffer"),
|
|
|
|
label: Some("g-buffer camera projection uniform buffer"),
|
|
|
|
contents: bytemuck::bytes_of(&g_buffer_camera_projection_matrix),
|
|
|
|
contents: bytemuck::bytes_of(&g_buffer_camera_projection_matrix),
|
|
|
|
usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
|
|
|
|
usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
|
|
|
@ -712,6 +719,9 @@ impl RenderState {
|
|
|
|
|
|
|
|
|
|
|
|
let forward_pass = {
|
|
|
|
let forward_pass = {
|
|
|
|
// Create pipeline layout
|
|
|
|
// Create pipeline layout
|
|
|
|
|
|
|
|
let forward_uniform_size =
|
|
|
|
|
|
|
|
mem::size_of::<ForwardUniforms>() as wgpu::BufferAddress;
|
|
|
|
|
|
|
|
|
|
|
|
let bind_group_layout =
|
|
|
|
let bind_group_layout =
|
|
|
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
|
|
|
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
|
|
|
entries: &[
|
|
|
|
entries: &[
|
|
|
@ -720,10 +730,7 @@ impl RenderState {
|
|
|
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
|
|
|
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
|
|
|
ty: wgpu::BindingType::Buffer {
|
|
|
|
ty: wgpu::BindingType::Buffer {
|
|
|
|
ty: wgpu::BufferBindingType::Uniform,
|
|
|
|
ty: wgpu::BufferBindingType::Uniform,
|
|
|
|
min_binding_size: wgpu::BufferSize::new(mem::size_of::<
|
|
|
|
min_binding_size: wgpu::BufferSize::new(forward_uniform_size),
|
|
|
|
ForwardUniforms,
|
|
|
|
|
|
|
|
>()
|
|
|
|
|
|
|
|
as _),
|
|
|
|
|
|
|
|
has_dynamic_offset: false,
|
|
|
|
has_dynamic_offset: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
count: None,
|
|
|
|
count: None,
|
|
|
@ -739,7 +746,7 @@ impl RenderState {
|
|
|
|
count: None,
|
|
|
|
count: None,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
binding: 2,
|
|
|
|
binding: 2, // texture2DArray
|
|
|
|
visibility: wgpu::ShaderStage::FRAGMENT,
|
|
|
|
visibility: wgpu::ShaderStage::FRAGMENT,
|
|
|
|
ty: wgpu::BindingType::Texture {
|
|
|
|
ty: wgpu::BindingType::Texture {
|
|
|
|
multisampled: false,
|
|
|
|
multisampled: false,
|
|
|
@ -749,7 +756,7 @@ impl RenderState {
|
|
|
|
count: None,
|
|
|
|
count: None,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
wgpu::BindGroupLayoutEntry {
|
|
|
|
binding: 3,
|
|
|
|
binding: 3, // samplerShadow
|
|
|
|
visibility: wgpu::ShaderStage::FRAGMENT,
|
|
|
|
visibility: wgpu::ShaderStage::FRAGMENT,
|
|
|
|
ty: wgpu::BindingType::Sampler {
|
|
|
|
ty: wgpu::BindingType::Sampler {
|
|
|
|
filtering: false,
|
|
|
|
filtering: false,
|
|
|
@ -903,7 +910,8 @@ impl RenderState {
|
|
|
|
// I need one of these for each of the g-buffer elements I'm calculating
|
|
|
|
// I need one of these for each of the g-buffer elements I'm calculating
|
|
|
|
let mut g_buffer_depth_texture_views = (0..4)
|
|
|
|
let mut g_buffer_depth_texture_views = (0..4)
|
|
|
|
.map(|i| {
|
|
|
|
.map(|i| {
|
|
|
|
Arc::new(g_buffer_depth_texture.create_view(&wgpu::TextureViewDescriptor {
|
|
|
|
Arc::new(
|
|
|
|
|
|
|
|
g_buffer_depth_texture.create_view(&wgpu::TextureViewDescriptor {
|
|
|
|
label: Some("g-buffer depth texture"),
|
|
|
|
label: Some("g-buffer depth texture"),
|
|
|
|
format: None,
|
|
|
|
format: None,
|
|
|
|
dimension: Some(wgpu::TextureViewDimension::D2),
|
|
|
|
dimension: Some(wgpu::TextureViewDimension::D2),
|
|
|
@ -912,12 +920,12 @@ impl RenderState {
|
|
|
|
level_count: None,
|
|
|
|
level_count: None,
|
|
|
|
base_array_layer: i as u32,
|
|
|
|
base_array_layer: i as u32,
|
|
|
|
array_layer_count: NonZeroU32::new(1),
|
|
|
|
array_layer_count: NonZeroU32::new(1),
|
|
|
|
}))
|
|
|
|
}),
|
|
|
|
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let g_buffer_data_texture = device.create_texture(&wgpu::TextureDescriptor {
|
|
|
|
let g_buffer_depth_texture = device.create_texture(&wgpu::TextureDescriptor {
|
|
|
|
|
|
|
|
size: wgpu::Extent3d {
|
|
|
|
size: wgpu::Extent3d {
|
|
|
|
width: sc_desc.width,
|
|
|
|
width: sc_desc.width,
|
|
|
|
height: sc_desc.height,
|
|
|
|
height: sc_desc.height,
|
|
|
@ -932,9 +940,10 @@ impl RenderState {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// I need one of these for each of the g-buffer elements I'm calculating
|
|
|
|
// I need one of these for each of the g-buffer elements I'm calculating
|
|
|
|
let mut g_buffer_depth_texture_views = (0..4)
|
|
|
|
let mut g_buffer_data_texture_views = (0..4)
|
|
|
|
.map(|i| {
|
|
|
|
.map(|i| {
|
|
|
|
Arc::new(g_buffer_depth_texture.create_view(&wgpu::TextureViewDescriptor {
|
|
|
|
Arc::new(
|
|
|
|
|
|
|
|
g_buffer_depth_texture.create_view(&wgpu::TextureViewDescriptor {
|
|
|
|
label: Some("g-buffer depth texture"),
|
|
|
|
label: Some("g-buffer depth texture"),
|
|
|
|
format: None,
|
|
|
|
format: None,
|
|
|
|
dimension: Some(wgpu::TextureViewDimension::D2),
|
|
|
|
dimension: Some(wgpu::TextureViewDimension::D2),
|
|
|
@ -943,7 +952,8 @@ impl RenderState {
|
|
|
|
level_count: None,
|
|
|
|
level_count: None,
|
|
|
|
base_array_layer: i as u32,
|
|
|
|
base_array_layer: i as u32,
|
|
|
|
array_layer_count: NonZeroU32::new(1),
|
|
|
|
array_layer_count: NonZeroU32::new(1),
|
|
|
|
}))
|
|
|
|
}),
|
|
|
|
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
|
|
|
|
|
|
|
@ -958,8 +968,12 @@ impl RenderState {
|
|
|
|
RenderState {
|
|
|
|
RenderState {
|
|
|
|
gbuffer_pass: g_buffer_pass,
|
|
|
|
gbuffer_pass: g_buffer_pass,
|
|
|
|
gbuffer_cam_projection_buffer: g_buffer_camera_projection_uniform,
|
|
|
|
gbuffer_cam_projection_buffer: g_buffer_camera_projection_uniform,
|
|
|
|
gbuffer_depth_texture: g_buffer_depth_texture.create_view(&wgpu::TextureViewDescriptor::default()),
|
|
|
|
gbuffer_depth_texture: g_buffer_depth_texture
|
|
|
|
gbuffer_target_views: g_buffer_depth_texture_views,
|
|
|
|
.create_view(&wgpu::TextureViewDescriptor::default()),
|
|
|
|
|
|
|
|
gbuffer_depth_views: g_buffer_depth_texture_views,
|
|
|
|
|
|
|
|
gbuffer_target_texture: g_buffer_data_texture
|
|
|
|
|
|
|
|
.create_view(&wgpu::TextureViewDescriptor::default()),
|
|
|
|
|
|
|
|
gbuffer_target_views: g_buffer_data_texture_views,
|
|
|
|
|
|
|
|
|
|
|
|
swapchain: swap_chain,
|
|
|
|
swapchain: swap_chain,
|
|
|
|
queue: queue,
|
|
|
|
queue: queue,
|
|
|
@ -968,7 +982,8 @@ impl RenderState {
|
|
|
|
lights_are_dirty: true,
|
|
|
|
lights_are_dirty: true,
|
|
|
|
shadow_pass,
|
|
|
|
shadow_pass,
|
|
|
|
forward_pass,
|
|
|
|
forward_pass,
|
|
|
|
forward_depth: forward_depth_texture.create_view(&wgpu::TextureViewDescriptor::default()),
|
|
|
|
forward_depth: forward_depth_texture
|
|
|
|
|
|
|
|
.create_view(&wgpu::TextureViewDescriptor::default()),
|
|
|
|
entity_bind_group_layout: entity_bind_group_layout,
|
|
|
|
entity_bind_group_layout: entity_bind_group_layout,
|
|
|
|
shadow_target_views: shadow_target_views,
|
|
|
|
shadow_target_views: shadow_target_views,
|
|
|
|
light_uniform_buf,
|
|
|
|
light_uniform_buf,
|
|
|
|