layers: Add simple VS/FS positive test, and a tess matching test
We didn't have a positive test which didn't exercise the VI path. This
hid from us that we were actually failing validation due to the test
framework passing a null VICI. This used to be a valid thing to do.
Tess matching test exercises interface matching fix.
Signed-off-by: Chris Forbes <chrisforbes@google.com>
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index e27f975..e6f5391 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -5867,6 +5867,118 @@
}
}
+TEST_F(VkLayerTest, CreatePipelineSimplePositive)
+{
+ m_errorMonitor->SetDesiredFailureMsg(~0u, "");
+
+ ASSERT_NO_FATAL_FAILURE(InitState());
+ ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
+
+ char const *vsSource =
+ "#version 450\n"
+ "out gl_PerVertex {\n"
+ " vec4 gl_Position;\n"
+ "};\n"
+ "void main(){\n"
+ " gl_Position = vec4(0);\n"
+ "}\n";
+ char const *fsSource =
+ "#version 450\n"
+ "\n"
+ "layout(location=0) out vec4 color;\n"
+ "void main(){\n"
+ " color = vec4(1);\n"
+ "}\n";
+
+ VkShaderObj vs(m_device, vsSource, VK_SHADER_STAGE_VERTEX_BIT, this);
+ VkShaderObj fs(m_device, fsSource, VK_SHADER_STAGE_FRAGMENT_BIT, this);
+
+ VkPipelineObj pipe(m_device);
+ pipe.AddColorAttachment();
+ pipe.AddShader(&vs);
+ pipe.AddShader(&fs);
+
+ VkDescriptorSetObj descriptorSet(m_device);
+ descriptorSet.AppendDummy();
+ descriptorSet.CreateVKDescriptorSet(m_commandBuffer);
+
+ pipe.CreateVKPipeline(descriptorSet.GetPipelineLayout(), renderPass());
+
+ if (m_errorMonitor->DesiredMsgFound()) {
+ FAIL() << "Expected to succeed but: " <<
+m_errorMonitor->GetFailureMsg();
+ m_errorMonitor->DumpFailureMsgs();
+ }
+}
+
+TEST_F(VkLayerTest, CreatePipelineTessPerVertex)
+{
+ m_errorMonitor->SetDesiredFailureMsg(~0u, "");
+
+ ASSERT_NO_FATAL_FAILURE(InitState());
+ ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
+
+ char const *vsSource =
+ "#version 450\n"
+ "void main(){}\n";
+ char const *tcsSource =
+ "#version 450\n"
+ "layout(location=0) out int x[];\n"
+ "layout(vertices=3) out;\n"
+ "void main(){\n"
+ " gl_TessLevelOuter[0] = gl_TessLevelOuter[1] = gl_TessLevelOuter[2] = 1;\n"
+ " gl_TessLevelInner[0] = 1;\n"
+ " x[gl_InvocationID] = gl_InvocationID;\n"
+ "}\n";
+ char const *tesSource =
+ "#version 450\n"
+ "layout(triangles, equal_spacing, cw) in;\n"
+ "layout(location=0) in int x[];\n"
+ "out gl_PerVertex { vec4 gl_Position; };\n"
+ "void main(){\n"
+ " gl_Position.xyz = gl_TessCoord;\n"
+ " gl_Position.w = x[0] + x[1] + x[2];\n"
+ "}\n";
+ char const *fsSource =
+ "#version 450\n"
+ "layout(location=0) out vec4 color;\n"
+ "void main(){\n"
+ " color = vec4(1);\n"
+ "}\n";
+
+ VkShaderObj vs(m_device, vsSource, VK_SHADER_STAGE_VERTEX_BIT, this);
+ VkShaderObj tcs(m_device, tcsSource, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, this);
+ VkShaderObj tes(m_device, tesSource, VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, this);
+ VkShaderObj fs(m_device, fsSource, VK_SHADER_STAGE_FRAGMENT_BIT, this);
+
+ VkPipelineInputAssemblyStateCreateInfo iasci{
+ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
+ nullptr,
+ 0,
+ VK_PRIMITIVE_TOPOLOGY_PATCH_LIST,
+ VK_FALSE};
+
+ VkPipelineObj pipe(m_device);
+ pipe.SetInputAssembly(&iasci);
+ pipe.AddColorAttachment();
+ pipe.AddShader(&vs);
+ pipe.AddShader(&tcs);
+ pipe.AddShader(&tes);
+ pipe.AddShader(&fs);
+
+ VkDescriptorSetObj descriptorSet(m_device);
+ descriptorSet.AppendDummy();
+ descriptorSet.CreateVKDescriptorSet(m_commandBuffer);
+
+ pipe.CreateVKPipeline(descriptorSet.GetPipelineLayout(), renderPass());
+
+ if (m_errorMonitor->DesiredMsgFound()) {
+ m_errorMonitor->DumpFailureMsgs();
+ FAIL() << "Expected to succeed but: " <<
+m_errorMonitor->GetFailureMsg();
+ }
+}
+
TEST_F(VkLayerTest, CreatePipelineAttribBindingConflict) {
m_errorMonitor->SetDesiredFailureMsg(
VK_DEBUG_REPORT_ERROR_BIT_EXT,