gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 548 forks source link

Wgpu hello-compute example crashes with GL backend #3601

Closed agorgl closed 3 years ago

agorgl commented 3 years ago

Running wgpu-rs example hello-compute modified to use the GL backend, I get a crash with:

[0.071380 ERROR](Device::create_compute_pipeline)(no module): [API/Error] ID 1 : GL_INVALID_OPERATION in unsupported function called (unsupported extension or deprecated function?)
thread 'main' panicked at 'Error InvalidOperation executing command: CopyBufferToBuffer(3, 2, BufferCopy { src: 0, dst: 0, size: 20 })', /home/theartist/Workdir/projects/graphics/rust/gfx/src/backend/gl/src/queue.rs:1071:13
agorgl commented 3 years ago

Seems that this error can be traced in Mesa sources: https://github.com/mesa3d/mesa/blob/0bf7f7fcd2f6a8b5560182520c6832f4467da313/src/mesa/main/context.c#L977

kvark commented 3 years ago

Unable to repro on NVidia with https://github.com/gfx-rs/gfx/pull/3602

agorgl commented 3 years ago

Still reproducible on Radeon with Mesa 20.3.3

agorgl commented 3 years ago

After building Mesa in debug mode and setting a breakpoint on _mesa_error I can see that just before the crash it breaks here with the following backtrace:

#0  _mesa_error (ctx=0x55555722a5b0, error=1282, fmtString=0x7ffff6b36e08 "unsupported function called (unsupported extension or deprecated function?)")
    at ../mesa/src/mesa/main/errors.c:301
#1  0x00007ffff5d11f52 in generic_nop () at ../mesa/src/mesa/main/context.c:977
#2  0x000055555675afcc in glow::gl46::call_atomic_ptr_3arg<(),u32,u32,u32> (name=..., ptr=0x5555572956f8, a=4, b=1, c=1)
    at /home/theartist/.cargo/registry/src/github.com-1ecc6299db9ec823/glow-0.7.1/src/gl46.rs:4365
#3  glow::gl46::struct_commands::GlFns::ShaderStorageBlockBinding (self=0x555557294870, program=4, storageBlockIndex=1, storageBlockBinding=1)
    at /home/theartist/.cargo/registry/src/github.com-1ecc6299db9ec823/glow-0.7.1/src/gl46.rs:26645
#4  0x000055555676539f in glow::native::{{impl}}::shader_storage_block_binding (self=0x555557294870, program=4, index=1, binding=1)
    at /home/theartist/.cargo/registry/src/github.com-1ecc6299db9ec823/glow-0.7.1/src/native.rs:2088
#5  0x0000555556677c11 in gfx_backend_gl::device::Device::create_shader_program (self=0x5555572a85a8, shaders=..., layout=0x5555572b2030)
    at /home/theartist/Workdir/projects/graphics/rust/gfx/src/backend/gl/src/device.rs:216
#6  0x000055555667ce6a in gfx_backend_gl::device::{{impl}}::create_graphics_pipeline (self=0x5555572a85a8, desc=0x7fffffff8be0, _cache=...)
    at /home/theartist/Workdir/projects/graphics/rust/gfx/src/backend/gl/src/device.rs:1000
 ...

So it seems that the error is generated from a call to glShaderStorageBlockBinding