-
Notifications
You must be signed in to change notification settings - Fork 194
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
Shader translation error, no function with name 'fwidth' #2524
Comments
The spec also states that these functions are only available in fragment shaders, could that be applicable to your use case? |
In my case I'm using it in the fragment shader. |
From the wgsl spec it looks like it can be implemented with I'm curious if there's some extension we're missing, but nothing's jumping out immediately. |
Replacing the call to fwidth by |
Maybe you could try enumerate_adapters to see if the laptop has something more capable. |
I certainly could, of course. I'm running my program with my nvidia gpu using prime-run with no issue. But it was really just to understand why it would not work with the intel one with mesa. |
Yeah, I don’t believe this is an issue with naga’s translation. I’m not familiar enough with mesa to definitively say that’s the problem. I would probably throw |
@Lisible are you using the derivative functions in a separate function (not directly in the fragment entry-point)? We are not culling functions that are not used by an entry-point. I'm getting this error with
I think this makes sense given that GLSL only supports one entry-point per file. |
I'm indeed using it in a separate function, not the entry point. I will try calling it in the entry point when I'll get back home. |
#2531 should fix it, you could also give it a try. |
I confirm that this works. Thank you for your help with that. |
This patch fixes a shader compilation error that occured on certain platforms (i.e. intel/mesa). fwidth() was called outside of the entry point of the fragment shader. During the vertex shader compilation stage, the function calling fwidth() was not culled, causing a compilation error. (See gfx-rs/naga#2524) As a temporary fix, the call to fwidth() has been moved to the fragment shader entry point.
When I run a program that renders with wgpu using my intel chipset with mesa driver, on an optimus laptop, I'm getting a crash at the shader compilation stage for a shader that uses the fwidth built-in function.
According to the wgpu_hal logs, this is using OpenGL ES 3.2 with Mesa 23.1.8, and the shader language version is OpenGL ES GLSL ES 3.20.
The version of naga used is 0.12.2, pulled from wgpu 0.16.1
According to the GLSL ES 3.20 spec, the fwidth function should be provided as a built-in function.
I'm not sure if this is an issue on naga's side or in mesa.
The text was updated successfully, but these errors were encountered: