Vulkan error "Failed to submit draw command"

I’ve been following the tutorial on vulkan tutorials website and am stuck just before displaying a triangle.
Double checked my code and it seems to line up with the tutorial, therefore i’m not sure what i’m doing wrong.
Visual studio throws a debug assertion on line

submitInfo.pCommandBuffers = &commandBuffers[imageIndex];

If running from command line, I get the std::runtime_error printed as expected “Failed to submit draw command buffer”.

I’m not sure what other code is required to help with the issue, but any input would be appreciated. I’m sure the tutorial is well known, and perhaps someone is able to give some direction.

Thank you

What debug assertion?
In what way does it fail with a C++ exception? What is the VkResult?
What about Vulkan Validation Layers?

Thanks for your reply krOoze.

The Visual studio asser is error
Expression: vector subscript out of range

I skipped the part about validation layers in the tutorial. However, now I have implemented it and i’m getting the error printed “Validation layers requested, but not available!”

Here is the validation function

bool Application::checkValidationLayerSupport()
{
	uint32_t layerCount;
	vkEnumerateInstanceLayerProperties(&layerCount, nullptr);

	std::vector<VkLayerProperties> availableLayers(layerCount);
	vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data());

	for (const char* layerName : validationLayers)
	{
		bool layerFound = false;

		for (const auto& layerProperties : availableLayers)
		{
			if (strcmp(layerName, layerProperties.layerName) == 0)
			{
				layerFound = true;
					break;
			}
		}
		if (!layerFound)
		{
			return false;
		}
	}

	return true;
}

This gets called right after the window creation using GLFW. Thank you for any attempt at helping a helpless soul :slight_smile:

That was an error on my part, spelling mistake. Here is the output, hope this helps

I suppose I should have implemented the validation layers after all. Just as the error says.
Switching RenderPass samples to VK_SAMPLE_COUNT_1_BIT fixed the issue to match. By mistake I must have tabbed on to VK_SAMPLE_COUNT_16_BIT.

Thank you for the attempt to help, i’m sure i’ll be around for the next while :slight_smile:

VS is usually right about these things. Well, what’s the size of commandBuffers, and what’s the value of imageIndex at that time?

Layers are indeed indispensible. You do not need to implement it though. It suffices to run any Vulkan app with env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and all that stuff is done for you.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.