Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / draw / vktDrawOutputLocationTests.cpp
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2020 Google Inc.
6  * Copyright (c) 2020 The Khronos Group Inc.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  *//*!
21  * \file
22  * \brief Fragment output location tests
23  *//*--------------------------------------------------------------------*/
24
25 #include "vktDrawOutputLocationTests.hpp"
26 #include "vktTestGroupUtil.hpp"
27 #include "amber/vktAmberTestCase.hpp"
28
29 #include "tcuTestCase.hpp"
30
31 #include <string>
32
33 namespace vkt
34 {
35 namespace Draw
36 {
37 namespace
38 {
39
40 void checkSupport (Context& context, std::string testName)
41 {
42         if (context.isDeviceFunctionalitySupported("VK_KHR_portability_subset")
43                 && context.getPortabilitySubsetProperties().minVertexInputBindingStrideAlignment == 4
44                 && (testName.find("r8g8") != std::string::npos || testName.find("inputs-outputs-mod") != std::string::npos))
45         {
46                 TCU_THROW(NotSupportedError, "VK_KHR_portability_subset: Stride is not a multiple of minVertexInputBindingStrideAlignment");
47         }
48 }
49
50 void createTests (tcu::TestCaseGroup* testGroup)
51 {
52 #ifndef CTS_USES_VULKANSC
53         tcu::TestContext& testCtx = testGroup->getTestContext();
54
55         // .array
56         {
57                 tcu::TestCaseGroup* const       array           = new tcu::TestCaseGroup(testCtx, "array", "Test output location array");
58                 static const char                       dataDir[]       = "draw/output_location/array";
59
60                 static const std::string        cases[]         =
61                 {
62                         "b10g11r11-ufloat-pack32-highp",
63                         "b10g11r11-ufloat-pack32-highp-output-float",
64                         "b10g11r11-ufloat-pack32-highp-output-vec2",
65                         "b10g11r11-ufloat-pack32-mediump",
66                         "b10g11r11-ufloat-pack32-mediump-output-float",
67                         "b10g11r11-ufloat-pack32-mediump-output-vec2",
68                         "b8g8r8a8-unorm-highp",
69                         "b8g8r8a8-unorm-highp-output-vec2",
70                         "b8g8r8a8-unorm-highp-output-vec3",
71                         "b8g8r8a8-unorm-mediump",
72                         "b8g8r8a8-unorm-mediump-output-vec2",
73                         "b8g8r8a8-unorm-mediump-output-vec3",
74                         "r16g16-sfloat-highp",
75                         "r16g16-sfloat-highp-output-float",
76                         "r16g16-sfloat-mediump",
77                         "r16g16-sfloat-mediump-output-float",
78                         "r32g32b32a32-sfloat-highp",
79                         "r32g32b32a32-sfloat-highp-output-vec2",
80                         "r32g32b32a32-sfloat-highp-output-vec3",
81                         "r32g32b32a32-sfloat-mediump",
82                         "r32g32b32a32-sfloat-mediump-output-vec2",
83                         "r32g32b32a32-sfloat-mediump-output-vec3",
84                         "r32-sfloat-highp",
85                         "r32-sfloat-mediump",
86                         "r8g8-uint-highp",
87                         "r8g8-uint-highp-output-uint",
88                         "r8g8-uint-mediump",
89                         "r8g8-uint-mediump-output-uint"
90                 };
91
92                 testGroup->addChild(array);
93
94                 for (int i = 0; i < DE_LENGTH_OF_ARRAY(cases); ++i)
95                 {
96                         const std::string                       fileName        = cases[i] + ".amber";
97                         cts_amber::AmberTestCase*       testCase        = cts_amber::createAmberTestCase(testCtx, cases[i].c_str(), "", dataDir, fileName);
98
99                         testCase->setCheckSupportCallback(checkSupport);
100                         array->addChild(testCase);
101                 }
102         }
103
104         // .shuffle
105         {
106                 tcu::TestCaseGroup* const       shuffle         = new tcu::TestCaseGroup(testCtx, "shuffle", "Test output location shuffling");
107                 static const char                       dataDir[]       = "draw/output_location/shuffle";
108
109                 static const std::string        cases[]         =
110                 {
111                         "inputs-outputs",
112                         "inputs-outputs-mod"
113                 };
114
115                 testGroup->addChild(shuffle);
116                 for (int i = 0; i < DE_LENGTH_OF_ARRAY(cases); ++i)
117                 {
118                         const std::string                       fileName        = cases[i] + ".amber";
119                         cts_amber::AmberTestCase*       testCase        = cts_amber::createAmberTestCase(testCtx, cases[i].c_str(), "", dataDir, fileName);
120
121                         shuffle->addChild(testCase);
122                 }
123         }
124 #else
125         DE_UNREF(testGroup);
126 #endif
127 }
128
129 } // anonymous
130
131 tcu::TestCaseGroup* createOutputLocationTests (tcu::TestContext& testCtx)
132 {
133         return createTestGroup(testCtx, "output_location", "Fragment output location tests", createTests);
134 }
135
136 }       // Draw
137 }       // vkt