Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cli arg to choose metal version #5392

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

pcleavelin
Copy link

@pcleavelin pcleavelin commented Mar 15, 2024

Connections
Addresses #5389

Description
naga-cli has no way to select an MSL version.

Testing
Try to compile a .wgsl shader to a .metal shader that requires features only present in MSL versions >1.0 using the new --metal-version argument.
As an example, using the @builtin(instance_index) attribute:

struct Input {
    @location(0) position: vec4<f32>,
    @builtin(instance_index) instance_id: u32,
}

struct Output {
    @builtin(position) position: vec4<f32>,
}

@vertex
fn vs_main(input: Input) -> Output {
    var output: Output;

    output.position = input.position;

    return output;
}

and running

$ naga test.wgsl test.metal --metal-version 1.2

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@pcleavelin pcleavelin requested a review from a team as a code owner March 15, 2024 02:10
@ErichDonGubler ErichDonGubler added area: ecosystem Help the connected projects grow and prosper api: metal Issues with Metal area: naga back-end Outputs of naga shader conversion naga Shader Translator labels Mar 15, 2024
@teoxoy teoxoy enabled auto-merge (rebase) March 15, 2024 09:25
@teoxoy teoxoy merged commit a63bec8 into gfx-rs:trunk Mar 15, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: metal Issues with Metal area: ecosystem Help the connected projects grow and prosper area: naga back-end Outputs of naga shader conversion naga Shader Translator
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants