Only add NORMAL_PREPASS key to meshes that participate in prepass

This commit is contained in:
Marco Buono 2023-06-19 22:58:14 -03:00
parent efc935d785
commit f698949f64

View File

@ -432,10 +432,6 @@ pub fn queue_material_meshes<M: Material>(
let mut view_key = MeshPipelineKey::from_msaa_samples(msaa.samples())
| MeshPipelineKey::from_hdr(view.hdr);
if normal_prepass.is_some() {
view_key |= MeshPipelineKey::NORMAL_PREPASS;
}
if taa_settings.is_some() {
view_key |= MeshPipelineKey::TAA;
}
@ -505,6 +501,14 @@ pub fn queue_material_meshes<M: Material>(
_ => (),
}
if normal_prepass.is_some()
&& mesh_key.intersection(MeshPipelineKey::BLEND_RESERVED_BITS)
== MeshPipelineKey::BLEND_OPAQUE
&& !material.properties.reads_view_transmission_texture
{
mesh_key |= MeshPipelineKey::NORMAL_PREPASS;
}
let pipeline_id = pipelines.specialize(
&pipeline_cache,
&material_pipeline,