diff --git a/src/back/hlsl/mod.rs b/src/back/hlsl/mod.rs index 4245844429..27bec76e72 100644 --- a/src/back/hlsl/mod.rs +++ b/src/back/hlsl/mod.rs @@ -16,20 +16,22 @@ pub enum ShaderModel { } impl ShaderModel { - pub fn to_profile_string(self, stage: crate::ShaderStage) -> String { - let stage_prefix = match stage { - crate::ShaderStage::Vertex => "vs_", - crate::ShaderStage::Fragment => "ps_", - crate::ShaderStage::Compute => "cs_", - }; - - let version = match self { + pub fn to_str(self) -> &'static str { + match self { Self::V5_0 => "5_0", Self::V5_1 => "5_1", Self::V6_0 => "6_0", - }; + } + } +} - format!("{}{}", stage_prefix, version) +impl crate::ShaderStage { + pub fn to_hlsl_str(self) -> &'static str { + match self { + Self::Vertex => "vs", + Self::Fragment => "ps", + Self::Compute => "cs", + } } } diff --git a/tests/snapshots.rs b/tests/snapshots.rs index 0d61048b50..81bab60a58 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -291,10 +291,11 @@ fn write_output_hlsl( naga::ShaderStage::Compute => "compute", }; config_str = format!( - "{}{}={}\n{}_name={}\n", + "{}{}={}_{}\n{}_name={}\n", config_str, stage_str, - options.shader_model.to_profile_string(ep.stage), + ep.stage.to_hlsl_str(), + options.shader_model.to_str(), stage_str, &reflection_info.entry_points[index] );