-
Notifications
You must be signed in to change notification settings - Fork 960
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
Naga Fails to Validate Out Texture Argument #6816
Comments
I think this may be a validator issue as I don't think a texture argument should have made it all the way to the backend, though some other maintainer should validate. Can you try running your shader against trunk naga cli |
@cwfitzgerald Sure, here's the result:
|
I tried it with
|
Hmm, will need a maintainer who understands more about wgsl to chime in. |
Oh, I didn't even notice I had this name clash. I guess WGSL allows it, since everything works on Vulkan? |
I'm guessing that it's getting dropped because it's dead code. When I tried it in Tint, I just compiled everything so that function gets compiled. The browser will, probably, ignore it because it isn't reachable from any of the entry points. The first call |
Description
In my C++ project, that uses wgpu-native-v22.1.0.5, shader compilation fails on MacOS on M1 hardware with the following error:
Looking at the
naga/src/back/msl/writer.rs:249
from thewgpu-22.1.0
tag, it seems that the compiler somehow failed to parse texture access flags or something like that.Here is the full shader source that triggers the error:
Specifically the
fn sampleEnvMap(environmentMap: texture_storage_2d<rgba32float, read>, direction : vec3f)
function looks like it might be the problem. Commenting it out (and removing its usages) fixes the problem (though another shader compilation crashes after that, but it's a different bug).This code works on Linux with wgpu-native v0.19.4.1. I've initially tried it on MacOS with the same wgpu-native version, and the same error emerged.
Repro steps
Unfortunately, my only reproducible example is rather large: clone this repo, build it, and run, supplying any scene from the
test_scenes
directory.Expected vs observed behavior
Expected behavior: shader compiles properly
Observed behavior: shader compilation crashes
Extra materials
I've tried enabling
METAL_DEVICE_WRAPPER_TYPE=1
but I didn't see any extra logs.Platform
Device: Apple M1 Pro
OS: macOS Ventura 13.3
wgpu-native version: v0.19.4.1 and v22.1.0.5
OS window created using SDL2 and a small wrapper to create a wgpu surface.
The text was updated successfully, but these errors were encountered: