1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2019 Google LLC
6 * Copyright (c) 2019 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 SPIR-V signed instruction tests
23 *//*--------------------------------------------------------------------*/
24
25 #include <string>
26
27 #include "vktTestGroupUtil.hpp"
28 #include "vktAmberTestCase.hpp"
29 #include "vktSpvAsmSignedIntCompareTests.hpp"
30
31 namespace vkt
32 {
33 namespace SpirVAssembly
34 {
35 namespace
36 {
37
createSignedOpTests(tcu::TestCaseGroup * tests,const char * data_dir)38 void createSignedOpTests (tcu::TestCaseGroup* tests, const char* data_dir)
39 {
40 tcu::TestContext& testCtx = tests->getTestContext();
41
42 // Shader test files are saved in <path>/external/vulkancts/data/vulkan/amber/<data_dir>/<basename>.amber
43 struct Case {
44 const char* basename;
45 const char* description;
46 };
47 const Case cases[] =
48 {
49 { "glsl_int_findumsb", "32bit signed int with FindUMsb" },
50 { "glsl_int_uclamp", "32bit signed int with UClamp" },
51 { "glsl_int_umax", "32bit signed int with UMax" },
52 { "glsl_int_umin", "32bit signed int with UMin" },
53 { "glsl_uint_findsmsb", "32bit unsigned int with FindSMsb" },
54 { "glsl_uint_sabs", "32bit unsigned int with SAbs" },
55 { "glsl_uint_sclamp", "32bit unsigned int with SClamp" },
56 { "glsl_uint_smax", "32bit unsigned int with SMax" },
57 { "glsl_uint_smin", "32bit unsigned int with SMin" },
58 { "glsl_uint_ssign", "32bit unsigned int with SSign" },
59 { "int_atomicumax", "32bit unsigned int with UMax" },
60 { "int_atomicumin", "32bit unsigned int with UMin" },
61 { "int_ugreaterthan", "32bit unsigned int with UGreaterThanEqual" },
62 { "int_ugreaterthanequal", "32bit unsigned int with UGreaterThanEqual" },
63 { "int_ulessthan", "32bit unsigned int with ULessThan" },
64 { "int_ulessthanequal", "32bit unsigned int with ULessThanEqual" },
65 { "uint_atomicsmax", "32bit unsigned int with SMax" },
66 { "uint_atomicsmin", "32bit unsigned int with SMin" },
67 { "uint_sdiv", "32bit unsigned int with UMax" },
68 { "uint_smulextended", "32bit unsigned int with SMulExtended" },
69 { "uint_snegate", "32bit unsigned int with SNegate" },
70 };
71 for (unsigned i = 0; i < sizeof(cases)/sizeof(cases[0]) ; ++i)
72 {
73 std::string file = std::string(cases[i].basename) + ".amber";
74 cts_amber::AmberTestCase *testCase = cts_amber::createAmberTestCase(testCtx, cases[i].basename, cases[i].description, data_dir, file);
75
76 tests->addChild(testCase);
77 }
78 }
79
80 } // anonymous
81
createSignedOpTestsGroup(tcu::TestContext & testCtx)82 tcu::TestCaseGroup* createSignedOpTestsGroup (tcu::TestContext& testCtx)
83 {
84 // Location of the Amber script files under the data/vulkan/amber source tree.
85 const char* data_dir = "spirv_assembly/instruction/compute/signed_op";
86 return createTestGroup(testCtx, "signed_op", "Signed op over uint values", createSignedOpTests, data_dir);
87 }
88
89 } // SpirVAssembly
90 } // vkt
91