• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 int compare on unsigned scalars values.  Google bug b/73133282
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 
createSignedIntCompareTests(tcu::TestCaseGroup * tests,const char * data_dir)38 void createSignedIntCompareTests (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 		{ "uint_sgreaterthanequal", "32bit unsigned int with OpSGreaterThanEqual" },
50 		{ "uint_sgreaterthan", "32bit unsigned int with OpSGreaterThan" },
51 		{ "uint_slessthan", "32bit unsigned int with OpSLessThan" },
52 		{ "uint_slessthanequal", "32bit unsigned int with OpSLessThanEqual" }
53 		// For testing fail-to-parse case:
54 		//, { "foo", "Amber syntax error" }
55 	};
56 
57 	for (unsigned i = 0; i < sizeof(cases)/sizeof(cases[0]) ; ++i)
58 	{
59 		std::string					file		= std::string(cases[i].basename) + ".amber";
60 		cts_amber::AmberTestCase	*testCase	= cts_amber::createAmberTestCase(testCtx, cases[i].basename, cases[i].description, data_dir, file);
61 
62 		tests->addChild(testCase);
63 	}
64 }
65 
66 } // anonymous
67 
createSignedIntCompareGroup(tcu::TestContext & testCtx)68 tcu::TestCaseGroup* createSignedIntCompareGroup (tcu::TestContext& testCtx)
69 {
70 	// Location of the Amber script files under the data/vulkan/amber source tree.
71 	const char* data_dir = "spirv_assembly/instruction/compute/signed_int_compare";
72 	return createTestGroup(testCtx, "signed_int_compare", "Signed int compare over uint values", createSignedIntCompareTests, data_dir);
73 }
74 
75 } // SpirVAssembly
76 } // vkt
77