1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2022 The Khronos Group Inc.
6 * Copyright (c) 2022 Google LLC
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 Shader invocations tests
23 *//*--------------------------------------------------------------------*/
24
25 #include "vktDrawShaderInvocationTests.hpp"
26 #include "vktTestGroupUtil.hpp"
27 #include "amber/vktAmberTestCase.hpp"
28
29 #include "tcuTestCase.hpp"
30
31 using namespace vk;
32
33 namespace vkt
34 {
35 namespace Draw
36 {
37 namespace
38 {
39
checkHelperInvocationTestSupport(Context & context,std::string testName)40 void checkHelperInvocationTestSupport(Context& context, std::string testName)
41 {
42 DE_UNREF(testName);
43
44 if ((context.getSubgroupProperties().supportedOperations & VK_SUBGROUP_FEATURE_QUAD_BIT) == 0u)
45 {
46 TCU_THROW(NotSupportedError, "Device does not support subgroup quad operations");
47 }
48
49 if (!context.isDeviceFunctionalitySupported("VK_EXT_shader_demote_to_helper_invocation"))
50 {
51 TCU_THROW(NotSupportedError, "VK_EXT_shader_demote_to_helper_invocation not supported.");
52 }
53 }
54
createTests(tcu::TestCaseGroup * testGroup)55 void createTests(tcu::TestCaseGroup* testGroup)
56 {
57 tcu::TestContext& testCtx = testGroup->getTestContext();
58 static const char dataDir[] = "draw/shader_invocation";
59 cts_amber::AmberTestCase* testCase = cts_amber::createAmberTestCase(testCtx, "helper_invocation", "", dataDir, "helper_invocation.amber");
60
61 testCase->setCheckSupportCallback(checkHelperInvocationTestSupport);
62
63 testGroup->addChild(testCase);
64 }
65
66 } // anonymous
67
createShaderInvocationTests(tcu::TestContext & testCtx)68 tcu::TestCaseGroup* createShaderInvocationTests(tcu::TestContext& testCtx)
69 {
70 return createTestGroup(testCtx, "shader_invocation", "Shader Invocation tests", createTests);
71 }
72
73 } // DrawTests
74 } // vkt
75