Test reading primitive id from frag shader after tessellation
authorRicardo Garcia <rgarcia@igalia.com>
Wed, 18 Nov 2020 15:12:52 +0000 (16:12 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 3 Dec 2020 08:15:41 +0000 (03:15 -0500)
Add a test that tries to read the primitive id from the fragment shader
in a pipeline that has tessellation shaders but no geometry shaders.

The new test has been grouped together with the existing Amber vertex
only test in a single group containing miscellaneous pipeline tests.

New test:
dEQP-VK.pipeline.misc.primitive_id_from_tess

Renamed test:
-dEQP-VK.pipeline.vertex_only.position_to_ssbo
+dEQP-VK.pipeline.misc.position_to_ssbo

Components: Vulkan
VK-GL-CTS issue: 2654

Change-Id: Ied0fef78916ee83960c689bfd2a7e48dc4b4cfd0

AndroidGen.mk
android/cts/master/vk-master-2020-03-01.txt
android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/pipeline/position_to_ssbo.amber [moved from external/vulkancts/data/vulkan/amber/pipeline/vertex_only/position_to_ssbo.amber with 100% similarity]
external/vulkancts/data/vulkan/amber/pipeline/primitive_id_from_tess.amber [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt
external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.cpp [moved from external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.cpp with 55% similarity]
external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.hpp [moved from external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.hpp with 84% similarity]
external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp
external/vulkancts/mustpass/master/vk-default.txt

index cee1e3d..1b1bec9 100644 (file)
@@ -217,6 +217,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineMakeUtil.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineMatchedAttachmentsTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineMaxVaryingsTests.cpp \
+       external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBase.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolve.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleBaseResolveAndPerSampleFetch.cpp \
@@ -241,7 +242,6 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineTimestampTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexInputTests.cpp \
-       external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.cpp \
        external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.cpp \
        external/vulkancts/modules/vulkan/postmortem/vktPostmortemShaderTimeoutTests.cpp \
        external/vulkancts/modules/vulkan/postmortem/vktPostmortemTests.cpp \
index fffc603..61bb9ef 100644 (file)
@@ -136589,7 +136589,8 @@ dEQP-VK.pipeline.executable_properties.compute.compute_stage
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_statistics
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_internal_representations
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_statistics_internal_representations
-dEQP-VK.pipeline.vertex_only.position_to_ssbo
+dEQP-VK.pipeline.misc.position_to_ssbo
+dEQP-VK.pipeline.misc.primitive_id_from_tess
 dEQP-VK.pipeline.max_varyings.test_vertex_io_between_vertex_fragment
 dEQP-VK.pipeline.max_varyings.test_fragment_io_between_vertex_fragment
 dEQP-VK.pipeline.max_varyings.test_tess_eval_io_between_tess_eval_fragment
index f121894..0d3475a 100644 (file)
@@ -313602,7 +313602,8 @@ dEQP-VK.pipeline.executable_properties.compute.compute_stage
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_statistics
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_internal_representations
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_statistics_internal_representations
-dEQP-VK.pipeline.vertex_only.position_to_ssbo
+dEQP-VK.pipeline.misc.position_to_ssbo
+dEQP-VK.pipeline.misc.primitive_id_from_tess
 dEQP-VK.pipeline.max_varyings.test_vertex_io_between_vertex_fragment
 dEQP-VK.pipeline.max_varyings.test_fragment_io_between_vertex_fragment
 dEQP-VK.pipeline.max_varyings.test_tess_eval_io_between_tess_eval_fragment
diff --git a/external/vulkancts/data/vulkan/amber/pipeline/primitive_id_from_tess.amber b/external/vulkancts/data/vulkan/amber/pipeline/primitive_id_from_tess.amber
new file mode 100644 (file)
index 0000000..db52be5
--- /dev/null
@@ -0,0 +1,114 @@
+#!amber
+#
+# Copyright 2020 The Khronos Group Inc.
+# Copyright 2020 Valve Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEVICE_FEATURE geometryShader
+DEVICE_FEATURE tessellationShader
+
+SHADER vertex vert GLSL
+#version 450
+layout (location=0) in vec4 in_pos;
+void main(void)
+{
+    gl_Position = in_pos;
+}
+END
+
+SHADER tessellation_control tesc GLSL
+#version 450
+layout (vertices = 3) out;
+void main(void)
+{
+    gl_TessLevelInner[0] = 1.0;
+    gl_TessLevelInner[1] = 1.0;
+    gl_TessLevelOuter[0] = 1.0;
+    gl_TessLevelOuter[1] = 1.0;
+    gl_TessLevelOuter[2] = 1.0;
+    gl_TessLevelOuter[3] = 1.0;
+
+    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+}
+END
+
+SHADER tessellation_evaluation tese GLSL
+#version 450
+layout (triangles, fractional_odd_spacing, cw) in;
+void main(void)
+{
+    gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) +
+                  (gl_TessCoord.y * gl_in[1].gl_Position) +
+                  (gl_TessCoord.z * gl_in[2].gl_Position);
+}
+END
+
+SHADER fragment frag GLSL
+#version 450
+layout (location=0) out vec4 out_color;
+void main(void)
+{
+    vec4 primitive_color;
+    switch (gl_PrimitiveID) {
+        case 0:
+        case 1:
+            primitive_color = vec4(0, 0, 1, 1);
+            break;
+        case 2:
+        case 3:
+            primitive_color = vec4(1, 0, 1, 1);
+            break;
+        default:
+            primitive_color = vec4(0, 0, 0, 1);
+            break;
+    }
+    out_color = primitive_color;
+}
+END
+
+BUFFER position DATA_TYPE vec4<float> DATA
+-1 -1 0 1
+ 1 -1 0 1
+-1  0 0 1
+
+-1  0 0 1
+ 1 -1 0 1
+ 1  0 0 1
+
+-1  0 0 1
+ 1  0 0 1
+-1  1 0 1
+
+-1  1 0 1
+ 1  0 0 1
+ 1  1 0 1
+
+END
+
+BUFFER framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics graphics_pipeline
+  ATTACH vert
+  ATTACH tesc
+  ATTACH tese
+  ATTACH frag
+  VERTEX_DATA position LOCATION 0
+  BIND BUFFER framebuffer AS color LOCATION 0
+END
+
+CLEAR_COLOR graphics_pipeline 255 255 255 255
+CLEAR graphics_pipeline
+RUN graphics_pipeline DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 12
+EXPECT framebuffer IDX 0 0   SIZE 250 125 EQ_RGBA 0   0 255 255
+EXPECT framebuffer IDX 0 125 SIZE 250 125 EQ_RGBA 255 0 255 255
index c239120..a30e396 100644 (file)
@@ -76,8 +76,8 @@ set(DEQP_VK_PIPELINE_SRCS
        vktPipelineVertexInputTests.hpp
        vktPipelineTimestampTests.cpp
        vktPipelineTimestampTests.hpp
-       vktPipelineVertexOnlyTests.cpp
-       vktPipelineVertexOnlyTests.hpp
+       vktPipelineMiscTests.cpp
+       vktPipelineMiscTests.hpp
        vktPipelineVertexUtil.cpp
        vktPipelineVertexUtil.hpp
        vktPipelineCacheTests.cpp
@@ -26,7 +26,7 @@
 
 #include "vktTestGroupUtil.hpp"
 #include "vktAmberTestCase.hpp"
-#include "vktPipelineVertexOnlyTests.hpp"
+#include "vktPipelineMiscTests.hpp"
 
 namespace vkt
 {
@@ -35,24 +35,60 @@ namespace pipeline
 namespace
 {
 
+enum AmberFeatureBits
+{
+       AMBER_FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS        = (1 << 0),
+       AMBER_FEATURE_TESSELATION_SHADER                                        = (1 << 1),
+       AMBER_FEATURE_GEOMETRY_SHADER                                           = (1 << 2),
+};
+
+using AmberFeatureFlags = deUint32;
+
+std::vector<std::string> getFeatureList (AmberFeatureFlags flags)
+{
+       std::vector<std::string> requirements;
+
+       if (flags & AMBER_FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS)
+               requirements.push_back("Features.vertexPipelineStoresAndAtomics");
+
+       if (flags & AMBER_FEATURE_TESSELATION_SHADER)
+               requirements.push_back("Features.tessellationShader");
+
+       if (flags & AMBER_FEATURE_GEOMETRY_SHADER)
+               requirements.push_back("Features.geometryShader");
+
+       return requirements;
+}
+
 void addTests (tcu::TestCaseGroup* tests, const char* data_dir)
 {
        tcu::TestContext& testCtx = tests->getTestContext();
 
        // Shader test files are saved in <path>/external/vulkancts/data/vulkan/amber/<data_dir>/<basename>.amber
        struct Case {
-               const char* basename;
-               const char* description;
+               const char*                     basename;
+               const char*                     description;
+               AmberFeatureFlags       flags;
        };
+
        const Case cases[] =
        {
-               { "position_to_ssbo", "Write position data into ssbo" }
+               {
+                       "position_to_ssbo",
+                       "Write position data into ssbo using only the vertex shader in a pipeline",
+                       (AMBER_FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS),
+               },
+               {
+                       "primitive_id_from_tess",
+                       "Read primitive id from tessellation shaders without a geometry shader",
+                       (AMBER_FEATURE_TESSELATION_SHADER | AMBER_FEATURE_GEOMETRY_SHADER),
+               },
        };
 
        for (unsigned i = 0; i < DE_LENGTH_OF_ARRAY(cases) ; ++i)
        {
                std::string                                     file                    = std::string(cases[i].basename) + ".amber";
-               std::vector<std::string>        requirements    = std::vector<std::string>(1, "Features.vertexPipelineStoresAndAtomics");
+               std::vector<std::string>        requirements    = getFeatureList(cases[i].flags);
                cts_amber::AmberTestCase        *testCase               = cts_amber::createAmberTestCase(testCtx, cases[i].basename, cases[i].description, data_dir, file, requirements);
 
                tests->addChild(testCase);
@@ -61,11 +97,11 @@ void addTests (tcu::TestCaseGroup* tests, const char* data_dir)
 
 } // anonymous
 
-tcu::TestCaseGroup* createVertexOnlyTests (tcu::TestContext& testCtx)
+tcu::TestCaseGroup* createMiscTests (tcu::TestContext& testCtx)
 {
        // Location of the Amber script files under the data/vulkan/amber source tree.
-       const char* data_dir = "pipeline/vertex_only";
-       return createTestGroup(testCtx, "vertex_only", "Tests using only vertex shader in a pipeline", addTests, data_dir);
+       const char* data_dir = "pipeline";
+       return createTestGroup(testCtx, "misc", "Miscellaneous pipeline tests", addTests, data_dir);
 }
 
 } // SpirVAssembly
@@ -1,5 +1,5 @@
-#ifndef _VKTPIPELINEVERTEXONLYTESTS_HPP
-#define _VKTPIPELINEVERTEXONLYTESTS_HPP
+#ifndef _VKTPIPELINEMISCTESTS_HPP
+#define _VKTPIPELINEMISCTESTS_HPP
 /*------------------------------------------------------------------------
  * Vulkan Conformance Tests
  * ------------------------
@@ -32,9 +32,9 @@ namespace vkt
 namespace pipeline
 {
 
-tcu::TestCaseGroup*    createVertexOnlyTests (tcu::TestContext& testCtx);
+tcu::TestCaseGroup*    createMiscTests (tcu::TestContext& testCtx);
 
 } // pipeline
 } // vkt
 
-#endif // _VKTPIPELINEVERTEXONLYTESTS_HPP
+#endif // _VKTPIPELINEMISCTESTS_HPP
index c5b4f77..36fc521 100644 (file)
@@ -49,7 +49,7 @@
 #include "vktPipelineCreationFeedbackTests.hpp"
 #include "vktPipelineDepthRangeUnrestrictedTests.hpp"
 #include "vktPipelineExecutablePropertiesTests.hpp"
-#include "vktPipelineVertexOnlyTests.hpp"
+#include "vktPipelineMiscTests.hpp"
 #include "vktPipelineMaxVaryingsTests.hpp"
 #include "vktPipelineBlendOperationAdvancedTests.hpp"
 #include "vktPipelineExtendedDynamicStateTests.hpp"
@@ -94,7 +94,7 @@ void createChildren (tcu::TestCaseGroup* pipelineTests)
        pipelineTests->addChild(createCreationFeedbackTests                     (testCtx));
        pipelineTests->addChild(createDepthRangeUnrestrictedTests       (testCtx));
        pipelineTests->addChild(createExecutablePropertiesTests         (testCtx));
-       pipelineTests->addChild(createVertexOnlyTests                           (testCtx));
+       pipelineTests->addChild(createMiscTests                                         (testCtx));
        pipelineTests->addChild(createMaxVaryingsTests                          (testCtx));
        pipelineTests->addChild(createBlendOperationAdvancedTests       (testCtx));
        pipelineTests->addChild(createExtendedDynamicStateTests         (testCtx));
index 06e6437..d88d526 100644 (file)
@@ -313612,7 +313612,8 @@ dEQP-VK.pipeline.executable_properties.compute.compute_stage
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_statistics
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_internal_representations
 dEQP-VK.pipeline.executable_properties.compute.compute_stage_statistics_internal_representations
-dEQP-VK.pipeline.vertex_only.position_to_ssbo
+dEQP-VK.pipeline.misc.position_to_ssbo
+dEQP-VK.pipeline.misc.primitive_id_from_tess
 dEQP-VK.pipeline.max_varyings.test_vertex_io_between_vertex_fragment
 dEQP-VK.pipeline.max_varyings.test_fragment_io_between_vertex_fragment
 dEQP-VK.pipeline.max_varyings.test_tess_eval_io_between_tess_eval_fragment