gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.68k stars 929 forks source link

Arrays are not IO_SHAREABLE? #4496

Open kocsis1david opened 1 year ago

kocsis1david commented 1 year ago

I tried to validate my SPIR-V shader which uses an array varying, but it fails. Is it intentional that arrays are not accepted for varyings by the validator?

teoxoy commented 1 year ago

Yes it's intended,

image

from https://gpuweb.github.io/gpuweb/wgsl/#user-defined-inputs-outputs

teoxoy commented 1 year ago

I haven't looked into whether or not other shading languages support arrays for user-defined IO. If they do, this could potentially be a feature.

kocsis1david commented 1 year ago

Glsl supports passing arrays from vertex to fragment shader. I tried to use naga to infer bind group layout types for the compiled glsl shader.

teoxoy commented 1 year ago

Do you know about msl/hlsl?

kocsis1david commented 1 year ago

HLSL supports it too, I don't know about MSL. But I guess naga needs to support it anyways if it wants to parse all valid SPIR-V modules.