Hi! Not sure if I should create this issue here or in naga repo, please let me know if I should recreate it there.
Anyway, when I compile a trivial GLSL shader
#version 330
void main()
{
}
to spirv using glslangValidator, creating a shader module panics with the following callstack:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnsupportedBuiltIn(5)', C:\Users\andrew\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-0.12.0\src\backend\direct.rs:1022:45
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panicking.rs:584
1: core::panicking::panic_fmt
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\core\src\panicking.rs:143
2: core::result::unwrap_failed
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\core\src\result.rs:1749
3: enum$<core::result::Result<naga::Module,enum$<naga::front::spv::error::Error> > >::unwrap<naga::Module,enum$<naga::front::spv::error::Error> >
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\result.rs:1065
4: wgpu::backend::direct::impl$3::device_create_shader_module
at C:\Users\andrew\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-0.12.0\src\backend\direct.rs:1022
5: wgpu::Device::create_shader_module
at C:\Users\andrew\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-0.12.0\src\lib.rs:1705
6: brdf_playground::BrdfPlayground::init
at .\src\main.rs:231
7: brdf_playground::main
at .\src\main.rs:421
8: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\ops\function.rs:227
Here is human-readable SPIRV dump (via -H command arg):
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 6
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Source GLSL 330
Name 4 "main"
2: TypeVoid
3: TypeFunction 2
4(main): 2 Function None 3
5: Label
Return
FunctionEnd
Output of glslangValidator.exe -v is
Glslang Version: 10:11.8.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 11.8.0
GLSL Version: 4.60 glslang Khronos. 11.8.0
SPIR-V Version 0x00010600, Revision 1
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 10
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100
Repro steps
Write a trivial GLSL shader
Compile it using glslangValidator.exe, full command line is
glslangValidator.exe -S vert test.glsl -o test.vert.spv -G -e "main"
Try to create a shader module from it using
let vs_shader = device.create_shader_module(&include_spirv!("../shaders/test.vert.spv"));
Observe the mentioned panic.
Expected vs observed behavior
I'm not sure I'd expect such a shader to produce a shader module without any errors (initially I wrote a simple, but non-empty shader and reduced the repro case to the trivial one), but
I'd expect that something that is required would be missing, but the error tells about something being unsupported (which is surprising in such a trivial example)
I'd expect an error to be more descriptive since currently I have no clue what exactly is not supported
Hi! Not sure if I should create this issue here or in
naga
repo, please let me know if I should recreate it there. Anyway, when I compile a trivial GLSL shaderto spirv using
glslangValidator
, creating a shader module panics with the following callstack:Here is human-readable SPIRV dump (via
-H
command arg):Output of
glslangValidator.exe -v
isRepro steps
glslangValidator.exe
, full command line isExpected vs observed behavior I'm not sure I'd expect such a shader to produce a shader module without any errors (initially I wrote a simple, but non-empty shader and reduced the repro case to the trivial one), but
Platform OS: Windows 11 wgpu version: 0.12
Thanks!