Do not panic if specialising mesh pipeline fails (#23)
--------- Co-authored-by: Arjo Chakravarty <arjoc@google.com>
This commit is contained in:
parent
ae5c331450
commit
84ae12953f
26
src/draw.rs
26
src/draw.rs
@ -70,17 +70,20 @@ pub(crate) fn queue_outline_stencil_mesh(
|
|||||||
if stencil_flags.depth_mode == DepthMode::Invalid {
|
if stencil_flags.depth_mode == DepthMode::Invalid {
|
||||||
continue; // DepthMode not propagated
|
continue; // DepthMode not propagated
|
||||||
}
|
}
|
||||||
if let Some(mesh) = render_meshes.get(mesh_handle) {
|
let Some(mesh) = render_meshes.get(mesh_handle) else {
|
||||||
|
continue; // No mesh
|
||||||
|
};
|
||||||
let key = base_key
|
let key = base_key
|
||||||
.with_primitive_topology(mesh.primitive_topology)
|
.with_primitive_topology(mesh.primitive_topology)
|
||||||
.with_depth_mode(stencil_flags.depth_mode)
|
.with_depth_mode(stencil_flags.depth_mode)
|
||||||
.with_offset_zero(stencil_uniform.offset == 0.0)
|
.with_offset_zero(stencil_uniform.offset == 0.0)
|
||||||
.with_morph_targets(mesh.morph_targets.is_some());
|
.with_morph_targets(mesh.morph_targets.is_some());
|
||||||
let pipeline = pipelines
|
let Ok(pipeline) = pipelines
|
||||||
.specialize(&pipeline_cache, &stencil_pipeline, key, &mesh.layout)
|
.specialize(&pipeline_cache, &stencil_pipeline, key, &mesh.layout)
|
||||||
.unwrap();
|
else {
|
||||||
let distance =
|
continue; // No pipeline
|
||||||
rangefinder.distance(&Mat4::from_translation(stencil_uniform.origin));
|
};
|
||||||
|
let distance = rangefinder.distance(&Mat4::from_translation(stencil_uniform.origin));
|
||||||
stencil_phase.add(StencilOutline {
|
stencil_phase.add(StencilOutline {
|
||||||
entity,
|
entity,
|
||||||
pipeline,
|
pipeline,
|
||||||
@ -89,7 +92,6 @@ pub(crate) fn queue_outline_stencil_mesh(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) type DrawOutline = (
|
pub(crate) type DrawOutline = (
|
||||||
@ -151,7 +153,9 @@ pub(crate) fn queue_outline_volume_mesh(
|
|||||||
if volume_flags.depth_mode == DepthMode::Invalid {
|
if volume_flags.depth_mode == DepthMode::Invalid {
|
||||||
continue; // DepthMode not propagated
|
continue; // DepthMode not propagated
|
||||||
}
|
}
|
||||||
if let Some(mesh) = render_meshes.get(mesh_handle) {
|
let Some(mesh) = render_meshes.get(mesh_handle) else {
|
||||||
|
continue; // No mesh
|
||||||
|
};
|
||||||
let transparent = fragment_uniform.colour[3] < 1.0;
|
let transparent = fragment_uniform.colour[3] < 1.0;
|
||||||
let key = base_key
|
let key = base_key
|
||||||
.with_primitive_topology(mesh.primitive_topology)
|
.with_primitive_topology(mesh.primitive_topology)
|
||||||
@ -164,9 +168,10 @@ pub(crate) fn queue_outline_volume_mesh(
|
|||||||
.with_offset_zero(volume_uniform.offset == 0.0)
|
.with_offset_zero(volume_uniform.offset == 0.0)
|
||||||
.with_hdr_format(view.hdr)
|
.with_hdr_format(view.hdr)
|
||||||
.with_morph_targets(mesh.morph_targets.is_some());
|
.with_morph_targets(mesh.morph_targets.is_some());
|
||||||
let pipeline = pipelines
|
let Ok(pipeline) = pipelines
|
||||||
.specialize(&pipeline_cache, &outline_pipeline, key, &mesh.layout)
|
.specialize(&pipeline_cache, &outline_pipeline, key, &mesh.layout) else {
|
||||||
.unwrap();
|
continue; // No pipeline
|
||||||
|
};
|
||||||
let distance = rangefinder.distance(&Mat4::from_translation(volume_uniform.origin));
|
let distance = rangefinder.distance(&Mat4::from_translation(volume_uniform.origin));
|
||||||
if transparent {
|
if transparent {
|
||||||
transparent_phase.add(TransparentOutline {
|
transparent_phase.add(TransparentOutline {
|
||||||
@ -185,5 +190,4 @@ pub(crate) fn queue_outline_volume_mesh(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user