Skip to content

Commit b55f64c

Browse files
layers: Improve Mesh GPL error message
1 parent 171616e commit b55f64c

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

layers/core_checks/cc_pipeline_graphics.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,17 @@ bool CoreChecks::ValidateGraphicsPipelineVertexInputState(const vvl::Pipeline &p
499499
// Failed to defined a Vertex Input State
500500
if (!pipeline.pre_raster_state) {
501501
skip |= LogError("VUID-VkGraphicsPipelineCreateInfo-flags-08898", device, create_info_loc,
502-
"pVertexInputState and pInputAssemblyState are both NULL so this is an invalid Vertex Input State (no "
503-
"dynamic state or mesh shaders were used to ignore them).");
502+
"pVertexInputState and pInputAssemblyState are both NULL so this is an invalid Vertex Input "
503+
"State.\npVertexInputState can be ignored with VK_DYNAMIC_STATE_VERTEX_INPUT_EXT\npInputAssemblyState "
504+
"can be ignored with VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY, "
505+
"and dynamicPrimitiveTopologyUnrestricted set to VK_TRUE\nIf there is a mesh stage, these are also "
506+
"ignored, but the Vertex Input library can just be skipped if creating a mesh pipeline.");
504507
} else if ((pipeline.active_shaders & VK_SHADER_STAGE_VERTEX_BIT)) {
505508
skip |= LogError("VUID-VkGraphicsPipelineCreateInfo-flags-08897", device, create_info_loc,
506-
"pVertexInputState and pInputAssemblyState are both NULL so this is an invalid Vertex Input State (no "
507-
"dynamic state were used to ignore them).");
509+
"pVertexInputState and pInputAssemblyState are both NULL so this is an invalid Vertex Input "
510+
"State.\npVertexInputState can be ignored with VK_DYNAMIC_STATE_VERTEX_INPUT_EXT\npInputAssemblyState "
511+
"can be ignored with VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY, "
512+
"and dynamicPrimitiveTopologyUnrestricted set to VK_TRUE");
508513
}
509514
} else if (invalid_input_state) {
510515
skip |= LogError("VUID-VkGraphicsPipelineCreateInfo-pStages-02097", device, create_info_loc.dot(Field::pVertexInputState),

tests/unit/graphics_library_positive.cpp

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* http://www.apache.org/licenses/LICENSE-2.0
1212
*/
1313

14+
#include <spirv-tools/libspirv.h>
1415
#include "../framework/layer_validation_tests.h"
1516
#include "../framework/pipeline_helper.h"
1617
#include "../framework/descriptor_helper.h"
@@ -2198,4 +2199,53 @@ TEST_F(PositiveGraphicsLibrary, DestroyImmutableSampler) {
21982199
VkGraphicsPipelineCreateInfo lib_ci = vku::InitStructHelper(&link_info);
21992200
lib_ci.layout = pipeline_layout2;
22002201
vkt::Pipeline exe_pipe(*m_device, lib_ci);
2201-
}
2202+
}
2203+
2204+
TEST_F(PositiveGraphicsLibrary, Mesh) {
2205+
TEST_DESCRIPTION("https://gitlab.khronos.org/vulkan/vulkan/-/issues/4433");
2206+
SetTargetApiVersion(VK_API_VERSION_1_3);
2207+
AddRequiredExtensions(VK_EXT_MESH_SHADER_EXTENSION_NAME);
2208+
AddRequiredFeature(vkt::Feature::meshShader);
2209+
AddRequiredFeature(vkt::Feature::maintenance4);
2210+
RETURN_IF_SKIP(InitBasicGraphicsLibrary());
2211+
InitRenderTarget();
2212+
2213+
VkPipelineLayout layout = VK_NULL_HANDLE;
2214+
2215+
CreatePipelineHelper pre_raster_lib(*this);
2216+
{
2217+
const auto ms_spv = GLSLToSPV(VK_SHADER_STAGE_MESH_BIT_EXT, kMeshMinimalGlsl, SPV_ENV_VULKAN_1_3);
2218+
vkt::GraphicsPipelineLibraryStage ms_stage(ms_spv, VK_SHADER_STAGE_MESH_BIT_EXT);
2219+
pre_raster_lib.InitPreRasterLibInfo(&ms_stage.stage_ci);
2220+
pre_raster_lib.CreateGraphicsPipeline();
2221+
}
2222+
2223+
layout = pre_raster_lib.gp_ci_.layout;
2224+
2225+
CreatePipelineHelper frag_shader_lib(*this);
2226+
{
2227+
const auto fs_spv = GLSLToSPV(VK_SHADER_STAGE_FRAGMENT_BIT, kFragmentMinimalGlsl);
2228+
vkt::GraphicsPipelineLibraryStage fs_stage(fs_spv, VK_SHADER_STAGE_FRAGMENT_BIT);
2229+
frag_shader_lib.InitFragmentLibInfo(&fs_stage.stage_ci);
2230+
frag_shader_lib.gp_ci_.layout = layout;
2231+
frag_shader_lib.CreateGraphicsPipeline(false);
2232+
}
2233+
2234+
CreatePipelineHelper frag_out_lib(*this);
2235+
frag_out_lib.InitFragmentOutputLibInfo();
2236+
frag_out_lib.CreateGraphicsPipeline(false);
2237+
2238+
// Vertex input lib not required for mesh
2239+
VkPipeline libraries[3] = {
2240+
pre_raster_lib,
2241+
frag_shader_lib,
2242+
frag_out_lib,
2243+
};
2244+
VkPipelineLibraryCreateInfoKHR link_info = vku::InitStructHelper();
2245+
link_info.libraryCount = size32(libraries);
2246+
link_info.pLibraries = libraries;
2247+
2248+
VkGraphicsPipelineCreateInfo exe_pipe_ci = vku::InitStructHelper(&link_info);
2249+
exe_pipe_ci.layout = pre_raster_lib.gp_ci_.layout;
2250+
vkt::Pipeline exe_pipe(*m_device, exe_pipe_ci);
2251+
}

0 commit comments

Comments
 (0)