gfx-rs / portability

Vulkan Portability Implementation
Mozilla Public License 2.0
384 stars 25 forks source link

Improve error handling for gfxCreateGraphicsPipelines #129

Closed zeux closed 5 years ago

zeux commented 6 years ago

We are getting VK_ERROR_INCOMPATIBLE_DRIVER when calling CreateGraphicsPipelines for any pipelines in our application; looks like it's coming from here:

https://github.com/gfx-rs/portability/blob/7650048d9896737d64d4b9bd7a49b17226717bb0/libportability-gfx/src/impls.rs#L2103-L2107

There's no error logs so I'm not sure what the problem is. Would it be possible to communicate the reason for the error via a TTY or something along these lines? These are most likely bugs in portability/gfx/etc. but it's unclear why they happen.

kvark commented 6 years ago

The backend often spews out errors/warning and other messages via rust standard logging mechanisms. They are hooked up to the console output in our debug builds and can be enabled when running with RUST_LOG=gfx_backend_metal=debug. This includes SPIRV-Cross produced shader code/errors.

But in this case, we first need to make sure the errors returned by the backend are not ignored. So minor changes to the portability lib are needed.

zeux commented 6 years ago

I'll check RUST_LOG output tomorrow, thanks. It would be great to mention this in the error message, similarly to how panic says that you can enable backtraces to see more output.

zeux commented 6 years ago

Ok - RUST_LOG didn't work in release builds but it did work in the debug build:

ERROR 2018-08-15T21:03:22Z: gfx_backend_metal::device: PSO creation failed: Vertex attribute TEXCOORD0(4) is missing from the vertex descriptor
1534367001.83030,a824380,6 VULKAN ERROR: vkCreateGraphicsPipelines(device, cache, 1, &createInfo, nullptr, &result) returned -9
1534367001.83034,a824380,6 ERROR: Pipeline state object creation failed with code -9
1534367001.83035,a824380,6 Program: SkyVS,SkyFS,
zeux commented 6 years ago

Ok - I see - this is a bug in gfx (filed here https://github.com/gfx-rs/gfx/issues/2324):

https://github.com/gfx-rs/gfx/blob/a571ae5a15b2fd7bdd457c9d2d6189167ccfbf54/src/backend/metal/src/device.rs#L1011-L1014

This code doesn't handle location in attribute descriptors properly, instead assuming that all attributes have linear locations 0-count-1.

zeux commented 5 years ago

Closing this since the issue is stale and probably doesn't need addressing anymore.