mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
add cli arg to choose metal version
This commit is contained in:
parent
e04a9f4c6f
commit
a63bec8cd6
@ -126,6 +126,10 @@ By @cwfitzgerald in [#5325](https://github.com/gfx-rs/wgpu/pull/5325).
|
|||||||
- Cache the sample count to keep `get_texture_format_features` cheap. By @Dinnerbone in [#5346](https://github.com/gfx-rs/wgpu/pull/5346)
|
- Cache the sample count to keep `get_texture_format_features` cheap. By @Dinnerbone in [#5346](https://github.com/gfx-rs/wgpu/pull/5346)
|
||||||
- Mark `DEPTH32FLOAT_STENCIL8` as supported in GLES. By @Dinnerbone in [#5370](https://github.com/gfx-rs/wgpu/pull/5370)
|
- Mark `DEPTH32FLOAT_STENCIL8` as supported in GLES. By @Dinnerbone in [#5370](https://github.com/gfx-rs/wgpu/pull/5370)
|
||||||
|
|
||||||
|
#### Naga
|
||||||
|
|
||||||
|
- Allow user to select which MSL version to use via `--metal-version` with Naga CLI. By @pcleavelin in [#5392](https://github.com/gfx-rs/wgpu/pull/5392)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
#### General
|
#### General
|
||||||
|
@ -62,6 +62,10 @@ struct Args {
|
|||||||
#[argh(option)]
|
#[argh(option)]
|
||||||
shader_model: Option<ShaderModelArg>,
|
shader_model: Option<ShaderModelArg>,
|
||||||
|
|
||||||
|
/// the metal version to use, for example, 1.0, 1.1, 1.2, etc.
|
||||||
|
#[argh(option)]
|
||||||
|
metal_version: Option<MslVersionArg>,
|
||||||
|
|
||||||
/// if the selected frontends/backends support coordinate space conversions,
|
/// if the selected frontends/backends support coordinate space conversions,
|
||||||
/// disable them
|
/// disable them
|
||||||
#[argh(switch)]
|
#[argh(switch)]
|
||||||
@ -174,6 +178,30 @@ impl FromStr for GlslProfileArg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Newtype so we can implement [`FromStr`] for a Metal Language Version.
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
struct MslVersionArg((u8, u8));
|
||||||
|
|
||||||
|
impl FromStr for MslVersionArg {
|
||||||
|
type Err = String;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
let mut iter = s.split('.');
|
||||||
|
|
||||||
|
let check_value = |iter: &mut core::str::Split<_>| {
|
||||||
|
iter.next()
|
||||||
|
.ok_or_else(|| format!("Invalid value for --metal-version: {s}"))?
|
||||||
|
.parse::<u8>()
|
||||||
|
.map_err(|err| format!("Invalid value for --metal-version: '{s}': {err}"))
|
||||||
|
};
|
||||||
|
|
||||||
|
let major = check_value(&mut iter)?;
|
||||||
|
let minor = check_value(&mut iter)?;
|
||||||
|
|
||||||
|
Ok(Self((major, minor)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Parameters<'a> {
|
struct Parameters<'a> {
|
||||||
validation_flags: naga::valid::ValidationFlags,
|
validation_flags: naga::valid::ValidationFlags,
|
||||||
@ -287,6 +315,9 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
if let Some(ref model) = args.shader_model {
|
if let Some(ref model) = args.shader_model {
|
||||||
params.hlsl.shader_model = model.0;
|
params.hlsl.shader_model = model.0;
|
||||||
}
|
}
|
||||||
|
if let Some(ref version) = args.metal_version {
|
||||||
|
params.msl.lang_version = version.0;
|
||||||
|
}
|
||||||
params.keep_coordinate_space = args.keep_coordinate_space;
|
params.keep_coordinate_space = args.keep_coordinate_space;
|
||||||
|
|
||||||
params.dot.cfg_only = args.dot_cfg_only;
|
params.dot.cfg_only = args.dot_cfg_only;
|
||||||
|
Loading…
Reference in New Issue
Block a user