Hi!
I’ve validation layers errors that doesn’t make any sense :
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[2].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[3].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[4].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[5].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkUpdateDescriptorSets(): pDescriptorWrites[0].pImageInfo[0].imageView image layout is VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, but descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_IMAGE. (allowed layouts are VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR).
The Vulkan spec states: If descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_IMAGE the imageLayout member of each element of pImageInfo must be a member of the list given in Storage Image (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkWriteDescriptorSet-descriptorType-04152)
validation layer: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location 1 not consumed by vertex shader.
validation layer: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location 2 not consumed by vertex shader.
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[2].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[3].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[4].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[5].descriptorCount is zero.
The Vulkan spec states: descriptorCount must be greater than 0 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkDescriptorPoolSize-descriptorCount-00302)
validation layer: vkUpdateDescriptorSets(): pDescriptorWrites[0].pImageInfo[0].imageView image layout is VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, but descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_IMAGE. (allowed layouts are VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR).
The Vulkan spec states: If descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_IMAGE the imageLayout member of each element of pImageInfo must be a member of the list given in Storage Image (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/descriptorsets.html#VUID-VkWriteDescriptorSet-descriptorType-04152)
validation layer: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location 1 not consumed by vertex shader.
validation layer: vkCreateGraphicsPipelines(): pCreateInfos[0].pVertexInputState Vertex attribute at location 2 not consumed by vertex shader.
First of all it tells me that descriptorCount is 0 when creating the descriptor pool but that’s not true, the descriptor count value is 1 : frameBuffer.getMaxFrameinFlight() returns 1.
poolSizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
poolSizes[1].descriptorCount = static_cast<uint32_t>(frameBuffer.getMaxFramesInFlight());
poolSizes[2].type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
poolSizes[2].descriptorCount = static_cast<uint32_t>(frameBuffer.getMaxFramesInFlight());
poolSizes[3].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
poolSizes[3].descriptorCount = static_cast<uint32_t>(frameBuffer.getMaxFramesInFlight() * allTextures.size());
poolSizes[4].type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
poolSizes[4].descriptorCount = static_cast<uint32_t>(frameBuffer.getMaxFramesInFlight());
poolSizes[5].type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
poolSizes[5].descriptorCount = static_cast<uint32_t>(frameBuffer.getMaxFramesInFlight());
So why it tells me the descriptorCount is 0 when creating the descriptor pool that doesn’t make any sense.
Secondly it tells me that the imageViewLayout is incorrect…
But I don’t set it to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
I set it to VK_IMAGE_LAYOUT_GENERAL :
VkDescriptorImageInfo headPtrDescriptorImageInfo;
headPtrDescriptorImageInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
headPtrDescriptorImageInfo.imageView = headPtrTextureImageView;
headPtrDescriptorImageInfo.sampler = headPtrTextureSampler;
Is there something wrong here ?
void PerPixelLinkedListRenderComponent::createHeadPtrImageView() {
VkImageViewCreateInfo viewInfo{};
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.image = headPtrTextureImage;
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
viewInfo.format = VK_FORMAT_R32_UINT;
viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
viewInfo.subresourceRange.baseMipLevel = 0;
viewInfo.subresourceRange.levelCount = 1;
viewInfo.subresourceRange.baseArrayLayer = 0;
viewInfo.subresourceRange.layerCount = 1;
if (vkCreateImageView(vkDevice.getDevice(), &viewInfo, nullptr, &headPtrTextureImageView) != VK_SUCCESS) {
throw std::runtime_error("failed to create head ptr texture image view!");
}
}
And next it tells me that vertex attributes at location 0 and 1 are not consumed in the vertex shader.
I don’t need to use them in this vertex shader but I declared them in the shader and in my input descriptions :
static VkVertexInputBindingDescription getBindingDescription() {
VkVertexInputBindingDescription bindingDescription{};
bindingDescription.binding = 0;
bindingDescription.stride = sizeof(Vertex);
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
return bindingDescription;
}
static std::array<VkVertexInputAttributeDescription, 3> getAttributeDescriptions() {
std::array<VkVertexInputAttributeDescription, 3> attributeDescriptions{};
attributeDescriptions[0].binding = 0;
attributeDescriptions[0].location = 0;
attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[0].offset = offsetof(Vertex, position);
attributeDescriptions[1].binding = 0;
attributeDescriptions[1].location = 1;
attributeDescriptions[1].format = VK_FORMAT_R8G8B8A8_UNORM;
attributeDescriptions[1].offset = offsetof(Vertex, color);
attributeDescriptions[2].binding = 0;
attributeDescriptions[2].location = 2;
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[2].offset = offsetof(Vertex, texCoords);
return attributeDescriptions;
}
const std::string simpleVertexShader = R"(#version 460
layout (location = 0) in vec3 position;
layout (location = 1) in vec4 color;
layout (location = 2) in vec2 texCoords;
layout (location = 3) in vec3 normals;
layout (push_constant) uniform PushConsts {
mat4 projectionMatrix;
mat4 viewMatrix;
mat4 worldMat;
} pushConsts;
void main () {
gl_Position = pushConsts.projectionMatrix * pushConsts.viewMatrix * pushConsts.worldMat * vec4(position, 1.f);
})";
How to fix this validation error message ?
Thanks.