mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-27 09:14:01 +00:00
[hlsl-out] expose profile string conversions
This commit is contained in:
parent
7532c2abaa
commit
458db0b522
@ -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",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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]
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user