upgrade wgpu
This commit is contained in:
parent
fd219660d3
commit
2ca6de2b81
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
pass::{
|
pass::{
|
||||||
LoadOp, PassDescriptor, RenderPassColorAttachmentDescriptor,
|
LoadOp, Operations, PassDescriptor, RenderPassColorAttachmentDescriptor,
|
||||||
RenderPassDepthStencilAttachmentDescriptor, StoreOp, TextureAttachment,
|
RenderPassDepthStencilAttachmentDescriptor, TextureAttachment,
|
||||||
},
|
},
|
||||||
render_graph::{
|
render_graph::{
|
||||||
nodes::{
|
nodes::{
|
||||||
@ -96,20 +96,18 @@ impl BaseRenderGraphBuilder for RenderGraph {
|
|||||||
color_attachments: vec![RenderPassColorAttachmentDescriptor {
|
color_attachments: vec![RenderPassColorAttachmentDescriptor {
|
||||||
attachment: TextureAttachment::Input("color".to_string()),
|
attachment: TextureAttachment::Input("color".to_string()),
|
||||||
resolve_target: None,
|
resolve_target: None,
|
||||||
load_op: LoadOp::Clear,
|
ops: Operations {
|
||||||
store_op: StoreOp::Store,
|
load: LoadOp::Clear(Color::rgb(0.1, 0.1, 0.1)),
|
||||||
clear_color: Color::rgb(0.1, 0.1, 0.1),
|
store: true,
|
||||||
|
},
|
||||||
}],
|
}],
|
||||||
depth_stencil_attachment: Some(RenderPassDepthStencilAttachmentDescriptor {
|
depth_stencil_attachment: Some(RenderPassDepthStencilAttachmentDescriptor {
|
||||||
attachment: TextureAttachment::Input("depth".to_string()),
|
attachment: TextureAttachment::Input("depth".to_string()),
|
||||||
depth_load_op: LoadOp::Clear,
|
depth_ops: Some(Operations {
|
||||||
depth_store_op: StoreOp::Store,
|
load: LoadOp::Clear(1.0),
|
||||||
stencil_load_op: LoadOp::Clear,
|
store: true,
|
||||||
stencil_store_op: StoreOp::Store,
|
}),
|
||||||
stencil_read_only: false,
|
stencil_ops: None,
|
||||||
depth_read_only: false,
|
|
||||||
clear_depth: 1.0,
|
|
||||||
clear_stencil: 0,
|
|
||||||
}),
|
}),
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
});
|
});
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
#[repr(C)]
|
/// Operation to perform to the output attachment at the start of a renderpass.
|
||||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Hash, PartialEq)]
|
||||||
pub enum LoadOp {
|
pub enum LoadOp<V> {
|
||||||
Clear = 0,
|
/// Clear with a specified value.
|
||||||
Load = 1,
|
Clear(V),
|
||||||
|
/// Load from memory.
|
||||||
|
Load,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
/// Pair of load and store operations for an attachment aspect.
|
||||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Clone, Debug, Hash, PartialEq)]
|
||||||
pub enum StoreOp {
|
pub struct Operations<V> {
|
||||||
Clear = 0,
|
/// How data should be read through this attachment.
|
||||||
Store = 1,
|
pub load: LoadOp<V>,
|
||||||
}
|
/// Whether data will be written to through this attachment.
|
||||||
|
pub store: bool,
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
use super::{LoadOp, StoreOp};
|
use super::Operations;
|
||||||
use crate::{render_resource::TextureId, Color};
|
use crate::{render_resource::TextureId, Color};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -35,27 +35,17 @@ pub struct RenderPassColorAttachmentDescriptor {
|
|||||||
/// The resolve target for this color attachment, if any.
|
/// The resolve target for this color attachment, if any.
|
||||||
pub resolve_target: Option<TextureAttachment>,
|
pub resolve_target: Option<TextureAttachment>,
|
||||||
|
|
||||||
/// The beginning-of-pass load operation for this color attachment.
|
/// What operations will be performed on this color attachment.
|
||||||
pub load_op: LoadOp,
|
pub ops: Operations<Color>,
|
||||||
|
|
||||||
/// The end-of-pass store operation for this color attachment.
|
|
||||||
pub store_op: StoreOp,
|
|
||||||
|
|
||||||
/// The color that will be assigned to every pixel of this attachment when cleared.
|
|
||||||
pub clear_color: Color,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct RenderPassDepthStencilAttachmentDescriptor {
|
pub struct RenderPassDepthStencilAttachmentDescriptor {
|
||||||
pub attachment: TextureAttachment,
|
pub attachment: TextureAttachment,
|
||||||
pub depth_load_op: LoadOp,
|
/// What operations will be performed on the depth part of the attachment.
|
||||||
pub depth_store_op: StoreOp,
|
pub depth_ops: Option<Operations<f32>>,
|
||||||
pub clear_depth: f32,
|
/// What operations will be performed on the stencil part of the attachment.
|
||||||
pub stencil_load_op: LoadOp,
|
pub stencil_ops: Option<Operations<u32>>,
|
||||||
pub stencil_store_op: StoreOp,
|
|
||||||
pub depth_read_only: bool,
|
|
||||||
pub stencil_read_only: bool,
|
|
||||||
pub clear_stencil: u32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A set of pipeline bindings and draw calls with color and depth outputs
|
// A set of pipeline bindings and draw calls with color and depth outputs
|
||||||
|
@ -29,7 +29,6 @@ pub enum BindType {
|
|||||||
},
|
},
|
||||||
StorageTexture {
|
StorageTexture {
|
||||||
dimension: TextureViewDimension,
|
dimension: TextureViewDimension,
|
||||||
component_type: TextureComponentType,
|
|
||||||
format: TextureFormat,
|
format: TextureFormat,
|
||||||
readonly: bool,
|
readonly: bool,
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
draw::{Draw, RenderCommand},
|
draw::{Draw, RenderCommand},
|
||||||
pass::{ClearColor, PassDescriptor, TextureAttachment},
|
pass::{ClearColor, PassDescriptor, TextureAttachment, LoadOp},
|
||||||
pipeline::{
|
pipeline::{
|
||||||
BindGroupDescriptor, BindType, BindingDescriptor, PipelineDescriptor, UniformProperty,
|
BindGroupDescriptor, BindType, BindingDescriptor, PipelineDescriptor, UniformProperty,
|
||||||
},
|
},
|
||||||
@ -111,7 +111,7 @@ impl Node for PassNode {
|
|||||||
for (i, color_attachment) in self.descriptor.color_attachments.iter_mut().enumerate() {
|
for (i, color_attachment) in self.descriptor.color_attachments.iter_mut().enumerate() {
|
||||||
if self.default_clear_color_inputs.contains(&i) {
|
if self.default_clear_color_inputs.contains(&i) {
|
||||||
if let Ok(default_clear_color) = resources.get::<ClearColor>() {
|
if let Ok(default_clear_color) = resources.get::<ClearColor>() {
|
||||||
color_attachment.clear_color = default_clear_color.0;
|
color_attachment.ops.load = LoadOp::Clear(default_clear_color.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(input_index) = self.color_attachment_input_indices[i] {
|
if let Some(input_index) = self.color_attachment_input_indices[i] {
|
||||||
|
@ -24,9 +24,9 @@ impl Default for SamplerDescriptor {
|
|||||||
mag_filter: FilterMode::Nearest,
|
mag_filter: FilterMode::Nearest,
|
||||||
min_filter: FilterMode::Linear,
|
min_filter: FilterMode::Linear,
|
||||||
mipmap_filter: FilterMode::Nearest,
|
mipmap_filter: FilterMode::Nearest,
|
||||||
lod_min_clamp: -100.0,
|
lod_min_clamp: 0.0,
|
||||||
lod_max_clamp: 100.0,
|
lod_max_clamp: std::f32::MAX,
|
||||||
compare_function: Some(CompareFunction::Always),
|
compare_function: None,
|
||||||
anisotropy_clamp: None,
|
anisotropy_clamp: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,9 +41,9 @@ impl From<&Texture> for SamplerDescriptor {
|
|||||||
mag_filter: FilterMode::Nearest,
|
mag_filter: FilterMode::Nearest,
|
||||||
min_filter: FilterMode::Linear,
|
min_filter: FilterMode::Linear,
|
||||||
mipmap_filter: FilterMode::Nearest,
|
mipmap_filter: FilterMode::Nearest,
|
||||||
lod_min_clamp: -100.0,
|
lod_min_clamp: 0.0,
|
||||||
lod_max_clamp: 100.0,
|
lod_max_clamp: std::f32::MAX,
|
||||||
compare_function: Some(CompareFunction::Always),
|
compare_function: None,
|
||||||
anisotropy_clamp: None,
|
anisotropy_clamp: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ bevy_window = { path = "../bevy_window" }
|
|||||||
bevy_winit = { path = "../bevy_winit", optional = true }
|
bevy_winit = { path = "../bevy_winit", optional = true }
|
||||||
|
|
||||||
# render
|
# render
|
||||||
wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "7b866b1a1b72d4ecb7a63e11fbc8f521fe9eb363" }
|
wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "344161feae78b077dc28089cf8daa8ce80277eb9" }
|
||||||
# wgpu = { version = "0.5.0" }
|
# wgpu = { version = "0.5.0" }
|
||||||
|
|
||||||
pollster = "0.2.0"
|
pollster = "0.2.0"
|
||||||
|
@ -209,9 +209,7 @@ fn create_wgpu_color_attachment_descriptor<'a>(
|
|||||||
.map(|target| get_texture_view(global_render_resource_bindings, refs, &target));
|
.map(|target| get_texture_view(global_render_resource_bindings, refs, &target));
|
||||||
|
|
||||||
wgpu::RenderPassColorAttachmentDescriptor {
|
wgpu::RenderPassColorAttachmentDescriptor {
|
||||||
store_op: color_attachment_descriptor.store_op.wgpu_into(),
|
ops: (&color_attachment_descriptor.ops).wgpu_into(),
|
||||||
load_op: color_attachment_descriptor.load_op.wgpu_into(),
|
|
||||||
clear_color: color_attachment_descriptor.clear_color.wgpu_into(),
|
|
||||||
attachment,
|
attachment,
|
||||||
resolve_target,
|
resolve_target,
|
||||||
}
|
}
|
||||||
@ -230,21 +228,7 @@ fn create_wgpu_depth_stencil_attachment_descriptor<'a>(
|
|||||||
|
|
||||||
wgpu::RenderPassDepthStencilAttachmentDescriptor {
|
wgpu::RenderPassDepthStencilAttachmentDescriptor {
|
||||||
attachment,
|
attachment,
|
||||||
clear_depth: depth_stencil_attachment_descriptor.clear_depth,
|
depth_ops: depth_stencil_attachment_descriptor.depth_ops.as_ref().map(|ops| ops.wgpu_into()),
|
||||||
clear_stencil: depth_stencil_attachment_descriptor.clear_stencil,
|
stencil_ops: depth_stencil_attachment_descriptor.stencil_ops.as_ref().map(|ops| ops.wgpu_into()),
|
||||||
depth_load_op: depth_stencil_attachment_descriptor
|
|
||||||
.depth_load_op
|
|
||||||
.wgpu_into(),
|
|
||||||
depth_store_op: depth_stencil_attachment_descriptor
|
|
||||||
.depth_store_op
|
|
||||||
.wgpu_into(),
|
|
||||||
stencil_load_op: depth_stencil_attachment_descriptor
|
|
||||||
.stencil_load_op
|
|
||||||
.wgpu_into(),
|
|
||||||
stencil_store_op: depth_stencil_attachment_descriptor
|
|
||||||
.stencil_store_op
|
|
||||||
.wgpu_into(),
|
|
||||||
depth_read_only: depth_stencil_attachment_descriptor.depth_read_only,
|
|
||||||
stencil_read_only: depth_stencil_attachment_descriptor.stencil_read_only,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,10 +113,12 @@ impl WgpuRenderResourceContext {
|
|||||||
let bind_group_layout_binding = descriptor
|
let bind_group_layout_binding = descriptor
|
||||||
.bindings
|
.bindings
|
||||||
.iter()
|
.iter()
|
||||||
.map(|binding| wgpu::BindGroupLayoutEntry {
|
.map(|binding| {
|
||||||
binding: binding.index,
|
wgpu::BindGroupLayoutEntry::new(
|
||||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
binding.index,
|
||||||
ty: (&binding.bind_type).wgpu_into(),
|
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||||
|
(&binding.bind_type).wgpu_into(),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.collect::<Vec<wgpu::BindGroupLayoutEntry>>();
|
.collect::<Vec<wgpu::BindGroupLayoutEntry>>();
|
||||||
let wgpu_descriptor = wgpu::BindGroupLayoutDescriptor {
|
let wgpu_descriptor = wgpu::BindGroupLayoutDescriptor {
|
||||||
@ -186,12 +188,12 @@ impl RenderResourceContext for WgpuRenderResourceContext {
|
|||||||
label: None,
|
label: None,
|
||||||
mapped_at_creation: false,
|
mapped_at_creation: false,
|
||||||
});
|
});
|
||||||
|
let buffer_slice = buffer.slice(..);
|
||||||
let data = buffer.map_async(wgpu::MapMode::Write, 0, wgpu::BufferSize::WHOLE);
|
let data = buffer_slice.map_async(wgpu::MapMode::Write);
|
||||||
self.device.poll(wgpu::Maintain::Wait);
|
self.device.poll(wgpu::Maintain::Wait);
|
||||||
if let Ok(()) = pollster::block_on(data) {
|
if let Ok(()) = pollster::block_on(data) {
|
||||||
let data = buffer.get_mapped_range_mut(0, wgpu::BufferSize::WHOLE);
|
let mut data = buffer_slice.get_mapped_range_mut();
|
||||||
setup_data(data, self);
|
setup_data(&mut data, self);
|
||||||
} else {
|
} else {
|
||||||
panic!("failed to map buffer to host");
|
panic!("failed to map buffer to host");
|
||||||
}
|
}
|
||||||
@ -246,7 +248,9 @@ impl RenderResourceContext for WgpuRenderResourceContext {
|
|||||||
|
|
||||||
fn create_shader_module_from_source(&self, shader_handle: Handle<Shader>, shader: &Shader) {
|
fn create_shader_module_from_source(&self, shader_handle: Handle<Shader>, shader: &Shader) {
|
||||||
let mut shader_modules = self.resources.shader_modules.write().unwrap();
|
let mut shader_modules = self.resources.shader_modules.write().unwrap();
|
||||||
let shader_module = self.device.create_shader_module(&shader.get_spirv(None));
|
let shader_module = self
|
||||||
|
.device
|
||||||
|
.create_shader_module(wgpu::ShaderModuleSource::SpirV(&shader.get_spirv(None)));
|
||||||
shader_modules.insert(shader_handle, shader_module);
|
shader_modules.insert(shader_handle, shader_module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,23 +18,19 @@ pub struct WgpuRenderer {
|
|||||||
|
|
||||||
impl WgpuRenderer {
|
impl WgpuRenderer {
|
||||||
pub async fn new() -> Self {
|
pub async fn new() -> Self {
|
||||||
let instance = wgpu::Instance::new();
|
let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY);
|
||||||
let adapter = instance
|
let adapter = instance
|
||||||
.request_adapter(
|
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||||
&wgpu::RequestAdapterOptions {
|
power_preference: wgpu::PowerPreference::Default,
|
||||||
power_preference: wgpu::PowerPreference::Default,
|
compatible_surface: None,
|
||||||
compatible_surface: None,
|
})
|
||||||
},
|
|
||||||
wgpu::UnsafeExtensions::disallow(),
|
|
||||||
wgpu::BackendBit::PRIMARY,
|
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let (device, queue) = adapter
|
let (device, queue) = adapter
|
||||||
.request_device(
|
.request_device(
|
||||||
&wgpu::DeviceDescriptor {
|
&wgpu::DeviceDescriptor {
|
||||||
extensions: wgpu::Extensions::empty(),
|
features: wgpu::Features::empty(),
|
||||||
limits: wgpu::Limits::default(),
|
limits: wgpu::Limits::default(),
|
||||||
shader_validation: true,
|
shader_validation: true,
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
pass::{LoadOp, StoreOp},
|
pass::{LoadOp, Operations},
|
||||||
pipeline::{
|
pipeline::{
|
||||||
state_descriptors::{
|
state_descriptors::{
|
||||||
BlendDescriptor, BlendFactor, BlendOperation, ColorStateDescriptor, ColorWrite,
|
BlendDescriptor, BlendFactor, BlendOperation, ColorStateDescriptor, ColorWrite,
|
||||||
@ -140,20 +140,41 @@ impl WgpuFrom<BufferUsage> for wgpu::BufferUsage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WgpuFrom<LoadOp> for wgpu::LoadOp {
|
impl WgpuFrom<&LoadOp<Color>> for wgpu::LoadOp<wgpu::Color> {
|
||||||
fn from(val: LoadOp) -> Self {
|
fn from(val: &LoadOp<Color>) -> Self {
|
||||||
match val {
|
match val {
|
||||||
LoadOp::Clear => wgpu::LoadOp::Clear,
|
LoadOp::Clear(value) => wgpu::LoadOp::Clear(value.clone().wgpu_into()),
|
||||||
LoadOp::Load => wgpu::LoadOp::Load,
|
LoadOp::Load => wgpu::LoadOp::Load,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WgpuFrom<StoreOp> for wgpu::StoreOp {
|
impl WgpuFrom<&LoadOp<f32>> for wgpu::LoadOp<f32> {
|
||||||
fn from(val: StoreOp) -> Self {
|
fn from(val: &LoadOp<f32>) -> Self {
|
||||||
match val {
|
match val {
|
||||||
StoreOp::Clear => wgpu::StoreOp::Clear,
|
LoadOp::Clear(value) => wgpu::LoadOp::Clear(*value),
|
||||||
StoreOp::Store => wgpu::StoreOp::Store,
|
LoadOp::Load => wgpu::LoadOp::Load,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WgpuFrom<&LoadOp<u32>> for wgpu::LoadOp<u32> {
|
||||||
|
fn from(val: &LoadOp<u32>) -> Self {
|
||||||
|
match val {
|
||||||
|
LoadOp::Clear(value) => wgpu::LoadOp::Clear(*value),
|
||||||
|
LoadOp::Load => wgpu::LoadOp::Load,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, T, U> WgpuFrom<&'a Operations<T>> for wgpu::Operations<U>
|
||||||
|
where
|
||||||
|
wgpu::LoadOp<U>: WgpuFrom<&'a LoadOp<T>>,
|
||||||
|
{
|
||||||
|
fn from(val: &'a Operations<T>) -> Self {
|
||||||
|
Self {
|
||||||
|
load: (&val.load).wgpu_into(),
|
||||||
|
store: val.store,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,11 +184,19 @@ impl WgpuFrom<&BindType> for wgpu::BindingType {
|
|||||||
match bind_type {
|
match bind_type {
|
||||||
BindType::Uniform {
|
BindType::Uniform {
|
||||||
dynamic,
|
dynamic,
|
||||||
properties: _,
|
properties: _properties,
|
||||||
} => wgpu::BindingType::UniformBuffer { dynamic: *dynamic },
|
} => wgpu::BindingType::UniformBuffer {
|
||||||
|
dynamic: *dynamic,
|
||||||
|
min_binding_size: bind_type
|
||||||
|
.get_uniform_size()
|
||||||
|
.and_then(|size| wgpu::BufferSize::new(size)),
|
||||||
|
},
|
||||||
BindType::StorageBuffer { dynamic, readonly } => wgpu::BindingType::StorageBuffer {
|
BindType::StorageBuffer { dynamic, readonly } => wgpu::BindingType::StorageBuffer {
|
||||||
dynamic: *dynamic,
|
dynamic: *dynamic,
|
||||||
readonly: *readonly,
|
readonly: *readonly,
|
||||||
|
min_binding_size: bind_type
|
||||||
|
.get_uniform_size()
|
||||||
|
.and_then(|size| wgpu::BufferSize::new(size)),
|
||||||
},
|
},
|
||||||
BindType::SampledTexture {
|
BindType::SampledTexture {
|
||||||
dimension,
|
dimension,
|
||||||
@ -183,12 +212,10 @@ impl WgpuFrom<&BindType> for wgpu::BindingType {
|
|||||||
},
|
},
|
||||||
BindType::StorageTexture {
|
BindType::StorageTexture {
|
||||||
dimension,
|
dimension,
|
||||||
component_type,
|
|
||||||
format,
|
format,
|
||||||
readonly,
|
readonly,
|
||||||
} => wgpu::BindingType::StorageTexture {
|
} => wgpu::BindingType::StorageTexture {
|
||||||
dimension: (*dimension).wgpu_into(),
|
dimension: (*dimension).wgpu_into(),
|
||||||
component_type: (*component_type).wgpu_into(),
|
|
||||||
format: (*format).wgpu_into(),
|
format: (*format).wgpu_into(),
|
||||||
readonly: *readonly,
|
readonly: *readonly,
|
||||||
},
|
},
|
||||||
|
@ -3,13 +3,14 @@ use bevy::{
|
|||||||
render::{
|
render::{
|
||||||
pass::{
|
pass::{
|
||||||
LoadOp, PassDescriptor, RenderPassColorAttachmentDescriptor,
|
LoadOp, PassDescriptor, RenderPassColorAttachmentDescriptor,
|
||||||
RenderPassDepthStencilAttachmentDescriptor, StoreOp, TextureAttachment,
|
RenderPassDepthStencilAttachmentDescriptor, TextureAttachment,
|
||||||
},
|
},
|
||||||
texture::{TextureDescriptor, TextureFormat, TextureUsage},
|
texture::{TextureDescriptor, TextureFormat, TextureUsage},
|
||||||
ActiveCameras,
|
ActiveCameras,
|
||||||
},
|
},
|
||||||
window::{CreateWindow, WindowId, WindowReference},
|
window::{CreateWindow, WindowId, WindowReference},
|
||||||
};
|
};
|
||||||
|
use bevy_render::pass::Operations;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::build()
|
App::build()
|
||||||
@ -68,20 +69,18 @@ fn setup(
|
|||||||
color_attachments: vec![RenderPassColorAttachmentDescriptor {
|
color_attachments: vec![RenderPassColorAttachmentDescriptor {
|
||||||
attachment: TextureAttachment::Input("color".to_string()),
|
attachment: TextureAttachment::Input("color".to_string()),
|
||||||
resolve_target: None,
|
resolve_target: None,
|
||||||
load_op: LoadOp::Clear,
|
ops: Operations {
|
||||||
store_op: StoreOp::Store,
|
load: LoadOp::Clear(Color::rgb(0.1, 0.1, 0.1)),
|
||||||
clear_color: Color::rgb(0.1, 0.1, 0.1),
|
store: true,
|
||||||
|
},
|
||||||
}],
|
}],
|
||||||
depth_stencil_attachment: Some(RenderPassDepthStencilAttachmentDescriptor {
|
depth_stencil_attachment: Some(RenderPassDepthStencilAttachmentDescriptor {
|
||||||
attachment: TextureAttachment::Input("depth".to_string()),
|
attachment: TextureAttachment::Input("depth".to_string()),
|
||||||
depth_load_op: LoadOp::Clear,
|
depth_ops: Some(Operations {
|
||||||
depth_store_op: StoreOp::Store,
|
load: LoadOp::Clear(1.0),
|
||||||
stencil_load_op: LoadOp::Clear,
|
store: true,
|
||||||
stencil_store_op: StoreOp::Store,
|
}),
|
||||||
stencil_read_only: false,
|
stencil_ops: None,
|
||||||
depth_read_only: false,
|
|
||||||
clear_depth: 1.0,
|
|
||||||
clear_stencil: 0,
|
|
||||||
}),
|
}),
|
||||||
sample_count: 1,
|
sample_count: 1,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user