0
votes

I've written a small Vulkan test app to familiarize myself Vulkan though I've run into an issue trying to create a pipeline.

vkCreateGraphicsPipeline causes the Validation Layer to produce the following errors: Invalid Shader Module Object 0x8 Invalid Shader Module Object 0x9

And then it the program crashes within the validation layer. I had created a VkShaderModule for the vertex shader and fragment shader and used glslangvalidator -V to convert them to SPIR-V modules which vkCreateShaderModule didn't complain about.

Is there anything I may've missed? The examples seem to be doing things exactly the same way I am.

1
You missed showing us the code that actually causes the problem you cite. - Nicol Bolas
The down vote is extremely inappropriate. The code isn't relevant in this case as there's only one way to go about creating a Shader Module and specifying it for a pipeline. It's also not practical due to the verbosity the Vulkan API. Although the error message itself is quite vague it likely has a very specific cause and doubtlessly others have encountered it before and should know exactly what scenario causes it. - atlan
If that's true, then you're basically assuming that the validation layer is broken in some way. And yet, if people couldn't create graphics pipelines at all, then nobody would be able to use validation layers. Of course, people are using validation layers, so there cannot be a general problem creating graphics pipelines from shader modules. And therefore, unless there is some reason to suspect otherwise, we must assume that your code is at fault. So we need to see what your code actually is doing, no matter how verbose it may be. - Nicol Bolas
Yep it's the handle. I wasn't clear on what the message was referring to and thought it may've been that the object the handle referred to was invalid in some way but it's actually only the handle itself that the message refers to. Turns out the problem was that I should've marked the copy constructor for the VkShaderModule container class as deleted and the object was getting implicitly destroyed by an copy performed in an STL container. - atlan
@atlan: "Turns out the problem was that I should've marked the copy constructor for the VkShaderModule container class as deleted and the object was getting implicitly destroyed by an copy performed in an STL container." Perhaps now you will see why it's important to provide a minimal reproducible example when you ask questions. - Nicol Bolas

1 Answers

0
votes

The error message and the layer crash behavior points to an invalid Vulkan object handle (e.g. object unsuccessfuly vkCreate*d or vkDestroyed before use) as detected by the VK_LAYER_LUNARG_object_tracker validation layer.

Validation layers should probably not crash if they are all enabled and that in the prescribed order. That can be ensured by using only VK_LAYER_LUNARG_standard_validation meta-layer.

As in any good validator, error messages are completely unreadable by puny humans.
Standard validation layers are open-sourced in GitHub/KhronosGroup/Vulkan-LoaderAndValidationLayers/layers, so if in doubt it can be searched for the given message text. Usually it is in core_validation.cpp but in your case it would be object_tracker.cpp. (The message would be in printf format e.g. "Invalid %s Object 0x%" making it bit harder to search for).