VkPipelineColorBlend ReadingException

Hello, I’m working at the moment at a little graphic Engine which uses Vulkan for rendering.
For this I’ve a little problem: I don’t understand why I get a breakpoint with Visual Studio: The problem is that I get the Error-Code:
`Exception throw at 0x00007FFAE3C66A66 (amdvlk64.dll) in PhoenixEngine.exe: 0xC0000005: access to injury while reading at position 0x000000000000000A.
The red X of visual studio is pointing at the line where I create the Instance.
Though testing I know while activating Color Blending, so here is the Code:

			VkPipelineColorBlendAttachmentState colorBlendAttachment;
			colorBlendAttachment.blendEnable = VK_TRUE;
			colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
			colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
			colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
			colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
			colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
			colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
			colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;

		
			VkPipelineColorBlendStateCreateInfo colorBlendCreateInfo;
			colorBlendCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
			colorBlendCreateInfo.pNext = nullptr;
			colorBlendCreateInfo.flags = 0;
			colorBlendCreateInfo.logicOpEnable = VK_FALSE;
			colorBlendCreateInfo.logicOp = VK_LOGIC_OP_NO_OP;
			colorBlendCreateInfo.attachmentCount = 1;
			colorBlendCreateInfo.pAttachments = &colorBlendAttachment;
			colorBlendCreateInfo.blendConstants[0] = 0.0f;
			colorBlendCreateInfo.blendConstants[1] = 0.0f;
			colorBlendCreateInfo.blendConstants[2] = 0.0f;
			colorBlendCreateInfo.blendConstants[3] = 0.0f;

Interisting is, that this code is running later than creating the Instance.
This line of code I use to create the Instance:

VkResult result = vkCreateInstance(&instanceCreateInfo, nullptr, &instance);

When I comment out the creating of VkPipelineColorBlendStateCreateInfo, I don’t get this error. Do you have an Idea about what I’m doing wrong?

Hi @Fawkes.
Do you have any error messages for Validation Layers ?
Could you attach a minimal simple project ?

Hi @AndreyOGL_D3D,
No, I don’t have any error messages for Validation Layers. The output of the application is only what Layers and Extensions are available. After that I get the error message from Visual Studio.
I don’t know how I could make the project simpler. But I’m working on to clean up my code.
So while rewriting my code (in hope to find the mistake) a small errormessage from validation layer is visible. It says I should put the value for queuePriorities between zero and one. But the strange thing is: I’ve done this:

VkDeviceQueueCreateInfo GraphicEngine::createQueueCreateInfo(uint32_t & amountOfQueueFamilies, VkQueueFamilyProperties * queueFamilyProperties)
{
	VkDeviceQueueCreateInfo deviceQueueCreateInfo;
	deviceQueueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
	deviceQueueCreateInfo.pNext = NULL;
	deviceQueueCreateInfo.flags = 0;
	//GetBest QueueFamily: Graphic Bit and Transfering Bit
	bool found = false;
	for (int i = 0; i < amountOfQueueFamilies; i++)
	{
		if ((queueFamilyProperties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) > 0 && (queueFamilyProperties[i].queueFlags & VK_QUEUE_TRANSFER_BIT) > 0)
		{
			found = true;
			deviceQueueCreateInfo.queueFamilyIndex = i;
		}
	}
	if (found)
	{
		if (queueFamilyProperties[deviceQueueCreateInfo.queueFamilyIndex].queueCount >= 1)
		{
			deviceQueueCreateInfo.queueCount = 1;
		}
		std::cout << "[DEBUGGING] QUEUEINDEX=" << deviceQueueCreateInfo.queueFamilyIndex << std::endl;
		const float queuePrios[] = { 1.0};
		deviceQueueCreateInfo.pQueuePriorities = queuePrios;
		return deviceQueueCreateInfo;
	}
	else
	{
		std::cerr << "Crazy Graphic Card: No good QueueFamily" << std::endl;
		exit(-3);
	}
	return deviceQueueCreateInfo;
}

I don’t know wether the queueIndex with enabled Graphic and Transfering Bit is the best for my project, or a other queue.
But the value in QueuePrios[0] is 1.88 * 10^15, says the validation layer. So it is not really a value between 0 and 1. Maybe I had these little error before too and I overlooked this little mistake.
So does anyone have an Idea how to solve the issue with the wrong value in the float array to describe queuePriorities?

const float queuePrios = { 1.0};
deviceQueueCreateInfo.pQueuePriorities = queuePrios;
return deviceQueueCreateInfo;

You use adress of local variable after return from function body.