Skip to content

Commit

Permalink
Fix mesh2_manual exapmle. (bevyengine#14831)
Browse files Browse the repository at this point in the history
Fix `mesh2d_manual` example from changes in bevyengine#13069.

```
wgpu error: Validation Error

Caused by:
  In RenderPass::end
    In a set_pipeline command
      Render pipeline targets are incompatible with render pass
        Incompatible depth-stencil attachment format: the RenderPass uses a texture with format Some(Depth32Float) but the RenderPipeline with 'colored_mesh2d_pipeline' label uses an attachment with format None
```
  • Loading branch information
tychedelia committed Aug 20, 2024
1 parent 491aec8 commit 99ab028
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions examples/2d/mesh2d_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use bevy::{
color::palettes::basic::YELLOW,
core_pipeline::core_2d::Transparent2d,
core_pipeline::core_2d::{Transparent2d, CORE_2D_DEPTH_FORMAT},
math::FloatOrd,
prelude::*,
render::{
Expand All @@ -18,9 +18,10 @@ use bevy::{
ViewSortedRenderPhases,
},
render_resource::{
BlendState, ColorTargetState, ColorWrites, Face, FragmentState, FrontFace,
MultisampleState, PipelineCache, PolygonMode, PrimitiveState, PrimitiveTopology,
RenderPipelineDescriptor, SpecializedRenderPipeline, SpecializedRenderPipelines,
BlendState, ColorTargetState, ColorWrites, CompareFunction, DepthBiasState,
DepthStencilState, Face, FragmentState, FrontFace, MultisampleState, PipelineCache,
PolygonMode, PrimitiveState, PrimitiveTopology, RenderPipelineDescriptor,
SpecializedRenderPipeline, SpecializedRenderPipelines, StencilFaceState, StencilState,
TextureFormat, VertexBufferLayout, VertexFormat, VertexState, VertexStepMode,
},
texture::BevyDefault,
Expand Down Expand Up @@ -198,7 +199,22 @@ impl SpecializedRenderPipeline for ColoredMesh2dPipeline {
topology: key.primitive_topology(),
strip_index_format: None,
},
depth_stencil: None,
depth_stencil: Some(DepthStencilState {
format: CORE_2D_DEPTH_FORMAT,
depth_write_enabled: false,
depth_compare: CompareFunction::GreaterEqual,
stencil: StencilState {
front: StencilFaceState::IGNORE,
back: StencilFaceState::IGNORE,
read_mask: 0,
write_mask: 0,
},
bias: DepthBiasState {
constant: 0,
slope_scale: 0.0,
clamp: 0.0,
},
}),
multisample: MultisampleState {
count: key.msaa_samples(),
mask: !0,
Expand Down

0 comments on commit 99ab028

Please sign in to comment.