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

wgpu_core::validation error: unexpected varying type #1427

Open
ifacodes opened this issue May 18, 2021 · 8 comments
Open

wgpu_core::validation error: unexpected varying type #1427

ifacodes opened this issue May 18, 2021 · 8 comments
Labels
area: validation Issues related to validation, diagnostics, and error handling type: enhancement New feature or request

Comments

@ifacodes
Copy link

Description
When I run my program, (the pipeline section from ) I get an error once it runs. it doesn't break anything, I'm just confused as to why this seems be happening.

Repro steps
following the sotrh guide with these dependencies:
[dependencies]
anyhow = "1.0.40"
image = "0.23.14"
winit = "0.24"
wgpu = "0.8.1"
env_logger = "0.7"
futures = "0.3"
cgmath = "0.18"

[build-dependencies]
shaderc = "0.7"
anyhow = "1.0.40"
fs_extra = "1.1"
glob = "0.3"

Expected vs observed behavior
for this error not to happen.

Extra materials
image

I think?? It has something to do with the SPIR_V vec4 formats?

Platform
Windows 10, wgpu 0.8.1

@kvark
Copy link
Member

kvark commented May 18, 2021

You are providing a SPIR-V shader built from GLSL. It contains things like gl_ClipDistance and gl_CullDistance that aren't a part of WebGPU, so we have to work around them. The released wgpu-0.8.1 doesn't know how to work around the gl_CullDistance thing at least, so there is your error.
Try changing the #version in GLSL to 440 instead of 450 or 460 that you are using.

@ifacodes
Copy link
Author

that... didn't help unfortunately I'm facing the same error. any other solution?

@ifacodes
Copy link
Author

image
image
these are my only two shaders

@kvark
Copy link
Member

kvark commented May 19, 2021

Ok, sorry, I should have read it more carefully. You are saying everything works, just wondering why the error is printed.
The answer is - WebGPU has no such thing as "gl_ClipDistance" or "gl_CullDistance", and they are arrays, which WebGPU doesn't support for inputs/outputs of the shader. So the validation yells at you for this. In the future we may be handling this better.

@HalfVoxel
Copy link
Contributor

I also got this issue and spent a fair amount of time trying to debug my shader to see what the issue was, before finding this post.
This only became an issue when I upgraded to the latest wgpu, earlier versions seemed to handle it without any issues.

@ifsheldon
Copy link

I have the same issue when learning wgpu with this tutorial. Maybe you could just be more specific in the error message as a quick fix

@kvark
Copy link
Member

kvark commented May 25, 2021

Error messages coming from Naga are indeed not very actionable right now, this is a general problem we are aware of but hasn't solved yet.

@cwfitzgerald
Copy link
Member

See #2168 for more info

@cwfitzgerald cwfitzgerald added type: enhancement New feature or request area: validation Issues related to validation, diagnostics, and error handling labels Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Issues related to validation, diagnostics, and error handling type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants