Im new to this mesh shader, I managed to draw a triangle on the window but the validation layer complain
UNASSIGNED-CoreValidation-Shader-PointSizeMissing(ERROR / SPEC): msgNum: -211210120 - Validation Error: [ UNASSIGNED-CoreValidation-Shader-PointSizeMissing ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0xf3693078 | Pipeline topology is set to POINT_LIST, but PointSize is not written to in the shader corresponding to VK_SHADER_STAGE_MESH_BIT_NV.
Objects: 1
[0] 0, type: 19, name: NULL
this is the shader
#version 450
#extension GL_NV_mesh_shader : require
layout(local_size_x = 1) in;
layout(triangles, max_vertices = 3, max_primitives = 1) out;
struct Vertex
{
vec4 position;
vec4 color;
};
layout(set = 0, binding = 0) buffer Vertices
{
Vertex vertex[];
}vertices;
layout(location = 0) out Color
{
vec4 color;
}color[];
void main()
{
for(int i = 0; i < 3; ++i)
{
gl_MeshVerticesNV[i].gl_Position = vertices.vertex[i].position;
color[i].color = vertices.vertex[i].color;
gl_PrimitiveIndicesNV[i] = i;
}
gl_PrimitiveCountNV = 1;
}
btw my device is rtx 3070. thank you
The validation message hints at your pipeline topology. So how are you setting up your pipeline?
VkPipelineShaderStageCreateInfo shaderStages[2] = {};
shaderStages[0] = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[0].module = meshShader;
shaderStages[0].pName = "main";
shaderStages[0].stage = VK_SHADER_STAGE_MESH_BIT_NV;
shaderStages[1] = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[1].module = fragmentShader;
shaderStages[1].pName = "main";
shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
VkPipelineColorBlendAttachmentState colorBlendAttachmentState = {};
colorBlendAttachmentState.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
VkPipelineColorBlendStateCreateInfo colorBlendState = {};
colorBlendState.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
colorBlendState.attachmentCount = 1;
colorBlendState.pAttachments = &colorBlendAttachmentState;
VkPipelineViewportStateCreateInfo viewportState = {};
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.viewportCount = 1;
viewportState.scissorCount = 1;
VkPipelineRasterizationStateCreateInfo rasterizationState = {};
rasterizationState.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rasterizationState.lineWidth = 1.0f;
rasterizationState.polygonMode = VK_POLYGON_MODE_FILL;
rasterizationState.cullMode = VK_CULL_MODE_BACK_BIT;
rasterizationState.frontFace = VK_FRONT_FACE_CLOCKWISE;
VkPipelineMultisampleStateCreateInfo multisampleState = {};
multisampleState.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
multisampleState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
VkDynamicState dynamicStates[2];
dynamicStates[0] = VK_DYNAMIC_STATE_VIEWPORT;
dynamicStates[1] = VK_DYNAMIC_STATE_SCISSOR;
VkPipelineDynamicStateCreateInfo dynamicStateInfo = {};
dynamicStateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
dynamicStateInfo.dynamicStateCount = 2;
dynamicStateInfo.pDynamicStates = dynamicStates;
VkGraphicsPipelineCreateInfo pipelineCreateInfo = {};
pipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipelineCreateInfo.layout = g_PipelineLayout;
pipelineCreateInfo.renderPass = g_RenderPass;
pipelineCreateInfo.subpass = 0;
pipelineCreateInfo.pColorBlendState = &colorBlendState;
pipelineCreateInfo.pDynamicState = &dynamicStateInfo;
pipelineCreateInfo.pMultisampleState = &multisampleState;
pipelineCreateInfo.pRasterizationState = &rasterizationState;
pipelineCreateInfo.pViewportState = &viewportState;
pipelineCreateInfo.stageCount = 2;
pipelineCreateInfo.pStages = shaderStages;
CHECK_VK_RESULT(vkCreateGraphicsPipelines(g_Device, g_PipelineCache, 1, &pipelineCreateInfo, nullptr, &g_Pipeline));
That s how i construct the graphics pipeline.According to the spec the VkGraphicsPipelineCreateInfo(3) the * pInputAssemblyState
is a pointer to a VkPipelineInputAssemblyStateCreateInfo structure which determines input assembly behavior, as described in Drawing Commands . It is ignored if the pipeline includes a mesh shader stage.
is it bug of the validation layer?
Yes, this seems to be a bug in the validation layers that has recently been fixed: Fix mesh pipeline validation by ncesario-lunarg · Pull Request #2697 · KhronosGroup/Vulkan-ValidationLayers · GitHub
So you can safely ignore that error.
wow thanks sir. btw your vulkan example is very helpful thank you again
system
Closed
October 19, 2021, 1:57pm
7
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.