migrated tutorial3

0.10
Ben Hansen 3 years ago
parent 012dff0de0
commit 0f618a2ff8

@ -97,7 +97,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -109,7 +110,7 @@ impl State {
let _render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(self.clear_color),

@ -56,7 +56,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -84,7 +83,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -109,7 +108,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Challenge Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("challenge.wgsl").into()),
});
@ -128,7 +126,7 @@ impl State {
targets: &[wgpu::ColorTargetState {
format: config.format,
blend: Some(wgpu::BlendState::REPLACE),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -155,7 +153,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
challenge_render_pipeline,
use_color,
@ -193,7 +190,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -205,7 +203,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -55,7 +55,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -83,7 +82,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -112,7 +111,6 @@ impl State {
queue,
size,
config,
swap_chain,
render_pipeline,
}
}
@ -134,7 +132,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -146,7 +145,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -119,7 +119,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -147,7 +146,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -220,7 +219,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
vertex_buffer,
index_buffer,
@ -263,7 +261,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -275,7 +274,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -112,7 +112,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -140,7 +139,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -180,7 +179,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,
@ -206,7 +204,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -218,7 +217,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -185,7 +185,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -213,7 +212,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -253,7 +252,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
vertex_buffer,
index_buffer,
@ -297,7 +295,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -309,7 +308,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -162,7 +162,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -190,7 +189,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -230,7 +229,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,
@ -258,7 +256,8 @@ impl State {
fn update(&mut self) {}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -270,7 +269,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -372,7 +372,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -400,7 +399,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -440,7 +439,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
vertex_buffer,
index_buffer,
@ -485,7 +483,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -497,7 +496,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -356,7 +356,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -384,7 +383,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -424,7 +423,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,
@ -466,7 +464,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -478,7 +477,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -485,7 +485,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -513,7 +512,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -553,7 +552,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
vertex_buffer,
index_buffer,
@ -613,7 +611,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -625,7 +624,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -449,7 +449,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -477,7 +476,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -517,7 +516,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,
@ -562,7 +560,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -574,7 +573,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -370,7 +370,6 @@ impl DepthPass {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shadow Display Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("challenge.wgsl").into()),
});
@ -391,7 +390,7 @@ impl DepthPass {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -447,7 +446,7 @@ impl DepthPass {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Depth Visual Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Load,
@ -647,7 +646,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -675,7 +673,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -727,7 +725,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
vertex_buffer,
index_buffer,
@ -773,7 +770,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -785,7 +783,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -459,7 +459,6 @@ impl State {
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
flags: wgpu::ShaderFlags::all(),
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
});
@ -490,7 +489,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -536,7 +535,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,
@ -586,7 +584,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -598,7 +597,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -420,7 +420,7 @@ impl State {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -454,7 +454,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
obj_model,
@ -498,7 +497,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -510,7 +510,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -299,7 +299,7 @@ fn create_render_pipeline(
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -568,7 +568,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
obj_model,
camera,
@ -629,7 +628,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -641,7 +641,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -300,7 +300,7 @@ fn create_render_pipeline(
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -619,7 +619,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
obj_model,
camera,
@ -682,7 +681,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -694,7 +694,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -180,7 +180,7 @@ fn create_render_pipeline(
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -495,7 +495,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
obj_model,
camera,
@ -589,7 +588,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -601,7 +601,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -179,7 +179,7 @@ fn create_render_pipeline(
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {
@ -494,7 +494,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
obj_model,
camera,
@ -584,7 +583,8 @@ impl State {
}
fn render(&mut self) -> Result<(), wgpu::SurfaceError> {
let frame = self.surface.get_current_frame()?.output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let output = self.surface.get_current_frame()?.output;
let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
let mut encoder = self
.device
@ -596,7 +596,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -420,7 +420,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
obj_model,
camera,
@ -534,7 +533,7 @@ impl State {
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

@ -62,7 +62,7 @@ pub fn create_render_pipeline(
targets: &[wgpu::ColorTargetState {
format: color_format,
blend: None,
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

@ -68,7 +68,6 @@ impl Display {
surface,
window,
config,
swap_chain,
device,
queue,
})

@ -103,7 +103,7 @@ impl<'a> RenderPipelineBuilder<'a> {
self.color_state(wgpu::ColorTargetState {
format,
blend: None,
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
})
}

@ -219,7 +219,7 @@ impl<'a> ShaderCanvasBuilder<'a> {
color: wgpu::BlendComponent::REPLACE,
alpha: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

@ -190,7 +190,7 @@ fn create_render_pipeline(
targets: &[wgpu::ColorTargetState {
format: target.desc.format,
blend: Some(wgpu::BlendState::REPLACE),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

@ -110,7 +110,6 @@ impl Render {
device,
queue,
config,
swap_chain,
pipeline,
vertex_buffer,
index_buffer,
@ -256,7 +255,7 @@ fn create_render_pipeline(
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

@ -102,7 +102,7 @@ async fn run() {
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

@ -175,7 +175,7 @@ let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescrip
targets: &[wgpu::ColorTargetState { // 4.
format: config.format,
blend: Some(wgpu::BlendState::REPLACE),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
// continued ...
@ -184,8 +184,8 @@ let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescrip
Two things to note here:
1. Here you can specify which function inside of the shader should be called, which is known as the `entry_point`. These are the functions we marked with `[[stage(vertex)]]` and `[[stage(fragment)]]`
2. The `buffers` field tells `wgpu` what type of vertices we want to pass to the vertex shader. We're specifying the vertices in the vertex shader itself so we'll leave this empty. We'll put something there in the next tutorial.
3. The `fragment` is technically optional, so you have to wrap it in `Some()`. We need it if we want to store color data to the `swap_chain`.
4. The `targets` field tells `wgpu` what color outputs it should set up.Currently we only need one for the `swap_chain`. We use the `swap_chain`'s format so that copying to it is easy, and we specify that the blending should just replace old pixel data with new data. We also tell `wgpu` to write to all colors: red, blue, green, and alpha. *We'll talk more about*`color_state` *when we talk about textures.*
3. The `fragment` is technically optional, so you have to wrap it in `Some()`. We need it if we want to store color data to the `surface`.
4. The `targets` field tells `wgpu` what color outputs it should set up.Currently we only need one for the `surface`. We use the `surface`'s format so that copying to it is easy, and we specify that the blending should just replace old pixel data with new data. We also tell `wgpu` to write to all colors: red, blue, green, and alpha. *We'll talk more about*`color_state` *when we talk about textures.*
```rust
primitive: wgpu::PrimitiveState {
@ -235,7 +235,6 @@ Self {
device,
queue,
config,
swap_chain,
size,
// NEW!
render_pipeline,
@ -256,7 +255,7 @@ If you run your program now, it'll take a little longer to start, but it will st
color_attachments: &[
// This is what [[location(0)]] in the fragment shader targets
wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(

@ -106,7 +106,6 @@ Self {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,
@ -242,7 +241,6 @@ impl State {
device,
queue,
config,
swap_chain,
render_pipeline,
vertex_buffer,
num_vertices,
@ -389,7 +387,6 @@ Self {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,

@ -249,7 +249,6 @@ impl State {
device,
queue,
config,
swap_chain,
size,
render_pipeline,
vertex_buffer,

@ -137,7 +137,7 @@ fn create_render_pipeline(
alpha: wgpu::BlendComponent::REPLACE,
color: wgpu::BlendComponent::REPLACE,
}),
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

@ -118,7 +118,7 @@ if self.last_cursor != ui.mouse_cursor() {
let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("UI RenderPass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame,
view: &view,
attachment: &output.view,
resolve_target: None,
ops: wgpu::Operations {

@ -152,7 +152,7 @@ let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescrip
format: texture_desc.format,
alpha_blend: wgpu::BlendState::REPLACE,
color_blend: wgpu::BlendState::REPLACE,
write_mask: wgpu::ColorWrite::ALL,
write_mask: wgpu::ColorWrites::ALL,
}],
}),
primitive: wgpu::PrimitiveState {

Loading…
Cancel
Save