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

Metal half name reserved #5072

Closed
BenjaminSchaaf opened this issue Jan 16, 2024 · 2 comments
Closed

Metal half name reserved #5072

BenjaminSchaaf opened this issue Jan 16, 2024 · 2 comments

Comments

@BenjaminSchaaf
Copy link
Contributor

Description
Writing a wgpu shader using a variable with the name half doesn't work under metal, as half is a reserved name.

Repro steps
Use the hello_triangle example, with the following shader on macOS (using metal):

@vertex
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
    let x = f32(i32(in_vertex_index) - 1);
    let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
    return vec4<f32>(x, y, 0.0, 1.0);
}

@fragment
fn fs_main() -> @location(0) vec4<f32> {
    let half = 0.5;
    return vec4<f32>(half, 0.0, 0.0, 1.0);
}

Apologies if this doesn't reproduce, I'm reporting this from memory of testing on someone else's mac

Expected vs observed behavior
The shader should work, half works with other backends. Instead it fails to compile the shader once it gets to the metal backend compiler.

Platform
macOS, wgpu 0.18.0, naga 0.14.2

@teoxoy
Copy link
Member

teoxoy commented Jan 16, 2024

I think this has been fixed with #4707. Could you try latest trunk?

@BenjaminSchaaf
Copy link
Contributor Author

Apologies, I should have found that duplicate. I can't test right now, but I'm sure it's fixed.

@BenjaminSchaaf BenjaminSchaaf closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants