Merge pull request #181 from al-tameemi/e6029cb

Updated the use of RenderPassColorAttachmentDescriptor to RenderPassColorAttachment
pull/186/head
sotrh 3 years ago committed by GitHub
commit dd7d48929f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -262,8 +262,8 @@ Now we can actually get to clearing the screen (long time coming). We need to us
let _render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[
wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.view,
wgpu::RenderPassColorAttachment {
view: &frame.view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {
@ -343,8 +343,8 @@ Some of you may be able to tell what's going on just by looking at it, but I'd b
A `RenderPassDescriptor` only has three fields: `label`, `color_attachments` and `depth_stencil_attachment`. The `color_attachements` describe where we are going to draw our color to. We'll use `depth_stencil_attachment` later, but we'll set it to `None` for now.
```rust
wgpu::RenderPassColorAttachmentDescriptor {
attachment: &frame.view,
wgpu::RenderPassColorAttachment {
view: &frame.view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {
@ -358,7 +358,7 @@ wgpu::RenderPassColorAttachmentDescriptor {
}
```
The `RenderPassColorAttachmentDescriptor` has the `attachment` field which informs `wgpu` what texture to save the colors to. In this case we specify `frame.view` that we created using `swap_chain.get_current_frame()`. This means that any colors we draw to this attachment will get drawn to the screen.
The `RenderPassColorAttachment` has the `view` field which informs `wgpu` what texture to save the colors to. In this case we specify `frame.view` that we created using `swap_chain.get_current_frame()`. This means that any colors we draw to this attachment will get drawn to the screen.
The `resolve_target` is the texture that will receive the resolved output. This will be the same as `attachment` unless multisampling is enabled. We don't need to specify this, so we leave it as `None`.

@ -254,7 +254,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 {
attachment: &frame.view,
view: &frame.view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(

@ -100,8 +100,8 @@ for c in &colors {
let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("GIF Pass"),
color_attachments: &[
wgpu::RenderPassColorAttachmentDescriptor {
attachment: &render_target.view,
wgpu::RenderPassColorAttachment {
view: &render_target.view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(

@ -187,8 +187,8 @@ The `RenderPass` is where things get interesting. A render pass requires at leas
let render_pass_desc = wgpu::RenderPassDescriptor {
label: Some("Render Pass"),
color_attachments: &[
wgpu::RenderPassColorAttachmentDescriptor {
attachment: &texture_view,
wgpu::RenderPassColorAttachment {
view: &texture_view,
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color {

Loading…
Cancel
Save