From 30af1c1044be34161e34e46c5d0952da5e494c54 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Wed, 18 Nov 2020 16:12:52 +0100 Subject: [PATCH] Test reading primitive id from frag shader after tessellation 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 | 2 +- android/cts/master/vk-master-2020-03-01.txt | 3 +- android/cts/master/vk-master.txt | 3 +- .../{vertex_only => }/position_to_ssbo.amber | 0 .../amber/pipeline/primitive_id_from_tess.amber | 114 +++++++++++++++++++++ .../modules/vulkan/pipeline/CMakeLists.txt | 4 +- ...ertexOnlyTests.cpp => vktPipelineMiscTests.cpp} | 52 ++++++++-- ...ertexOnlyTests.hpp => vktPipelineMiscTests.hpp} | 8 +- .../modules/vulkan/pipeline/vktPipelineTests.cpp | 4 +- external/vulkancts/mustpass/master/vk-default.txt | 3 +- 10 files changed, 173 insertions(+), 20 deletions(-) rename external/vulkancts/data/vulkan/amber/pipeline/{vertex_only => }/position_to_ssbo.amber (100%) create mode 100644 external/vulkancts/data/vulkan/amber/pipeline/primitive_id_from_tess.amber rename external/vulkancts/modules/vulkan/pipeline/{vktPipelineVertexOnlyTests.cpp => vktPipelineMiscTests.cpp} (55%) rename external/vulkancts/modules/vulkan/pipeline/{vktPipelineVertexOnlyTests.hpp => vktPipelineMiscTests.hpp} (84%) diff --git a/AndroidGen.mk b/AndroidGen.mk index cee1e3d..1b1bec9 100644 --- a/AndroidGen.mk +++ b/AndroidGen.mk @@ -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 \ diff --git a/android/cts/master/vk-master-2020-03-01.txt b/android/cts/master/vk-master-2020-03-01.txt index fffc603..61bb9ef 100644 --- a/android/cts/master/vk-master-2020-03-01.txt +++ b/android/cts/master/vk-master-2020-03-01.txt @@ -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 diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index f121894..0d3475a 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -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/vertex_only/position_to_ssbo.amber b/external/vulkancts/data/vulkan/amber/pipeline/position_to_ssbo.amber similarity index 100% rename from external/vulkancts/data/vulkan/amber/pipeline/vertex_only/position_to_ssbo.amber rename to external/vulkancts/data/vulkan/amber/pipeline/position_to_ssbo.amber 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 index 0000000..db52be5 --- /dev/null +++ b/external/vulkancts/data/vulkan/amber/pipeline/primitive_id_from_tess.amber @@ -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 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 diff --git a/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt b/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt index c239120..a30e396 100644 --- a/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt @@ -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 diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.cpp similarity index 55% rename from external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.cpp rename to external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.cpp index 295d2f7..0a9e53c 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.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 getFeatureList (AmberFeatureFlags flags) +{ + std::vector 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 /external/vulkancts/data/vulkan/amber//.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 requirements = std::vector(1, "Features.vertexPipelineStoresAndAtomics"); + std::vector 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 diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.hpp similarity index 84% rename from external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.hpp rename to external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.hpp index 1a85ebf..0b72c0d 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexOnlyTests.hpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineMiscTests.hpp @@ -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 diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp index c5b4f77..36fc521 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp @@ -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)); diff --git a/external/vulkancts/mustpass/master/vk-default.txt b/external/vulkancts/mustpass/master/vk-default.txt index 06e6437..d88d526 100644 --- a/external/vulkancts/mustpass/master/vk-default.txt +++ b/external/vulkancts/mustpass/master/vk-default.txt @@ -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 -- 2.7.4