Created
March 29, 2024 08:15
-
-
Save pcwalton/316e61c35dc83678f6beaf7b41ce30c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/crates/bevy_pbr/src/extended_material.rs b/crates/bevy_pbr/src/extended_material.rs | |
index a5c46ea6f..39ad33faf 100644 | |
--- a/crates/bevy_pbr/src/extended_material.rs | |
+++ b/crates/bevy_pbr/src/extended_material.rs | |
@@ -1,3 +1,5 @@ | |
+use std::marker::PhantomData; | |
+ | |
use bevy_asset::{Asset, Handle}; | |
use bevy_reflect::{impl_type_path, Reflect}; | |
use bevy_render::{ | |
@@ -22,7 +24,8 @@ pub struct MaterialExtensionPipeline { | |
pub struct MaterialExtensionKey<E: MaterialExtension> { | |
pub mesh_key: MeshPipelineKey, | |
- pub bind_group_data: E::Data, | |
+ //pub bind_group_data: E::Data, | |
+ pub phantom: PhantomData<E>, | |
} | |
/// A subset of the `Material` trait for defining extensions to a base `Material`, such as the builtin `StandardMaterial`. | |
@@ -282,7 +285,8 @@ impl<B: Material, E: MaterialExtension> Material for ExtendedMaterial<B, E> { | |
}; | |
let base_key = MaterialPipelineKey::<B> { | |
mesh_key: key.mesh_key, | |
- bind_group_data: key.bind_group_data.0, | |
+ phantom: PhantomData, | |
+ //bind_group_data: key.bind_group_data.0, | |
}; | |
B::specialize(&base_pipeline, descriptor, layout, base_key)?; | |
@@ -306,7 +310,8 @@ impl<B: Material, E: MaterialExtension> Material for ExtendedMaterial<B, E> { | |
layout, | |
MaterialExtensionKey { | |
mesh_key: key.mesh_key, | |
- bind_group_data: key.bind_group_data.1, | |
+ phantom: PhantomData, | |
+ //bind_group_data: key.bind_group_data.1, | |
}, | |
) | |
} | |
diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs | |
index 4e42cde7f..7bbd60709 100644 | |
--- a/crates/bevy_pbr/src/material.rs | |
+++ b/crates/bevy_pbr/src/material.rs | |
@@ -317,7 +317,8 @@ where | |
/// A key uniquely identifying a specialized [`MaterialPipeline`]. | |
pub struct MaterialPipelineKey<M: Material> { | |
pub mesh_key: MeshPipelineKey, | |
- pub bind_group_data: M::Data, | |
+ pub phantom: PhantomData<M>, | |
+ //pub bind_group_data: M::Data, | |
} | |
impl<M: Material> Eq for MaterialPipelineKey<M> where M::Data: PartialEq {} | |
@@ -327,7 +328,7 @@ where | |
M::Data: PartialEq, | |
{ | |
fn eq(&self, other: &Self) -> bool { | |
- self.mesh_key == other.mesh_key && self.bind_group_data == other.bind_group_data | |
+ self.mesh_key == other.mesh_key // && self.bind_group_data == other.bind_group_data | |
} | |
} | |
@@ -338,7 +339,8 @@ where | |
fn clone(&self) -> Self { | |
Self { | |
mesh_key: self.mesh_key, | |
- bind_group_data: self.bind_group_data.clone(), | |
+ phantom: PhantomData, | |
+ //bind_group_data: self.bind_group_data.clone(), | |
} | |
} | |
} | |
@@ -349,7 +351,7 @@ where | |
{ | |
fn hash<H: std::hash::Hasher>(&self, state: &mut H) { | |
self.mesh_key.hash(state); | |
- self.bind_group_data.hash(state); | |
+ //self.bind_group_data.hash(state); | |
} | |
} | |
@@ -691,7 +693,8 @@ pub fn queue_material_meshes<M: Material>( | |
&material_pipeline, | |
MaterialPipelineKey { | |
mesh_key, | |
- bind_group_data: material.key.clone(), | |
+ phantom: PhantomData, | |
+ //bind_group_data: material.key.clone(), | |
}, | |
&mesh.layout, | |
); | |
diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs | |
index 64c7b661f..008f1582b 100644 | |
--- a/crates/bevy_pbr/src/pbr_material.rs | |
+++ b/crates/bevy_pbr/src/pbr_material.rs | |
@@ -847,6 +847,7 @@ impl Material for StandardMaterial { | |
if let Some(fragment) = descriptor.fragment.as_mut() { | |
let shader_defs = &mut fragment.shader_defs; | |
+ /* | |
if key.bind_group_data.normal_map { | |
shader_defs.push("STANDARD_MATERIAL_NORMAL_MAP".into()); | |
} | |
@@ -866,14 +867,16 @@ impl Material for StandardMaterial { | |
{ | |
shader_defs.push("STANDARD_MATERIAL_SPECULAR_OR_DIFFUSE_TRANSMISSION".into()); | |
} | |
+ */ | |
} | |
- descriptor.primitive.cull_mode = key.bind_group_data.cull_mode; | |
+ //descriptor.primitive.cull_mode = key.bind_group_data.cull_mode; | |
+ descriptor.primitive.cull_mode = Some(Face::Back); | |
if let Some(label) = &mut descriptor.label { | |
*label = format!("pbr_{}", *label).into(); | |
} | |
- if let Some(depth_stencil) = descriptor.depth_stencil.as_mut() { | |
- depth_stencil.bias.constant = key.bind_group_data.depth_bias; | |
- } | |
+ //if let Some(depth_stencil) = descriptor.depth_stencil.as_mut() { | |
+ // depth_stencil.bias.constant = key.bind_group_data.depth_bias; | |
+ //} | |
Ok(()) | |
} | |
} | |
diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs | |
index 6e78c8f4c..21a1a9e5d 100644 | |
--- a/crates/bevy_pbr/src/prepass/mod.rs | |
+++ b/crates/bevy_pbr/src/prepass/mod.rs | |
@@ -833,7 +833,8 @@ pub fn queue_prepass_material_meshes<M: Material>( | |
&prepass_pipeline, | |
MaterialPipelineKey { | |
mesh_key, | |
- bind_group_data: material.key.clone(), | |
+ phantom: PhantomData, | |
+ //bind_group_data: material.key.clone(), | |
}, | |
&mesh.layout, | |
); | |
diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs | |
index 12d8961f9..2c50d5468 100644 | |
--- a/crates/bevy_pbr/src/render/light.rs | |
+++ b/crates/bevy_pbr/src/render/light.rs | |
@@ -21,7 +21,7 @@ use bevy_transform::{components::GlobalTransform, prelude::Transform}; | |
use bevy_utils::tracing::info_span; | |
use bevy_utils::tracing::{error, warn}; | |
use nonmax::NonMaxU32; | |
-use std::{hash::Hash, num::NonZeroU64, ops::Range}; | |
+use std::{hash::Hash, marker::PhantomData, num::NonZeroU64, ops::Range}; | |
use crate::*; | |
@@ -1691,7 +1691,8 @@ pub fn queue_shadows<M: Material>( | |
&prepass_pipeline, | |
MaterialPipelineKey { | |
mesh_key, | |
- bind_group_data: material.key.clone(), | |
+ phantom: PhantomData, | |
+ //bind_group_data: material.key.clone(), | |
}, | |
&mesh.layout, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment