mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
added match statement instead of if-else block (#8500)
# Objective Replaced the if-else statement block in favor of a match statement to give a more cleaner code.
This commit is contained in:
parent
a29d328fe5
commit
1a43ce15ed
1 changed files with 26 additions and 18 deletions
|
@ -390,25 +390,33 @@ impl SpecializedMeshPipeline for Mesh2dPipeline {
|
|||
|
||||
let method = key.intersection(Mesh2dPipelineKey::TONEMAP_METHOD_RESERVED_BITS);
|
||||
|
||||
if method == Mesh2dPipelineKey::TONEMAP_METHOD_NONE {
|
||||
shader_defs.push("TONEMAP_METHOD_NONE".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_REINHARD {
|
||||
shader_defs.push("TONEMAP_METHOD_REINHARD".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_REINHARD_LUMINANCE {
|
||||
shader_defs.push("TONEMAP_METHOD_REINHARD_LUMINANCE".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_ACES_FITTED {
|
||||
shader_defs.push("TONEMAP_METHOD_ACES_FITTED".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_AGX {
|
||||
shader_defs.push("TONEMAP_METHOD_AGX".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_SOMEWHAT_BORING_DISPLAY_TRANSFORM
|
||||
{
|
||||
shader_defs.push("TONEMAP_METHOD_SOMEWHAT_BORING_DISPLAY_TRANSFORM".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_BLENDER_FILMIC {
|
||||
shader_defs.push("TONEMAP_METHOD_BLENDER_FILMIC".into());
|
||||
} else if method == Mesh2dPipelineKey::TONEMAP_METHOD_TONY_MC_MAPFACE {
|
||||
shader_defs.push("TONEMAP_METHOD_TONY_MC_MAPFACE".into());
|
||||
match method {
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_NONE => {
|
||||
shader_defs.push("TONEMAP_METHOD_NONE".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_REINHARD => {
|
||||
shader_defs.push("TONEMAP_METHOD_REINHARD".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_REINHARD_LUMINANCE => {
|
||||
shader_defs.push("TONEMAP_METHOD_REINHARD_LUMINANCE".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_ACES_FITTED => {
|
||||
shader_defs.push("TONEMAP_METHOD_ACES_FITTED".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_AGX => {
|
||||
shader_defs.push("TONEMAP_METHOD_AGX".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_SOMEWHAT_BORING_DISPLAY_TRANSFORM => {
|
||||
shader_defs.push("TONEMAP_METHOD_SOMEWHAT_BORING_DISPLAY_TRANSFORM".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_BLENDER_FILMIC => {
|
||||
shader_defs.push("TONEMAP_METHOD_BLENDER_FILMIC".into());
|
||||
}
|
||||
Mesh2dPipelineKey::TONEMAP_METHOD_TONY_MC_MAPFACE => {
|
||||
shader_defs.push("TONEMAP_METHOD_TONY_MC_MAPFACE".into());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Debanding is tied to tonemapping in the shader, cannot run without it.
|
||||
if key.contains(Mesh2dPipelineKey::DEBAND_DITHER) {
|
||||
shader_defs.push("DEBAND_DITHER".into());
|
||||
|
|
Loading…
Reference in a new issue