Skip to content

Commit 5f4e6a5

Browse files
committed
update new shaderdefs
1 parent 4ae9b23 commit 5f4e6a5

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

crates/bevy_core_pipeline/src/fxaa/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ impl SpecializedRenderPipeline for FxaaPipeline {
212212
fragment: Some(FragmentState {
213213
shader: FXAA_SHADER_HANDLE.typed(),
214214
shader_defs: vec![
215-
format!("EDGE_THRESH_{}", key.edge_threshold.get_str()),
216-
format!("EDGE_THRESH_MIN_{}", key.edge_threshold_min.get_str()),
215+
format!("EDGE_THRESH_{}", key.edge_threshold.get_str()).into(),
216+
format!("EDGE_THRESH_MIN_{}", key.edge_threshold_min.get_str()).into(),
217217
],
218218
entry_point: "fragment".into(),
219219
targets: vec![Some(ColorTargetState {

crates/bevy_core_pipeline/src/tonemapping/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl SpecializedRenderPipeline for TonemappingPipeline {
6666
fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor {
6767
let mut shader_defs = Vec::new();
6868
if key.deband_dither {
69-
shader_defs.push("DEBAND_DITHER".to_string());
69+
shader_defs.push("DEBAND_DITHER".into());
7070
}
7171
RenderPipelineDescriptor {
7272
label: Some("tonemapping pipeline".into()),

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,11 @@ impl SpecializedMeshPipeline for MeshPipeline {
641641
}
642642

643643
if key.contains(MeshPipelineKey::TONEMAP_IN_SHADER) {
644-
shader_defs.push("TONEMAP_IN_SHADER".to_string());
644+
shader_defs.push("TONEMAP_IN_SHADER".into());
645645

646646
// Debanding is tied to tonemapping in the shader, cannot run without it.
647647
if key.contains(MeshPipelineKey::DEBAND_DITHER) {
648-
shader_defs.push("DEBAND_DITHER".to_string());
648+
shader_defs.push("DEBAND_DITHER".into());
649649
}
650650
}
651651

crates/bevy_render/src/render_resource/pipeline_cache.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ impl From<&str> for ShaderDefVal {
129129
}
130130
}
131131

132+
impl From<String> for ShaderDefVal {
133+
fn from(key: String) -> Self {
134+
ShaderDefVal::Bool(key, true)
135+
}
136+
}
137+
132138
impl ShaderCache {
133139
fn get(
134140
&mut self,

crates/bevy_sprite/src/mesh2d/mesh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,11 @@ impl SpecializedMeshPipeline for Mesh2dPipeline {
376376
}
377377

378378
if key.contains(Mesh2dPipelineKey::TONEMAP_IN_SHADER) {
379-
shader_defs.push("TONEMAP_IN_SHADER".to_string());
379+
shader_defs.push("TONEMAP_IN_SHADER".into());
380380

381381
// Debanding is tied to tonemapping in the shader, cannot run without it.
382382
if key.contains(Mesh2dPipelineKey::DEBAND_DITHER) {
383-
shader_defs.push("DEBAND_DITHER".to_string());
383+
shader_defs.push("DEBAND_DITHER".into());
384384
}
385385
}
386386

crates/bevy_sprite/src/render/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ impl SpecializedRenderPipeline for SpritePipeline {
212212
}
213213

214214
if key.contains(SpritePipelineKey::TONEMAP_IN_SHADER) {
215-
shader_defs.push("TONEMAP_IN_SHADER".to_string());
215+
shader_defs.push("TONEMAP_IN_SHADER".into());
216216

217217
// Debanding is tied to tonemapping in the shader, cannot run without it.
218218
if key.contains(SpritePipelineKey::DEBAND_DITHER) {
219-
shader_defs.push("DEBAND_DITHER".to_string());
219+
shader_defs.push("DEBAND_DITHER".into());
220220
}
221221
}
222222

0 commit comments

Comments
 (0)