1fd4e5da5Sopenharmony_ci// Copyright (c) 2018 Google LLC.
2fd4e5da5Sopenharmony_ci// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights
3fd4e5da5Sopenharmony_ci// reserved.
4fd4e5da5Sopenharmony_ci//
5fd4e5da5Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License");
6fd4e5da5Sopenharmony_ci// you may not use this file except in compliance with the License.
7fd4e5da5Sopenharmony_ci// You may obtain a copy of the License at
8fd4e5da5Sopenharmony_ci//
9fd4e5da5Sopenharmony_ci//     http://www.apache.org/licenses/LICENSE-2.0
10fd4e5da5Sopenharmony_ci//
11fd4e5da5Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software
12fd4e5da5Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS,
13fd4e5da5Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14fd4e5da5Sopenharmony_ci// See the License for the specific language governing permissions and
15fd4e5da5Sopenharmony_ci// limitations under the License.
16fd4e5da5Sopenharmony_ci
17fd4e5da5Sopenharmony_ci// Tests validation rules of GLSL.450.std and OpenCL.std extended instructions.
18fd4e5da5Sopenharmony_ci// Doesn't test OpenCL.std vector size 2, 3, 4, 8 or 16 rules (not supported
19fd4e5da5Sopenharmony_ci// by standard SPIR-V).
20fd4e5da5Sopenharmony_ci
21fd4e5da5Sopenharmony_ci#include <cstring>
22fd4e5da5Sopenharmony_ci#include <sstream>
23fd4e5da5Sopenharmony_ci#include <string>
24fd4e5da5Sopenharmony_ci#include <tuple>
25fd4e5da5Sopenharmony_ci#include <utility>
26fd4e5da5Sopenharmony_ci#include <vector>
27fd4e5da5Sopenharmony_ci
28fd4e5da5Sopenharmony_ci#include "gmock/gmock.h"
29fd4e5da5Sopenharmony_ci#include "source/spirv_target_env.h"
30fd4e5da5Sopenharmony_ci#include "test/unit_spirv.h"
31fd4e5da5Sopenharmony_ci#include "test/val/val_code_generator.h"
32fd4e5da5Sopenharmony_ci#include "test/val/val_fixtures.h"
33fd4e5da5Sopenharmony_ci
34fd4e5da5Sopenharmony_cinamespace spvtools {
35fd4e5da5Sopenharmony_cinamespace val {
36fd4e5da5Sopenharmony_cinamespace {
37fd4e5da5Sopenharmony_ci
38fd4e5da5Sopenharmony_cistruct TestResult {
39fd4e5da5Sopenharmony_ci  TestResult(spv_result_t in_validation_result = SPV_SUCCESS,
40fd4e5da5Sopenharmony_ci             const char* in_error_str = nullptr,
41fd4e5da5Sopenharmony_ci             const char* in_error_str2 = nullptr)
42fd4e5da5Sopenharmony_ci      : validation_result(in_validation_result),
43fd4e5da5Sopenharmony_ci        error_str(in_error_str),
44fd4e5da5Sopenharmony_ci        error_str2(in_error_str2) {}
45fd4e5da5Sopenharmony_ci  spv_result_t validation_result;
46fd4e5da5Sopenharmony_ci  const char* error_str;
47fd4e5da5Sopenharmony_ci  const char* error_str2;
48fd4e5da5Sopenharmony_ci};
49fd4e5da5Sopenharmony_ci
50fd4e5da5Sopenharmony_ciusing ::testing::Combine;
51fd4e5da5Sopenharmony_ciusing ::testing::HasSubstr;
52fd4e5da5Sopenharmony_ciusing ::testing::Not;
53fd4e5da5Sopenharmony_ciusing ::testing::Values;
54fd4e5da5Sopenharmony_ciusing ::testing::ValuesIn;
55fd4e5da5Sopenharmony_ci
56fd4e5da5Sopenharmony_ciusing ValidateBuiltIns = spvtest::ValidateBase<bool>;
57fd4e5da5Sopenharmony_ciusing ValidateVulkanSubgroupBuiltIns =
58fd4e5da5Sopenharmony_ci    spvtest::ValidateBase<std::tuple<const char*, const char*, const char*,
59fd4e5da5Sopenharmony_ci                                     const char*, const char*, TestResult>>;
60fd4e5da5Sopenharmony_ciusing ValidateVulkanCombineBuiltInExecutionModelDataTypeResult =
61fd4e5da5Sopenharmony_ci    spvtest::ValidateBase<std::tuple<const char*, const char*, const char*,
62fd4e5da5Sopenharmony_ci                                     const char*, const char*, TestResult>>;
63fd4e5da5Sopenharmony_ciusing ValidateVulkanCombineBuiltInArrayedVariable =
64fd4e5da5Sopenharmony_ci    spvtest::ValidateBase<std::tuple<const char*, const char*, const char*,
65fd4e5da5Sopenharmony_ci                                     const char*, const char*, TestResult>>;
66fd4e5da5Sopenharmony_ciusing ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult =
67fd4e5da5Sopenharmony_ci    spvtest::ValidateBase<
68fd4e5da5Sopenharmony_ci        std::tuple<const char*, const char*, const char*, const char*,
69fd4e5da5Sopenharmony_ci                   const char*, const char*, const char*, TestResult>>;
70fd4e5da5Sopenharmony_ci
71fd4e5da5Sopenharmony_ciusing ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult =
72fd4e5da5Sopenharmony_ci    spvtest::ValidateBase<std::tuple<spv_target_env, const char*, const char*,
73fd4e5da5Sopenharmony_ci                                     const char*, const char*, const char*,
74fd4e5da5Sopenharmony_ci                                     const char*, const char*, TestResult>>;
75fd4e5da5Sopenharmony_ci
76fd4e5da5Sopenharmony_cibool InitializerRequired(const char* const storage_class) {
77fd4e5da5Sopenharmony_ci  return (strncmp(storage_class, "Output", 6) == 0 ||
78fd4e5da5Sopenharmony_ci          strncmp(storage_class, "Private", 7) == 0 ||
79fd4e5da5Sopenharmony_ci          strncmp(storage_class, "Function", 8) == 0);
80fd4e5da5Sopenharmony_ci}
81fd4e5da5Sopenharmony_ci
82fd4e5da5Sopenharmony_ciCodeGenerator GetInMainCodeGenerator(const char* const built_in,
83fd4e5da5Sopenharmony_ci                                     const char* const execution_model,
84fd4e5da5Sopenharmony_ci                                     const char* const storage_class,
85fd4e5da5Sopenharmony_ci                                     const char* const capabilities,
86fd4e5da5Sopenharmony_ci                                     const char* const extensions,
87fd4e5da5Sopenharmony_ci                                     const char* const data_type) {
88fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
89fd4e5da5Sopenharmony_ci
90fd4e5da5Sopenharmony_ci  if (capabilities) {
91fd4e5da5Sopenharmony_ci    generator.capabilities_ += capabilities;
92fd4e5da5Sopenharmony_ci  }
93fd4e5da5Sopenharmony_ci  if (extensions) {
94fd4e5da5Sopenharmony_ci    generator.extensions_ += extensions;
95fd4e5da5Sopenharmony_ci  }
96fd4e5da5Sopenharmony_ci
97fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(OpDecorate %built_in_type Block
98fd4e5da5Sopenharmony_ci                               OpMemberDecorate %built_in_type 0 BuiltIn )";
99fd4e5da5Sopenharmony_ci  generator.before_types_ += built_in;
100fd4e5da5Sopenharmony_ci  generator.before_types_ += "\n";
101fd4e5da5Sopenharmony_ci
102fd4e5da5Sopenharmony_ci  std::ostringstream after_types;
103fd4e5da5Sopenharmony_ci
104fd4e5da5Sopenharmony_ci  after_types << "%built_in_type = OpTypeStruct " << data_type << "\n";
105fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
106fd4e5da5Sopenharmony_ci    after_types << "%built_in_null = OpConstantNull %built_in_type\n";
107fd4e5da5Sopenharmony_ci  }
108fd4e5da5Sopenharmony_ci  after_types << "%built_in_ptr = OpTypePointer " << storage_class
109fd4e5da5Sopenharmony_ci              << " %built_in_type\n";
110fd4e5da5Sopenharmony_ci  after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class;
111fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
112fd4e5da5Sopenharmony_ci    after_types << " %built_in_null";
113fd4e5da5Sopenharmony_ci  }
114fd4e5da5Sopenharmony_ci  after_types << "\n";
115fd4e5da5Sopenharmony_ci  after_types << "%data_ptr = OpTypePointer " << storage_class << " "
116fd4e5da5Sopenharmony_ci              << data_type << "\n";
117fd4e5da5Sopenharmony_ci  generator.after_types_ = after_types.str();
118fd4e5da5Sopenharmony_ci
119fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
120fd4e5da5Sopenharmony_ci  entry_point.name = "main";
121fd4e5da5Sopenharmony_ci  entry_point.execution_model = execution_model;
122fd4e5da5Sopenharmony_ci  if (strncmp(storage_class, "Input", 5) == 0 ||
123fd4e5da5Sopenharmony_ci      strncmp(storage_class, "Output", 6) == 0) {
124fd4e5da5Sopenharmony_ci    entry_point.interfaces = "%built_in_var";
125fd4e5da5Sopenharmony_ci  }
126fd4e5da5Sopenharmony_ci
127fd4e5da5Sopenharmony_ci  std::ostringstream execution_modes;
128fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Fragment")) {
129fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
130fd4e5da5Sopenharmony_ci                    << " OriginUpperLeft\n";
131fd4e5da5Sopenharmony_ci    if (0 == std::strcmp(built_in, "FragDepth")) {
132fd4e5da5Sopenharmony_ci      execution_modes << "OpExecutionMode %" << entry_point.name
133fd4e5da5Sopenharmony_ci                      << " DepthReplacing\n";
134fd4e5da5Sopenharmony_ci    }
135fd4e5da5Sopenharmony_ci  }
136fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Geometry")) {
137fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
138fd4e5da5Sopenharmony_ci                    << " InputPoints\n";
139fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
140fd4e5da5Sopenharmony_ci                    << " OutputPoints\n";
141fd4e5da5Sopenharmony_ci  }
142fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "GLCompute")) {
143fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
144fd4e5da5Sopenharmony_ci                    << " LocalSize 1 1 1\n";
145fd4e5da5Sopenharmony_ci  }
146fd4e5da5Sopenharmony_ci  entry_point.execution_modes = execution_modes.str();
147fd4e5da5Sopenharmony_ci
148fd4e5da5Sopenharmony_ci  entry_point.body = R"(
149fd4e5da5Sopenharmony_ci%ptr = OpAccessChain %data_ptr %built_in_var %u32_0
150fd4e5da5Sopenharmony_ci)";
151fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
152fd4e5da5Sopenharmony_ci
153fd4e5da5Sopenharmony_ci  return generator;
154fd4e5da5Sopenharmony_ci}
155fd4e5da5Sopenharmony_ci
156fd4e5da5Sopenharmony_ciTEST_P(ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, InMain) {
157fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
158fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
159fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
160fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
161fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<4>(GetParam());
162fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<5>(GetParam());
163fd4e5da5Sopenharmony_ci
164fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetInMainCodeGenerator(
165fd4e5da5Sopenharmony_ci      built_in, execution_model, storage_class, NULL, NULL, data_type);
166fd4e5da5Sopenharmony_ci
167fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
168fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
169fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
170fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
171fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
172fd4e5da5Sopenharmony_ci  }
173fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
174fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
175fd4e5da5Sopenharmony_ci  }
176fd4e5da5Sopenharmony_ci  if (vuid) {
177fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
178fd4e5da5Sopenharmony_ci  }
179fd4e5da5Sopenharmony_ci}
180fd4e5da5Sopenharmony_ci
181fd4e5da5Sopenharmony_ciTEST_P(
182fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
183fd4e5da5Sopenharmony_ci    InMain) {
184fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
185fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
186fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
187fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
188fd4e5da5Sopenharmony_ci  const char* const capabilities = std::get<4>(GetParam());
189fd4e5da5Sopenharmony_ci  const char* const extensions = std::get<5>(GetParam());
190fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<6>(GetParam());
191fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<7>(GetParam());
192fd4e5da5Sopenharmony_ci
193fd4e5da5Sopenharmony_ci  CodeGenerator generator =
194fd4e5da5Sopenharmony_ci      GetInMainCodeGenerator(built_in, execution_model, storage_class,
195fd4e5da5Sopenharmony_ci                             capabilities, extensions, data_type);
196fd4e5da5Sopenharmony_ci
197fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
198fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
199fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
200fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
201fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
202fd4e5da5Sopenharmony_ci  }
203fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
204fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
205fd4e5da5Sopenharmony_ci  }
206fd4e5da5Sopenharmony_ci  if (vuid) {
207fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
208fd4e5da5Sopenharmony_ci  }
209fd4e5da5Sopenharmony_ci}
210fd4e5da5Sopenharmony_ci
211fd4e5da5Sopenharmony_ciTEST_P(
212fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
213fd4e5da5Sopenharmony_ci    InMain) {
214fd4e5da5Sopenharmony_ci  const spv_target_env env = std::get<0>(GetParam());
215fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<1>(GetParam());
216fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<2>(GetParam());
217fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<3>(GetParam());
218fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<4>(GetParam());
219fd4e5da5Sopenharmony_ci  const char* const capabilities = std::get<5>(GetParam());
220fd4e5da5Sopenharmony_ci  const char* const extensions = std::get<6>(GetParam());
221fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<7>(GetParam());
222fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<8>(GetParam());
223fd4e5da5Sopenharmony_ci
224fd4e5da5Sopenharmony_ci  CodeGenerator generator =
225fd4e5da5Sopenharmony_ci      GetInMainCodeGenerator(built_in, execution_model, storage_class,
226fd4e5da5Sopenharmony_ci                             capabilities, extensions, data_type);
227fd4e5da5Sopenharmony_ci
228fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), env);
229fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result, ValidateInstructions(env));
230fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
231fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
232fd4e5da5Sopenharmony_ci  }
233fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
234fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
235fd4e5da5Sopenharmony_ci  }
236fd4e5da5Sopenharmony_ci  if (vuid) {
237fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
238fd4e5da5Sopenharmony_ci  }
239fd4e5da5Sopenharmony_ci}
240fd4e5da5Sopenharmony_ci
241fd4e5da5Sopenharmony_ciCodeGenerator GetInFunctionCodeGenerator(const char* const built_in,
242fd4e5da5Sopenharmony_ci                                         const char* const execution_model,
243fd4e5da5Sopenharmony_ci                                         const char* const storage_class,
244fd4e5da5Sopenharmony_ci                                         const char* const capabilities,
245fd4e5da5Sopenharmony_ci                                         const char* const extensions,
246fd4e5da5Sopenharmony_ci                                         const char* const data_type) {
247fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
248fd4e5da5Sopenharmony_ci
249fd4e5da5Sopenharmony_ci  if (capabilities) {
250fd4e5da5Sopenharmony_ci    generator.capabilities_ += capabilities;
251fd4e5da5Sopenharmony_ci  }
252fd4e5da5Sopenharmony_ci  if (extensions) {
253fd4e5da5Sopenharmony_ci    generator.extensions_ += extensions;
254fd4e5da5Sopenharmony_ci  }
255fd4e5da5Sopenharmony_ci
256fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(OpDecorate %built_in_type Block
257fd4e5da5Sopenharmony_ci                              OpMemberDecorate %built_in_type 0 BuiltIn )";
258fd4e5da5Sopenharmony_ci  generator.before_types_ += built_in;
259fd4e5da5Sopenharmony_ci  generator.before_types_ += "\n";
260fd4e5da5Sopenharmony_ci
261fd4e5da5Sopenharmony_ci  std::ostringstream after_types;
262fd4e5da5Sopenharmony_ci  after_types << "%built_in_type = OpTypeStruct " << data_type << "\n";
263fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
264fd4e5da5Sopenharmony_ci    after_types << "%built_in_null = OpConstantNull %built_in_type\n";
265fd4e5da5Sopenharmony_ci  }
266fd4e5da5Sopenharmony_ci  after_types << "%built_in_ptr = OpTypePointer " << storage_class
267fd4e5da5Sopenharmony_ci              << " %built_in_type\n";
268fd4e5da5Sopenharmony_ci  after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class;
269fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
270fd4e5da5Sopenharmony_ci    after_types << " %built_in_null";
271fd4e5da5Sopenharmony_ci  }
272fd4e5da5Sopenharmony_ci  after_types << "\n";
273fd4e5da5Sopenharmony_ci  after_types << "%data_ptr = OpTypePointer " << storage_class << " "
274fd4e5da5Sopenharmony_ci              << data_type << "\n";
275fd4e5da5Sopenharmony_ci  generator.after_types_ = after_types.str();
276fd4e5da5Sopenharmony_ci
277fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
278fd4e5da5Sopenharmony_ci  entry_point.name = "main";
279fd4e5da5Sopenharmony_ci  entry_point.execution_model = execution_model;
280fd4e5da5Sopenharmony_ci  if (strncmp(storage_class, "Input", 5) == 0 ||
281fd4e5da5Sopenharmony_ci      strncmp(storage_class, "Output", 6) == 0) {
282fd4e5da5Sopenharmony_ci    entry_point.interfaces = "%built_in_var";
283fd4e5da5Sopenharmony_ci  }
284fd4e5da5Sopenharmony_ci
285fd4e5da5Sopenharmony_ci  std::ostringstream execution_modes;
286fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Fragment")) {
287fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
288fd4e5da5Sopenharmony_ci                    << " OriginUpperLeft\n";
289fd4e5da5Sopenharmony_ci    if (0 == std::strcmp(built_in, "FragDepth")) {
290fd4e5da5Sopenharmony_ci      execution_modes << "OpExecutionMode %" << entry_point.name
291fd4e5da5Sopenharmony_ci                      << " DepthReplacing\n";
292fd4e5da5Sopenharmony_ci    }
293fd4e5da5Sopenharmony_ci  }
294fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Geometry")) {
295fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
296fd4e5da5Sopenharmony_ci                    << " InputPoints\n";
297fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
298fd4e5da5Sopenharmony_ci                    << " OutputPoints\n";
299fd4e5da5Sopenharmony_ci  }
300fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "GLCompute")) {
301fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
302fd4e5da5Sopenharmony_ci                    << " LocalSize 1 1 1\n";
303fd4e5da5Sopenharmony_ci  }
304fd4e5da5Sopenharmony_ci  entry_point.execution_modes = execution_modes.str();
305fd4e5da5Sopenharmony_ci
306fd4e5da5Sopenharmony_ci  entry_point.body = R"(
307fd4e5da5Sopenharmony_ci%val2 = OpFunctionCall %void %foo
308fd4e5da5Sopenharmony_ci)";
309fd4e5da5Sopenharmony_ci
310fd4e5da5Sopenharmony_ci  std::string function_body = R"(
311fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %func
312fd4e5da5Sopenharmony_ci%foo_entry = OpLabel
313fd4e5da5Sopenharmony_ci%ptr = OpAccessChain %data_ptr %built_in_var %u32_0
314fd4e5da5Sopenharmony_ciOpReturn
315fd4e5da5Sopenharmony_ciOpFunctionEnd
316fd4e5da5Sopenharmony_ci)";
317fd4e5da5Sopenharmony_ci
318fd4e5da5Sopenharmony_ci  generator.add_at_the_end_ = function_body;
319fd4e5da5Sopenharmony_ci
320fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
321fd4e5da5Sopenharmony_ci
322fd4e5da5Sopenharmony_ci  return generator;
323fd4e5da5Sopenharmony_ci}
324fd4e5da5Sopenharmony_ci
325fd4e5da5Sopenharmony_ciTEST_P(ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, InFunction) {
326fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
327fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
328fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
329fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
330fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<4>(GetParam());
331fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<5>(GetParam());
332fd4e5da5Sopenharmony_ci
333fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetInFunctionCodeGenerator(
334fd4e5da5Sopenharmony_ci      built_in, execution_model, storage_class, NULL, NULL, data_type);
335fd4e5da5Sopenharmony_ci
336fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
337fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
338fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
339fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
340fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
341fd4e5da5Sopenharmony_ci  }
342fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
343fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
344fd4e5da5Sopenharmony_ci  }
345fd4e5da5Sopenharmony_ci  if (vuid) {
346fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
347fd4e5da5Sopenharmony_ci  }
348fd4e5da5Sopenharmony_ci}
349fd4e5da5Sopenharmony_ci
350fd4e5da5Sopenharmony_ciTEST_P(
351fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
352fd4e5da5Sopenharmony_ci    InFunction) {
353fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
354fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
355fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
356fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
357fd4e5da5Sopenharmony_ci  const char* const capabilities = std::get<4>(GetParam());
358fd4e5da5Sopenharmony_ci  const char* const extensions = std::get<5>(GetParam());
359fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<6>(GetParam());
360fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<7>(GetParam());
361fd4e5da5Sopenharmony_ci
362fd4e5da5Sopenharmony_ci  CodeGenerator generator =
363fd4e5da5Sopenharmony_ci      GetInFunctionCodeGenerator(built_in, execution_model, storage_class,
364fd4e5da5Sopenharmony_ci                                 capabilities, extensions, data_type);
365fd4e5da5Sopenharmony_ci
366fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
367fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
368fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
369fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
370fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
371fd4e5da5Sopenharmony_ci  }
372fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
373fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
374fd4e5da5Sopenharmony_ci  }
375fd4e5da5Sopenharmony_ci  if (vuid) {
376fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
377fd4e5da5Sopenharmony_ci  }
378fd4e5da5Sopenharmony_ci}
379fd4e5da5Sopenharmony_ci
380fd4e5da5Sopenharmony_ciCodeGenerator GetVariableCodeGenerator(const char* const built_in,
381fd4e5da5Sopenharmony_ci                                       const char* const execution_model,
382fd4e5da5Sopenharmony_ci                                       const char* const storage_class,
383fd4e5da5Sopenharmony_ci                                       const char* const capabilities,
384fd4e5da5Sopenharmony_ci                                       const char* const extensions,
385fd4e5da5Sopenharmony_ci                                       const char* const data_type) {
386fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
387fd4e5da5Sopenharmony_ci
388fd4e5da5Sopenharmony_ci  if (capabilities) {
389fd4e5da5Sopenharmony_ci    generator.capabilities_ += capabilities;
390fd4e5da5Sopenharmony_ci  }
391fd4e5da5Sopenharmony_ci  if (extensions) {
392fd4e5da5Sopenharmony_ci    generator.extensions_ += extensions;
393fd4e5da5Sopenharmony_ci  }
394fd4e5da5Sopenharmony_ci
395fd4e5da5Sopenharmony_ci  generator.before_types_ = "OpDecorate %built_in_var BuiltIn ";
396fd4e5da5Sopenharmony_ci  generator.before_types_ += built_in;
397fd4e5da5Sopenharmony_ci  generator.before_types_ += "\n";
398fd4e5da5Sopenharmony_ci  if ((0 == std::strcmp(storage_class, "Input")) &&
399fd4e5da5Sopenharmony_ci      (0 == std::strcmp(execution_model, "Fragment"))) {
400fd4e5da5Sopenharmony_ci    // ensure any needed input types that might require Flat
401fd4e5da5Sopenharmony_ci    generator.before_types_ += "OpDecorate %built_in_var Flat\n";
402fd4e5da5Sopenharmony_ci  }
403fd4e5da5Sopenharmony_ci
404fd4e5da5Sopenharmony_ci  std::ostringstream after_types;
405fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
406fd4e5da5Sopenharmony_ci    after_types << "%built_in_null = OpConstantNull " << data_type << "\n";
407fd4e5da5Sopenharmony_ci  }
408fd4e5da5Sopenharmony_ci  after_types << "%built_in_ptr = OpTypePointer " << storage_class << " "
409fd4e5da5Sopenharmony_ci              << data_type << "\n";
410fd4e5da5Sopenharmony_ci  after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class;
411fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
412fd4e5da5Sopenharmony_ci    after_types << " %built_in_null";
413fd4e5da5Sopenharmony_ci  }
414fd4e5da5Sopenharmony_ci  after_types << "\n";
415fd4e5da5Sopenharmony_ci  generator.after_types_ = after_types.str();
416fd4e5da5Sopenharmony_ci
417fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
418fd4e5da5Sopenharmony_ci  entry_point.name = "main";
419fd4e5da5Sopenharmony_ci  entry_point.execution_model = execution_model;
420fd4e5da5Sopenharmony_ci  if (strncmp(storage_class, "Input", 5) == 0 ||
421fd4e5da5Sopenharmony_ci      strncmp(storage_class, "Output", 6) == 0) {
422fd4e5da5Sopenharmony_ci    entry_point.interfaces = "%built_in_var";
423fd4e5da5Sopenharmony_ci  }
424fd4e5da5Sopenharmony_ci  // Any kind of reference would do.
425fd4e5da5Sopenharmony_ci  entry_point.body = R"(
426fd4e5da5Sopenharmony_ci%val = OpBitcast %u32 %built_in_var
427fd4e5da5Sopenharmony_ci)";
428fd4e5da5Sopenharmony_ci
429fd4e5da5Sopenharmony_ci  std::ostringstream execution_modes;
430fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Fragment")) {
431fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
432fd4e5da5Sopenharmony_ci                    << " OriginUpperLeft\n";
433fd4e5da5Sopenharmony_ci    if (0 == std::strcmp(built_in, "FragDepth")) {
434fd4e5da5Sopenharmony_ci      execution_modes << "OpExecutionMode %" << entry_point.name
435fd4e5da5Sopenharmony_ci                      << " DepthReplacing\n";
436fd4e5da5Sopenharmony_ci    }
437fd4e5da5Sopenharmony_ci  }
438fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Geometry")) {
439fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
440fd4e5da5Sopenharmony_ci                    << " InputPoints\n";
441fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
442fd4e5da5Sopenharmony_ci                    << " OutputPoints\n";
443fd4e5da5Sopenharmony_ci  }
444fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "GLCompute")) {
445fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
446fd4e5da5Sopenharmony_ci                    << " LocalSize 1 1 1\n";
447fd4e5da5Sopenharmony_ci  }
448fd4e5da5Sopenharmony_ci  entry_point.execution_modes = execution_modes.str();
449fd4e5da5Sopenharmony_ci
450fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
451fd4e5da5Sopenharmony_ci
452fd4e5da5Sopenharmony_ci  return generator;
453fd4e5da5Sopenharmony_ci}
454fd4e5da5Sopenharmony_ci
455fd4e5da5Sopenharmony_ciTEST_P(ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Variable) {
456fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
457fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
458fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
459fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
460fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<4>(GetParam());
461fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<5>(GetParam());
462fd4e5da5Sopenharmony_ci
463fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetVariableCodeGenerator(
464fd4e5da5Sopenharmony_ci      built_in, execution_model, storage_class, NULL, NULL, data_type);
465fd4e5da5Sopenharmony_ci
466fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
467fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
468fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
469fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
470fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
471fd4e5da5Sopenharmony_ci  }
472fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
473fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
474fd4e5da5Sopenharmony_ci  }
475fd4e5da5Sopenharmony_ci  if (vuid) {
476fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
477fd4e5da5Sopenharmony_ci  }
478fd4e5da5Sopenharmony_ci}
479fd4e5da5Sopenharmony_ci
480fd4e5da5Sopenharmony_ciTEST_P(
481fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
482fd4e5da5Sopenharmony_ci    Variable) {
483fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
484fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
485fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
486fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
487fd4e5da5Sopenharmony_ci  const char* const capabilities = std::get<4>(GetParam());
488fd4e5da5Sopenharmony_ci  const char* const extensions = std::get<5>(GetParam());
489fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<6>(GetParam());
490fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<7>(GetParam());
491fd4e5da5Sopenharmony_ci
492fd4e5da5Sopenharmony_ci  CodeGenerator generator =
493fd4e5da5Sopenharmony_ci      GetVariableCodeGenerator(built_in, execution_model, storage_class,
494fd4e5da5Sopenharmony_ci                               capabilities, extensions, data_type);
495fd4e5da5Sopenharmony_ci
496fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
497fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
498fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
499fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
500fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
501fd4e5da5Sopenharmony_ci  }
502fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
503fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
504fd4e5da5Sopenharmony_ci  }
505fd4e5da5Sopenharmony_ci  if (vuid) {
506fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
507fd4e5da5Sopenharmony_ci  }
508fd4e5da5Sopenharmony_ci}
509fd4e5da5Sopenharmony_ci
510fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
511fd4e5da5Sopenharmony_ci    ClipAndCullDistanceOutputSuccess,
512fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
513fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"),
514fd4e5da5Sopenharmony_ci            Values("Vertex", "Geometry", "TessellationControl",
515fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
516fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr2", "%f32arr4"), Values(nullptr),
517fd4e5da5Sopenharmony_ci            Values(TestResult())));
518fd4e5da5Sopenharmony_ci
519fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
520fd4e5da5Sopenharmony_ci    ClipAndCullDistanceInputSuccess,
521fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
522fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"),
523fd4e5da5Sopenharmony_ci            Values("Fragment", "Geometry", "TessellationControl",
524fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
525fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr2", "%f32arr4"), Values(nullptr),
526fd4e5da5Sopenharmony_ci            Values(TestResult())));
527fd4e5da5Sopenharmony_ci
528fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
529fd4e5da5Sopenharmony_ci    ClipAndCullDistanceInvalidStorageClass,
530fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
531fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"),
532fd4e5da5Sopenharmony_ci            Values("Vertex", "Geometry", "TessellationControl",
533fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
534fd4e5da5Sopenharmony_ci            Values("Private"), Values("%f32arr2", "%f32arr4"),
535fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04190 "
536fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04199"),
537fd4e5da5Sopenharmony_ci            Values(TestResult(
538fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
539fd4e5da5Sopenharmony_ci                "to be only used for variables with Input or Output storage "
540fd4e5da5Sopenharmony_ci                "class."))));
541fd4e5da5Sopenharmony_ci
542fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
543fd4e5da5Sopenharmony_ci    ClipAndCullDistanceFragmentOutput,
544fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
545fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"),
546fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr4"),
547fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04189 "
548fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04198"),
549fd4e5da5Sopenharmony_ci            Values(TestResult(
550fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
551fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance "
552fd4e5da5Sopenharmony_ci                "to be used for variables with Output storage class if "
553fd4e5da5Sopenharmony_ci                "execution model is Fragment.",
554fd4e5da5Sopenharmony_ci                "which is called with execution model Fragment."))));
555fd4e5da5Sopenharmony_ci
556fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
557fd4e5da5Sopenharmony_ci    VertexIdVertexInput,
558fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
559fd4e5da5Sopenharmony_ci    Combine(
560fd4e5da5Sopenharmony_ci        Values("VertexId"), Values("Vertex"), Values("Input"), Values("%u32"),
561fd4e5da5Sopenharmony_ci        Values(nullptr),
562fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
563fd4e5da5Sopenharmony_ci                          "Vulkan spec doesn't allow BuiltIn VertexId to be "
564fd4e5da5Sopenharmony_ci                          "used."))));
565fd4e5da5Sopenharmony_ci
566fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
567fd4e5da5Sopenharmony_ci    ClipAndCullDistanceVertexInput,
568fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
569fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("Vertex"),
570fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr4"),
571fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04188 "
572fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04197"),
573fd4e5da5Sopenharmony_ci            Values(TestResult(
574fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
575fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance "
576fd4e5da5Sopenharmony_ci                "to be used for variables with Input storage class if "
577fd4e5da5Sopenharmony_ci                "execution model is Vertex.",
578fd4e5da5Sopenharmony_ci                "which is called with execution model Vertex."))));
579fd4e5da5Sopenharmony_ci
580fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
581fd4e5da5Sopenharmony_ci    ClipAndCullInvalidExecutionModel,
582fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
583fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("GLCompute"),
584fd4e5da5Sopenharmony_ci            Values("Input", "Output"), Values("%f32arr4"),
585fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04187 "
586fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04196"),
587fd4e5da5Sopenharmony_ci            Values(TestResult(
588fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
589fd4e5da5Sopenharmony_ci                "to be used only with Fragment, Vertex, TessellationControl, "
590fd4e5da5Sopenharmony_ci                "TessellationEvaluation or Geometry execution models"))));
591fd4e5da5Sopenharmony_ci
592fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
593fd4e5da5Sopenharmony_ci    ClipAndCullDistanceNotArray,
594fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
595fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"),
596fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec2", "%f32vec4", "%f32"),
597fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04191 "
598fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04200"),
599fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
600fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float array",
601fd4e5da5Sopenharmony_ci                              "is not an array"))));
602fd4e5da5Sopenharmony_ci
603fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
604fd4e5da5Sopenharmony_ci    ClipAndCullDistanceNotFloatArray,
605fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
606fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"),
607fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32arr2", "%u64arr4"),
608fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04191 "
609fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04200"),
610fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
611fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float array",
612fd4e5da5Sopenharmony_ci                              "components are not float scalar"))));
613fd4e5da5Sopenharmony_ci
614fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
615fd4e5da5Sopenharmony_ci    ClipAndCullDistanceNotF32Array,
616fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
617fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"),
618fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f64arr2", "%f64arr4"),
619fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04191 "
620fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04200"),
621fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
622fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float array",
623fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
624fd4e5da5Sopenharmony_ci
625fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
626fd4e5da5Sopenharmony_ci    FragCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
627fd4e5da5Sopenharmony_ci    Combine(Values("FragCoord"), Values("Fragment"), Values("Input"),
628fd4e5da5Sopenharmony_ci            Values("%f32vec4"), Values(nullptr), Values(TestResult())));
629fd4e5da5Sopenharmony_ci
630fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
631fd4e5da5Sopenharmony_ci    FragCoordNotFragment,
632fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
633fd4e5da5Sopenharmony_ci    Combine(
634fd4e5da5Sopenharmony_ci        Values("FragCoord"),
635fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
636fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
637fd4e5da5Sopenharmony_ci        Values("Input"), Values("%f32vec4"),
638fd4e5da5Sopenharmony_ci        Values("VUID-FragCoord-FragCoord-04210"),
639fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
640fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
641fd4e5da5Sopenharmony_ci
642fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
643fd4e5da5Sopenharmony_ci    FragCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
644fd4e5da5Sopenharmony_ci    Combine(Values("FragCoord"), Values("Fragment"), Values("Output"),
645fd4e5da5Sopenharmony_ci            Values("%f32vec4"), Values("VUID-FragCoord-FragCoord-04211"),
646fd4e5da5Sopenharmony_ci            Values(TestResult(
647fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
648fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
649fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
650fd4e5da5Sopenharmony_ci
651fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
652fd4e5da5Sopenharmony_ci    FragCoordNotFloatVector,
653fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
654fd4e5da5Sopenharmony_ci    Combine(Values("FragCoord"), Values("Fragment"), Values("Input"),
655fd4e5da5Sopenharmony_ci            Values("%f32arr4", "%u32vec4"),
656fd4e5da5Sopenharmony_ci            Values("VUID-FragCoord-FragCoord-04212"),
657fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
658fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
659fd4e5da5Sopenharmony_ci                              "is not a float vector"))));
660fd4e5da5Sopenharmony_ci
661fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
662fd4e5da5Sopenharmony_ci    FragCoordNotFloatVec4,
663fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
664fd4e5da5Sopenharmony_ci    Combine(Values("FragCoord"), Values("Fragment"), Values("Input"),
665fd4e5da5Sopenharmony_ci            Values("%f32vec3"), Values("VUID-FragCoord-FragCoord-04212"),
666fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
667fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
668fd4e5da5Sopenharmony_ci                              "has 3 components"))));
669fd4e5da5Sopenharmony_ci
670fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
671fd4e5da5Sopenharmony_ci    FragCoordNotF32Vec4,
672fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
673fd4e5da5Sopenharmony_ci    Combine(Values("FragCoord"), Values("Fragment"), Values("Input"),
674fd4e5da5Sopenharmony_ci            Values("%f64vec4"), Values("VUID-FragCoord-FragCoord-04212"),
675fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
676fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
677fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
678fd4e5da5Sopenharmony_ci
679fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
680fd4e5da5Sopenharmony_ci    FragDepthSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
681fd4e5da5Sopenharmony_ci    Combine(Values("FragDepth"), Values("Fragment"), Values("Output"),
682fd4e5da5Sopenharmony_ci            Values("%f32"), Values(nullptr), Values(TestResult())));
683fd4e5da5Sopenharmony_ci
684fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
685fd4e5da5Sopenharmony_ci    FragDepthNotFragment,
686fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
687fd4e5da5Sopenharmony_ci    Combine(
688fd4e5da5Sopenharmony_ci        Values("FragDepth"),
689fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
690fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
691fd4e5da5Sopenharmony_ci        Values("Output"), Values("%f32"),
692fd4e5da5Sopenharmony_ci        Values("VUID-FragDepth-FragDepth-04213"),
693fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
694fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
695fd4e5da5Sopenharmony_ci
696fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
697fd4e5da5Sopenharmony_ci    FragDepthNotOutput,
698fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
699fd4e5da5Sopenharmony_ci    Combine(Values("FragDepth"), Values("Fragment"), Values("Input"),
700fd4e5da5Sopenharmony_ci            Values("%f32"), Values("VUID-FragDepth-FragDepth-04214"),
701fd4e5da5Sopenharmony_ci            Values(TestResult(
702fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
703fd4e5da5Sopenharmony_ci                "to be only used for variables with Output storage class",
704fd4e5da5Sopenharmony_ci                "uses storage class Input"))));
705fd4e5da5Sopenharmony_ci
706fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
707fd4e5da5Sopenharmony_ci    FragDepthNotFloatScalar,
708fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
709fd4e5da5Sopenharmony_ci    Combine(Values("FragDepth"), Values("Fragment"), Values("Output"),
710fd4e5da5Sopenharmony_ci            Values("%f32vec4", "%u32"),
711fd4e5da5Sopenharmony_ci            Values("VUID-FragDepth-FragDepth-04215"),
712fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
713fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
714fd4e5da5Sopenharmony_ci                              "is not a float scalar"))));
715fd4e5da5Sopenharmony_ci
716fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
717fd4e5da5Sopenharmony_ci    FragDepthNotF32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
718fd4e5da5Sopenharmony_ci    Combine(Values("FragDepth"), Values("Fragment"), Values("Output"),
719fd4e5da5Sopenharmony_ci            Values("%f64"), Values("VUID-FragDepth-FragDepth-04215"),
720fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
721fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
722fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
723fd4e5da5Sopenharmony_ci
724fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
725fd4e5da5Sopenharmony_ci    FrontFacingAndHelperInvocationSuccess,
726fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
727fd4e5da5Sopenharmony_ci    Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"),
728fd4e5da5Sopenharmony_ci            Values("Input"), Values("%bool"), Values(nullptr),
729fd4e5da5Sopenharmony_ci            Values(TestResult())));
730fd4e5da5Sopenharmony_ci
731fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
732fd4e5da5Sopenharmony_ci    FrontFacingAndHelperInvocationNotFragment,
733fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
734fd4e5da5Sopenharmony_ci    Combine(
735fd4e5da5Sopenharmony_ci        Values("FrontFacing", "HelperInvocation"),
736fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
737fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
738fd4e5da5Sopenharmony_ci        Values("Input"), Values("%bool"),
739fd4e5da5Sopenharmony_ci        Values("VUID-FrontFacing-FrontFacing-04229 "
740fd4e5da5Sopenharmony_ci               "VUID-HelperInvocation-HelperInvocation-04239"),
741fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
742fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
743fd4e5da5Sopenharmony_ci
744fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
745fd4e5da5Sopenharmony_ci    FrontFacingAndHelperInvocationNotInput,
746fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
747fd4e5da5Sopenharmony_ci    Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"),
748fd4e5da5Sopenharmony_ci            Values("Output"), Values("%bool"),
749fd4e5da5Sopenharmony_ci            Values("VUID-FrontFacing-FrontFacing-04230 "
750fd4e5da5Sopenharmony_ci                   "VUID-HelperInvocation-HelperInvocation-04240"),
751fd4e5da5Sopenharmony_ci            Values(TestResult(
752fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
753fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
754fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
755fd4e5da5Sopenharmony_ci
756fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
757fd4e5da5Sopenharmony_ci    FrontFacingAndHelperInvocationNotBool,
758fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
759fd4e5da5Sopenharmony_ci    Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"),
760fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32"),
761fd4e5da5Sopenharmony_ci            Values("VUID-FrontFacing-FrontFacing-04231 "
762fd4e5da5Sopenharmony_ci                   "VUID-HelperInvocation-HelperInvocation-04241"),
763fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
764fd4e5da5Sopenharmony_ci                              "needs to be a bool scalar",
765fd4e5da5Sopenharmony_ci                              "is not a bool scalar"))));
766fd4e5da5Sopenharmony_ci
767fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
768fd4e5da5Sopenharmony_ci    ComputeShaderInputInt32Vec3Success,
769fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
770fd4e5da5Sopenharmony_ci    Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups",
771fd4e5da5Sopenharmony_ci                   "WorkgroupId"),
772fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"), Values("%u32vec3"),
773fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
774fd4e5da5Sopenharmony_ci
775fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
776fd4e5da5Sopenharmony_ci    ComputeShaderInputInt32Vec3NotGLCompute,
777fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
778fd4e5da5Sopenharmony_ci    Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups",
779fd4e5da5Sopenharmony_ci                   "WorkgroupId"),
780fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "Geometry", "TessellationControl",
781fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
782fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32vec3"),
783fd4e5da5Sopenharmony_ci            Values("VUID-GlobalInvocationId-GlobalInvocationId-04236 "
784fd4e5da5Sopenharmony_ci                   "VUID-LocalInvocationId-LocalInvocationId-04281 "
785fd4e5da5Sopenharmony_ci                   "VUID-NumWorkgroups-NumWorkgroups-04296 "
786fd4e5da5Sopenharmony_ci                   "VUID-WorkgroupId-WorkgroupId-04422"),
787fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
788fd4e5da5Sopenharmony_ci                              "to be used only with GLCompute, MeshNV, "
789fd4e5da5Sopenharmony_ci                              "TaskNV, MeshEXT or TaskEXT execution model"))));
790fd4e5da5Sopenharmony_ci
791fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
792fd4e5da5Sopenharmony_ci    ComputeShaderInputInt32Vec3NotInput,
793fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
794fd4e5da5Sopenharmony_ci    Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups",
795fd4e5da5Sopenharmony_ci                   "WorkgroupId"),
796fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Output"), Values("%u32vec3"),
797fd4e5da5Sopenharmony_ci            Values("VUID-GlobalInvocationId-GlobalInvocationId-04237 "
798fd4e5da5Sopenharmony_ci                   "VUID-LocalInvocationId-LocalInvocationId-04282 "
799fd4e5da5Sopenharmony_ci                   "VUID-NumWorkgroups-NumWorkgroups-04297 "
800fd4e5da5Sopenharmony_ci                   "VUID-WorkgroupId-WorkgroupId-04423"),
801fd4e5da5Sopenharmony_ci            Values(TestResult(
802fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
803fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
804fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
805fd4e5da5Sopenharmony_ci
806fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
807fd4e5da5Sopenharmony_ci    ComputeShaderInputInt32Vec3NotIntVector,
808fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
809fd4e5da5Sopenharmony_ci    Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups",
810fd4e5da5Sopenharmony_ci                   "WorkgroupId"),
811fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"),
812fd4e5da5Sopenharmony_ci            Values("%u32arr3", "%f32vec3"),
813fd4e5da5Sopenharmony_ci            Values("VUID-GlobalInvocationId-GlobalInvocationId-04238 "
814fd4e5da5Sopenharmony_ci                   "VUID-LocalInvocationId-LocalInvocationId-04283 "
815fd4e5da5Sopenharmony_ci                   "VUID-NumWorkgroups-NumWorkgroups-04298 "
816fd4e5da5Sopenharmony_ci                   "VUID-WorkgroupId-WorkgroupId-04424"),
817fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
818fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit int vector",
819fd4e5da5Sopenharmony_ci                              "is not an int vector"))));
820fd4e5da5Sopenharmony_ci
821fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
822fd4e5da5Sopenharmony_ci    ComputeShaderInputInt32Vec3NotIntVec3,
823fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
824fd4e5da5Sopenharmony_ci    Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups",
825fd4e5da5Sopenharmony_ci                   "WorkgroupId"),
826fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"), Values("%u32vec4"),
827fd4e5da5Sopenharmony_ci            Values("VUID-GlobalInvocationId-GlobalInvocationId-04238 "
828fd4e5da5Sopenharmony_ci                   "VUID-LocalInvocationId-LocalInvocationId-04283 "
829fd4e5da5Sopenharmony_ci                   "VUID-NumWorkgroups-NumWorkgroups-04298 "
830fd4e5da5Sopenharmony_ci                   "VUID-WorkgroupId-WorkgroupId-04424"),
831fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
832fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit int vector",
833fd4e5da5Sopenharmony_ci                              "has 4 components"))));
834fd4e5da5Sopenharmony_ci
835fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
836fd4e5da5Sopenharmony_ci    ComputeShaderInputInt32Vec3NotInt32Vec,
837fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
838fd4e5da5Sopenharmony_ci    Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups",
839fd4e5da5Sopenharmony_ci                   "WorkgroupId"),
840fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"), Values("%u64vec3"),
841fd4e5da5Sopenharmony_ci            Values("VUID-GlobalInvocationId-GlobalInvocationId-04238 "
842fd4e5da5Sopenharmony_ci                   "VUID-LocalInvocationId-LocalInvocationId-04283 "
843fd4e5da5Sopenharmony_ci                   "VUID-NumWorkgroups-NumWorkgroups-04298 "
844fd4e5da5Sopenharmony_ci                   "VUID-WorkgroupId-WorkgroupId-04424"),
845fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
846fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit int vector",
847fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
848fd4e5da5Sopenharmony_ci
849fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
850fd4e5da5Sopenharmony_ci    InvocationIdSuccess,
851fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
852fd4e5da5Sopenharmony_ci    Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"),
853fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"), Values(nullptr),
854fd4e5da5Sopenharmony_ci            Values(TestResult())));
855fd4e5da5Sopenharmony_ci
856fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
857fd4e5da5Sopenharmony_ci    InvocationIdInvalidExecutionModel,
858fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
859fd4e5da5Sopenharmony_ci    Combine(Values("InvocationId"),
860fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "GLCompute", "TessellationEvaluation"),
861fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
862fd4e5da5Sopenharmony_ci            Values("VUID-InvocationId-InvocationId-04257"),
863fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
864fd4e5da5Sopenharmony_ci                              "to be used only with TessellationControl or "
865fd4e5da5Sopenharmony_ci                              "Geometry execution models"))));
866fd4e5da5Sopenharmony_ci
867fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
868fd4e5da5Sopenharmony_ci    InvocationIdNotInput,
869fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
870fd4e5da5Sopenharmony_ci    Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"),
871fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
872fd4e5da5Sopenharmony_ci            Values("VUID-InvocationId-InvocationId-04258"),
873fd4e5da5Sopenharmony_ci            Values(TestResult(
874fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
875fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
876fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
877fd4e5da5Sopenharmony_ci
878fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
879fd4e5da5Sopenharmony_ci    InvocationIdNotIntScalar,
880fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
881fd4e5da5Sopenharmony_ci    Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"),
882fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
883fd4e5da5Sopenharmony_ci            Values("VUID-InvocationId-InvocationId-04259"),
884fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
885fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
886fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
887fd4e5da5Sopenharmony_ci
888fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
889fd4e5da5Sopenharmony_ci    InvocationIdNotInt32,
890fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
891fd4e5da5Sopenharmony_ci    Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"),
892fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u64"),
893fd4e5da5Sopenharmony_ci            Values("VUID-InvocationId-InvocationId-04259"),
894fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
895fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
896fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
897fd4e5da5Sopenharmony_ci
898fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
899fd4e5da5Sopenharmony_ci    InstanceIndexSuccess,
900fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
901fd4e5da5Sopenharmony_ci    Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"),
902fd4e5da5Sopenharmony_ci            Values("%u32"), Values(nullptr), Values(TestResult())));
903fd4e5da5Sopenharmony_ci
904fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
905fd4e5da5Sopenharmony_ci    InstanceIndexInvalidExecutionModel,
906fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
907fd4e5da5Sopenharmony_ci    Combine(Values("InstanceIndex"),
908fd4e5da5Sopenharmony_ci            Values("Geometry", "Fragment", "GLCompute", "TessellationControl",
909fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
910fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
911fd4e5da5Sopenharmony_ci            Values("VUID-InstanceIndex-InstanceIndex-04263"),
912fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
913fd4e5da5Sopenharmony_ci                              "to be used only with Vertex execution model"))));
914fd4e5da5Sopenharmony_ci
915fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
916fd4e5da5Sopenharmony_ci    InstanceIndexNotInput,
917fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
918fd4e5da5Sopenharmony_ci    Combine(Values("InstanceIndex"), Values("Vertex"), Values("Output"),
919fd4e5da5Sopenharmony_ci            Values("%u32"), Values("VUID-InstanceIndex-InstanceIndex-04264"),
920fd4e5da5Sopenharmony_ci            Values(TestResult(
921fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
922fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
923fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
924fd4e5da5Sopenharmony_ci
925fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
926fd4e5da5Sopenharmony_ci    InstanceIndexNotIntScalar,
927fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
928fd4e5da5Sopenharmony_ci    Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"),
929fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"),
930fd4e5da5Sopenharmony_ci            Values("VUID-InstanceIndex-InstanceIndex-04265"),
931fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
932fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
933fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
934fd4e5da5Sopenharmony_ci
935fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
936fd4e5da5Sopenharmony_ci    InstanceIndexNotInt32,
937fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
938fd4e5da5Sopenharmony_ci    Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"),
939fd4e5da5Sopenharmony_ci            Values("%u64"), Values("VUID-InstanceIndex-InstanceIndex-04265"),
940fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
941fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
942fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
943fd4e5da5Sopenharmony_ci
944fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
945fd4e5da5Sopenharmony_ci    LayerAndViewportIndexInputSuccess,
946fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
947fd4e5da5Sopenharmony_ci    Combine(Values("Layer", "ViewportIndex"), Values("Fragment"),
948fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"), Values(nullptr),
949fd4e5da5Sopenharmony_ci            Values(TestResult())));
950fd4e5da5Sopenharmony_ci
951fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
952fd4e5da5Sopenharmony_ci    LayerAndViewportIndexOutputSuccess,
953fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
954fd4e5da5Sopenharmony_ci    Combine(Values("Layer", "ViewportIndex"), Values("Geometry"),
955fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"), Values(nullptr),
956fd4e5da5Sopenharmony_ci            Values(TestResult())));
957fd4e5da5Sopenharmony_ci
958fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
959fd4e5da5Sopenharmony_ci    LayerAndViewportIndexInvalidExecutionModel,
960fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
961fd4e5da5Sopenharmony_ci    Combine(
962fd4e5da5Sopenharmony_ci        Values("Layer", "ViewportIndex"),
963fd4e5da5Sopenharmony_ci        Values("TessellationControl", "GLCompute"), Values("Input"),
964fd4e5da5Sopenharmony_ci        Values("%u32"),
965fd4e5da5Sopenharmony_ci        Values("VUID-Layer-Layer-04272 VUID-ViewportIndex-ViewportIndex-04404"),
966fd4e5da5Sopenharmony_ci        Values(
967fd4e5da5Sopenharmony_ci            TestResult(SPV_ERROR_INVALID_DATA,
968fd4e5da5Sopenharmony_ci                       "to be used only with Vertex, TessellationEvaluation, "
969fd4e5da5Sopenharmony_ci                       "Geometry, or Fragment execution models"))));
970fd4e5da5Sopenharmony_ci
971fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
972fd4e5da5Sopenharmony_ci    ViewportIndexExecutionModelEnabledByCapability,
973fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
974fd4e5da5Sopenharmony_ci    Combine(Values("ViewportIndex"), Values("Vertex", "TessellationEvaluation"),
975fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
976fd4e5da5Sopenharmony_ci            Values("VUID-ViewportIndex-ViewportIndex-04405"),
977fd4e5da5Sopenharmony_ci            Values(TestResult(
978fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
979fd4e5da5Sopenharmony_ci                "ShaderViewportIndexLayerEXT or ShaderViewportIndex"))));
980fd4e5da5Sopenharmony_ci
981fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
982fd4e5da5Sopenharmony_ci    LayerExecutionModelEnabledByCapability,
983fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
984fd4e5da5Sopenharmony_ci    Combine(Values("Layer"), Values("Vertex", "TessellationEvaluation"),
985fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"), Values("VUID-Layer-Layer-04273"),
986fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
987fd4e5da5Sopenharmony_ci                              "ShaderViewportIndexLayerEXT or ShaderLayer"))));
988fd4e5da5Sopenharmony_ci
989fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
990fd4e5da5Sopenharmony_ci    LayerAndViewportIndexFragmentNotInput,
991fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
992fd4e5da5Sopenharmony_ci    Combine(
993fd4e5da5Sopenharmony_ci        Values("Layer", "ViewportIndex"), Values("Fragment"), Values("Output"),
994fd4e5da5Sopenharmony_ci        Values("%u32"),
995fd4e5da5Sopenharmony_ci        Values("VUID-Layer-Layer-04275 VUID-ViewportIndex-ViewportIndex-04407"),
996fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
997fd4e5da5Sopenharmony_ci                          "Output storage class if execution model is Fragment",
998fd4e5da5Sopenharmony_ci                          "which is called with execution model Fragment"))));
999fd4e5da5Sopenharmony_ci
1000fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1001fd4e5da5Sopenharmony_ci    LayerAndViewportIndexGeometryNotOutput,
1002fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1003fd4e5da5Sopenharmony_ci    Combine(
1004fd4e5da5Sopenharmony_ci        Values("Layer", "ViewportIndex"),
1005fd4e5da5Sopenharmony_ci        Values("Vertex", "TessellationEvaluation", "Geometry"), Values("Input"),
1006fd4e5da5Sopenharmony_ci        Values("%u32"),
1007fd4e5da5Sopenharmony_ci        Values("VUID-Layer-Layer-04274 VUID-ViewportIndex-ViewportIndex-04406"),
1008fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1009fd4e5da5Sopenharmony_ci                          "Input storage class if execution model is Vertex, "
1010fd4e5da5Sopenharmony_ci                          "TessellationEvaluation, Geometry, MeshNV or MeshEXT",
1011fd4e5da5Sopenharmony_ci                          "which is called with execution model"))));
1012fd4e5da5Sopenharmony_ci
1013fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1014fd4e5da5Sopenharmony_ci    LayerAndViewportIndexNotIntScalar,
1015fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1016fd4e5da5Sopenharmony_ci    Combine(
1017fd4e5da5Sopenharmony_ci        Values("Layer", "ViewportIndex"), Values("Fragment"), Values("Input"),
1018fd4e5da5Sopenharmony_ci        Values("%f32", "%u32vec3"),
1019fd4e5da5Sopenharmony_ci        Values("VUID-Layer-Layer-04276 VUID-ViewportIndex-ViewportIndex-04408"),
1020fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1021fd4e5da5Sopenharmony_ci                          "needs to be a 32-bit int scalar",
1022fd4e5da5Sopenharmony_ci                          "is not an int scalar"))));
1023fd4e5da5Sopenharmony_ci
1024fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1025fd4e5da5Sopenharmony_ci    LayerAndViewportIndexNotInt32,
1026fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1027fd4e5da5Sopenharmony_ci    Combine(
1028fd4e5da5Sopenharmony_ci        Values("Layer", "ViewportIndex"), Values("Fragment"), Values("Input"),
1029fd4e5da5Sopenharmony_ci        Values("%u64"),
1030fd4e5da5Sopenharmony_ci        Values("VUID-Layer-Layer-04276 VUID-ViewportIndex-ViewportIndex-04408"),
1031fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1032fd4e5da5Sopenharmony_ci                          "needs to be a 32-bit int scalar",
1033fd4e5da5Sopenharmony_ci                          "has bit width 64"))));
1034fd4e5da5Sopenharmony_ci
1035fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1036fd4e5da5Sopenharmony_ci    LayerCapability,
1037fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1038fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("Layer"), Values("Vertex"),
1039fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
1040fd4e5da5Sopenharmony_ci            Values("OpCapability ShaderLayer\n"), Values(nullptr),
1041fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
1042fd4e5da5Sopenharmony_ci
1043fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1044fd4e5da5Sopenharmony_ci    ViewportIndexCapability,
1045fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1046fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("ViewportIndex"),
1047fd4e5da5Sopenharmony_ci            Values("Vertex"), Values("Output"), Values("%u32"),
1048fd4e5da5Sopenharmony_ci            Values("OpCapability ShaderViewportIndex\n"), Values(nullptr),
1049fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
1050fd4e5da5Sopenharmony_ci
1051fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1052fd4e5da5Sopenharmony_ci    PatchVerticesSuccess,
1053fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1054fd4e5da5Sopenharmony_ci    Combine(Values("PatchVertices"),
1055fd4e5da5Sopenharmony_ci            Values("TessellationEvaluation", "TessellationControl"),
1056fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"), Values(nullptr),
1057fd4e5da5Sopenharmony_ci            Values(TestResult())));
1058fd4e5da5Sopenharmony_ci
1059fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1060fd4e5da5Sopenharmony_ci    PatchVerticesInvalidExecutionModel,
1061fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1062fd4e5da5Sopenharmony_ci    Combine(Values("PatchVertices"),
1063fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "GLCompute", "Geometry"),
1064fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
1065fd4e5da5Sopenharmony_ci            Values("VUID-PatchVertices-PatchVertices-04308"),
1066fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1067fd4e5da5Sopenharmony_ci                              "to be used only with TessellationControl or "
1068fd4e5da5Sopenharmony_ci                              "TessellationEvaluation execution models"))));
1069fd4e5da5Sopenharmony_ci
1070fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1071fd4e5da5Sopenharmony_ci    PatchVerticesNotInput,
1072fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1073fd4e5da5Sopenharmony_ci    Combine(Values("PatchVertices"),
1074fd4e5da5Sopenharmony_ci            Values("TessellationEvaluation", "TessellationControl"),
1075fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
1076fd4e5da5Sopenharmony_ci            Values("VUID-PatchVertices-PatchVertices-04309"),
1077fd4e5da5Sopenharmony_ci            Values(TestResult(
1078fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1079fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
1080fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
1081fd4e5da5Sopenharmony_ci
1082fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1083fd4e5da5Sopenharmony_ci    PatchVerticesNotIntScalar,
1084fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1085fd4e5da5Sopenharmony_ci    Combine(Values("PatchVertices"),
1086fd4e5da5Sopenharmony_ci            Values("TessellationEvaluation", "TessellationControl"),
1087fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
1088fd4e5da5Sopenharmony_ci            Values("VUID-PatchVertices-PatchVertices-04310"),
1089fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1090fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1091fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1092fd4e5da5Sopenharmony_ci
1093fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1094fd4e5da5Sopenharmony_ci    PatchVerticesNotInt32,
1095fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1096fd4e5da5Sopenharmony_ci    Combine(Values("PatchVertices"),
1097fd4e5da5Sopenharmony_ci            Values("TessellationEvaluation", "TessellationControl"),
1098fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u64"),
1099fd4e5da5Sopenharmony_ci            Values("VUID-PatchVertices-PatchVertices-04310"),
1100fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1101fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1102fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
1103fd4e5da5Sopenharmony_ci
1104fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1105fd4e5da5Sopenharmony_ci    PointCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1106fd4e5da5Sopenharmony_ci    Combine(Values("PointCoord"), Values("Fragment"), Values("Input"),
1107fd4e5da5Sopenharmony_ci            Values("%f32vec2"), Values(nullptr), Values(TestResult())));
1108fd4e5da5Sopenharmony_ci
1109fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1110fd4e5da5Sopenharmony_ci    PointCoordNotFragment,
1111fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1112fd4e5da5Sopenharmony_ci    Combine(
1113fd4e5da5Sopenharmony_ci        Values("PointCoord"),
1114fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
1115fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
1116fd4e5da5Sopenharmony_ci        Values("Input"), Values("%f32vec2"),
1117fd4e5da5Sopenharmony_ci        Values("VUID-PointCoord-PointCoord-04311"),
1118fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1119fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
1120fd4e5da5Sopenharmony_ci
1121fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1122fd4e5da5Sopenharmony_ci    PointCoordNotInput,
1123fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1124fd4e5da5Sopenharmony_ci    Combine(Values("PointCoord"), Values("Fragment"), Values("Output"),
1125fd4e5da5Sopenharmony_ci            Values("%f32vec2"), Values("VUID-PointCoord-PointCoord-04312"),
1126fd4e5da5Sopenharmony_ci            Values(TestResult(
1127fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1128fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
1129fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
1130fd4e5da5Sopenharmony_ci
1131fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1132fd4e5da5Sopenharmony_ci    PointCoordNotFloatVector,
1133fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1134fd4e5da5Sopenharmony_ci    Combine(Values("PointCoord"), Values("Fragment"), Values("Input"),
1135fd4e5da5Sopenharmony_ci            Values("%f32arr2", "%u32vec2"),
1136fd4e5da5Sopenharmony_ci            Values("VUID-PointCoord-PointCoord-04313"),
1137fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1138fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float vector",
1139fd4e5da5Sopenharmony_ci                              "is not a float vector"))));
1140fd4e5da5Sopenharmony_ci
1141fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1142fd4e5da5Sopenharmony_ci    PointCoordNotFloatVec3,
1143fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1144fd4e5da5Sopenharmony_ci    Combine(Values("PointCoord"), Values("Fragment"), Values("Input"),
1145fd4e5da5Sopenharmony_ci            Values("%f32vec3"), Values("VUID-PointCoord-PointCoord-04313"),
1146fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1147fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float vector",
1148fd4e5da5Sopenharmony_ci                              "has 3 components"))));
1149fd4e5da5Sopenharmony_ci
1150fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1151fd4e5da5Sopenharmony_ci    PointCoordNotF32Vec4,
1152fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1153fd4e5da5Sopenharmony_ci    Combine(Values("PointCoord"), Values("Fragment"), Values("Input"),
1154fd4e5da5Sopenharmony_ci            Values("%f64vec2"), Values("VUID-PointCoord-PointCoord-04313"),
1155fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1156fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float vector",
1157fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1158fd4e5da5Sopenharmony_ci
1159fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1160fd4e5da5Sopenharmony_ci    PointSizeOutputSuccess,
1161fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1162fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"),
1163fd4e5da5Sopenharmony_ci            Values("Vertex", "Geometry", "TessellationControl",
1164fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
1165fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32"), Values(nullptr),
1166fd4e5da5Sopenharmony_ci            Values(TestResult())));
1167fd4e5da5Sopenharmony_ci
1168fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1169fd4e5da5Sopenharmony_ci    PointSizeInputSuccess,
1170fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1171fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"),
1172fd4e5da5Sopenharmony_ci            Values("Geometry", "TessellationControl", "TessellationEvaluation"),
1173fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32"), Values(nullptr),
1174fd4e5da5Sopenharmony_ci            Values(TestResult())));
1175fd4e5da5Sopenharmony_ci
1176fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1177fd4e5da5Sopenharmony_ci    PointSizeVertexInput,
1178fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1179fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("Vertex"), Values("Input"),
1180fd4e5da5Sopenharmony_ci            Values("%f32"), Values("VUID-PointSize-PointSize-04315"),
1181fd4e5da5Sopenharmony_ci            Values(TestResult(
1182fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1183fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow BuiltIn PointSize "
1184fd4e5da5Sopenharmony_ci                "to be used for variables with Input storage class if "
1185fd4e5da5Sopenharmony_ci                "execution model is Vertex.",
1186fd4e5da5Sopenharmony_ci                "which is called with execution model Vertex."))));
1187fd4e5da5Sopenharmony_ci
1188fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1189fd4e5da5Sopenharmony_ci    PointSizeInvalidExecutionModel,
1190fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1191fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("GLCompute", "Fragment"),
1192fd4e5da5Sopenharmony_ci            Values("Input", "Output"), Values("%f32"),
1193fd4e5da5Sopenharmony_ci            Values("VUID-PointSize-PointSize-04314"),
1194fd4e5da5Sopenharmony_ci            Values(TestResult(
1195fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1196fd4e5da5Sopenharmony_ci                "to be used only with Vertex, TessellationControl, "
1197fd4e5da5Sopenharmony_ci                "TessellationEvaluation or Geometry execution models"))));
1198fd4e5da5Sopenharmony_ci
1199fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1200fd4e5da5Sopenharmony_ci    PointSizeNotFloatScalar,
1201fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1202fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("Vertex"), Values("Output"),
1203fd4e5da5Sopenharmony_ci            Values("%f32vec4", "%u32"),
1204fd4e5da5Sopenharmony_ci            Values("VUID-PointSize-PointSize-04317"),
1205fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1206fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
1207fd4e5da5Sopenharmony_ci                              "is not a float scalar"))));
1208fd4e5da5Sopenharmony_ci
1209fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1210fd4e5da5Sopenharmony_ci    PointSizeNotF32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1211fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("Vertex"), Values("Output"),
1212fd4e5da5Sopenharmony_ci            Values("%f64"), Values("VUID-PointSize-PointSize-04317"),
1213fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1214fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
1215fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
1216fd4e5da5Sopenharmony_ci
1217fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1218fd4e5da5Sopenharmony_ci    PositionOutputSuccess,
1219fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1220fd4e5da5Sopenharmony_ci    Combine(Values("Position"),
1221fd4e5da5Sopenharmony_ci            Values("Vertex", "Geometry", "TessellationControl",
1222fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
1223fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32vec4"), Values(nullptr),
1224fd4e5da5Sopenharmony_ci            Values(TestResult())));
1225fd4e5da5Sopenharmony_ci
1226fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1227fd4e5da5Sopenharmony_ci    PositionInputSuccess,
1228fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1229fd4e5da5Sopenharmony_ci    Combine(Values("Position"),
1230fd4e5da5Sopenharmony_ci            Values("Geometry", "TessellationControl", "TessellationEvaluation"),
1231fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec4"), Values(nullptr),
1232fd4e5da5Sopenharmony_ci            Values(TestResult())));
1233fd4e5da5Sopenharmony_ci
1234fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1235fd4e5da5Sopenharmony_ci    PositionInvalidStorageClass,
1236fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1237fd4e5da5Sopenharmony_ci    Combine(Values("Position"),
1238fd4e5da5Sopenharmony_ci            Values("Geometry", "TessellationControl", "TessellationEvaluation"),
1239fd4e5da5Sopenharmony_ci            Values("Private"), Values("%f32vec4"),
1240fd4e5da5Sopenharmony_ci            Values("VUID-Position-Position-04320"),
1241fd4e5da5Sopenharmony_ci            Values(TestResult(
1242fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1243fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn Position to be only used for "
1244fd4e5da5Sopenharmony_ci                "variables with Input or Output storage class."))));
1245fd4e5da5Sopenharmony_ci
1246fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1247fd4e5da5Sopenharmony_ci    PositionVertexInput,
1248fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1249fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("Vertex"), Values("Input"),
1250fd4e5da5Sopenharmony_ci            Values("%f32vec4"), Values("VUID-Position-Position-04319"),
1251fd4e5da5Sopenharmony_ci            Values(TestResult(
1252fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1253fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow BuiltIn Position "
1254fd4e5da5Sopenharmony_ci                "to be used for variables with Input storage class if "
1255fd4e5da5Sopenharmony_ci                "execution model is Vertex.",
1256fd4e5da5Sopenharmony_ci                "which is called with execution model Vertex."))));
1257fd4e5da5Sopenharmony_ci
1258fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1259fd4e5da5Sopenharmony_ci    PositionInvalidExecutionModel,
1260fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1261fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("GLCompute", "Fragment"),
1262fd4e5da5Sopenharmony_ci            Values("Input", "Output"), Values("%f32vec4"),
1263fd4e5da5Sopenharmony_ci            Values("VUID-Position-Position-04318"),
1264fd4e5da5Sopenharmony_ci            Values(TestResult(
1265fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1266fd4e5da5Sopenharmony_ci                "to be used only with Vertex, TessellationControl, "
1267fd4e5da5Sopenharmony_ci                "TessellationEvaluation or Geometry execution models"))));
1268fd4e5da5Sopenharmony_ci
1269fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1270fd4e5da5Sopenharmony_ci    PositionNotFloatVector,
1271fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1272fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("Geometry"), Values("Input"),
1273fd4e5da5Sopenharmony_ci            Values("%f32arr4", "%u32vec4"),
1274fd4e5da5Sopenharmony_ci            Values("VUID-Position-Position-04321"),
1275fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1276fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
1277fd4e5da5Sopenharmony_ci                              "is not a float vector"))));
1278fd4e5da5Sopenharmony_ci
1279fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1280fd4e5da5Sopenharmony_ci    PositionNotFloatVec4,
1281fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1282fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("Geometry"), Values("Input"),
1283fd4e5da5Sopenharmony_ci            Values("%f32vec3"), Values("VUID-Position-Position-04321"),
1284fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1285fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
1286fd4e5da5Sopenharmony_ci                              "has 3 components"))));
1287fd4e5da5Sopenharmony_ci
1288fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1289fd4e5da5Sopenharmony_ci    PositionNotF32Vec4,
1290fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1291fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("Geometry"), Values("Input"),
1292fd4e5da5Sopenharmony_ci            Values("%f64vec4"), Values("VUID-Position-Position-04321"),
1293fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1294fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
1295fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1296fd4e5da5Sopenharmony_ci
1297fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1298fd4e5da5Sopenharmony_ci    PrimitiveIdInputSuccess,
1299fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1300fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveId"),
1301fd4e5da5Sopenharmony_ci            Values("Fragment", "TessellationControl", "TessellationEvaluation",
1302fd4e5da5Sopenharmony_ci                   "Geometry"),
1303fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"), Values(nullptr),
1304fd4e5da5Sopenharmony_ci            Values(TestResult())));
1305fd4e5da5Sopenharmony_ci
1306fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1307fd4e5da5Sopenharmony_ci    PrimitiveIdOutputSuccess,
1308fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1309fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveId"), Values("Geometry"), Values("Output"),
1310fd4e5da5Sopenharmony_ci            Values("%u32"), Values(nullptr), Values(TestResult())));
1311fd4e5da5Sopenharmony_ci
1312fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1313fd4e5da5Sopenharmony_ci    PrimitiveIdInvalidExecutionModel,
1314fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1315fd4e5da5Sopenharmony_ci    Combine(
1316fd4e5da5Sopenharmony_ci        Values("PrimitiveId"), Values("Vertex", "GLCompute"), Values("Input"),
1317fd4e5da5Sopenharmony_ci        Values("%u32"), Values("VUID-PrimitiveId-PrimitiveId-04330"),
1318fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1319fd4e5da5Sopenharmony_ci                          "to be used only with Fragment, TessellationControl, "
1320fd4e5da5Sopenharmony_ci                          "TessellationEvaluation, Geometry, MeshNV, MeshEXT, "
1321fd4e5da5Sopenharmony_ci                          "IntersectionKHR, "
1322fd4e5da5Sopenharmony_ci                          "AnyHitKHR, and ClosestHitKHR execution models"))));
1323fd4e5da5Sopenharmony_ci
1324fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1325fd4e5da5Sopenharmony_ci    PrimitiveIdFragmentNotInput,
1326fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1327fd4e5da5Sopenharmony_ci    Combine(
1328fd4e5da5Sopenharmony_ci        Values("PrimitiveId"), Values("Fragment"), Values("Output"),
1329fd4e5da5Sopenharmony_ci        Values("%u32"), Values("VUID-PrimitiveId-PrimitiveId-04334"),
1330fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1331fd4e5da5Sopenharmony_ci                          "Output storage class if execution model is Fragment",
1332fd4e5da5Sopenharmony_ci                          "which is called with execution model Fragment"))));
1333fd4e5da5Sopenharmony_ci
1334fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1335fd4e5da5Sopenharmony_ci    PrimitiveIdTessellationNotInput,
1336fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1337fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveId"),
1338fd4e5da5Sopenharmony_ci            Values("TessellationControl", "TessellationEvaluation"),
1339fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
1340fd4e5da5Sopenharmony_ci            Values("VUID-PrimitiveId-PrimitiveId-04334"),
1341fd4e5da5Sopenharmony_ci            Values(TestResult(
1342fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1343fd4e5da5Sopenharmony_ci                "Output storage class if execution model is Tessellation",
1344fd4e5da5Sopenharmony_ci                "which is called with execution model Tessellation"))));
1345fd4e5da5Sopenharmony_ci
1346fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1347fd4e5da5Sopenharmony_ci    PrimitiveIdNotIntScalar,
1348fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1349fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveId"), Values("Fragment"), Values("Input"),
1350fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"),
1351fd4e5da5Sopenharmony_ci            Values("VUID-PrimitiveId-PrimitiveId-04337"),
1352fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1353fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1354fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1355fd4e5da5Sopenharmony_ci
1356fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1357fd4e5da5Sopenharmony_ci    PrimitiveIdNotInt32,
1358fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1359fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveId"), Values("Fragment"), Values("Input"),
1360fd4e5da5Sopenharmony_ci            Values("%u64"), Values("VUID-PrimitiveId-PrimitiveId-04337"),
1361fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1362fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1363fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
1364fd4e5da5Sopenharmony_ci
1365fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1366fd4e5da5Sopenharmony_ci    SampleIdSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1367fd4e5da5Sopenharmony_ci    Combine(Values("SampleId"), Values("Fragment"), Values("Input"),
1368fd4e5da5Sopenharmony_ci            Values("%u32"), Values(nullptr), Values(TestResult())));
1369fd4e5da5Sopenharmony_ci
1370fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1371fd4e5da5Sopenharmony_ci    SampleIdInvalidExecutionModel,
1372fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1373fd4e5da5Sopenharmony_ci    Combine(
1374fd4e5da5Sopenharmony_ci        Values("SampleId"),
1375fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
1376fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
1377fd4e5da5Sopenharmony_ci        Values("Input"), Values("%u32"), Values("VUID-SampleId-SampleId-04354"),
1378fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1379fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
1380fd4e5da5Sopenharmony_ci
1381fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1382fd4e5da5Sopenharmony_ci    SampleIdNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1383fd4e5da5Sopenharmony_ci    Combine(
1384fd4e5da5Sopenharmony_ci        Values("SampleId"), Values("Fragment"), Values("Output"),
1385fd4e5da5Sopenharmony_ci        Values("%u32"), Values("VUID-SampleId-SampleId-04355"),
1386fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1387fd4e5da5Sopenharmony_ci                          "Vulkan spec allows BuiltIn SampleId to be only used "
1388fd4e5da5Sopenharmony_ci                          "for variables with Input storage class"))));
1389fd4e5da5Sopenharmony_ci
1390fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1391fd4e5da5Sopenharmony_ci    SampleIdNotIntScalar,
1392fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1393fd4e5da5Sopenharmony_ci    Combine(Values("SampleId"), Values("Fragment"), Values("Input"),
1394fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"), Values("VUID-SampleId-SampleId-04356"),
1395fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1396fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1397fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1398fd4e5da5Sopenharmony_ci
1399fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1400fd4e5da5Sopenharmony_ci    SampleIdNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1401fd4e5da5Sopenharmony_ci    Combine(Values("SampleId"), Values("Fragment"), Values("Input"),
1402fd4e5da5Sopenharmony_ci            Values("%u64"), Values("VUID-SampleId-SampleId-04356"),
1403fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1404fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1405fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
1406fd4e5da5Sopenharmony_ci
1407fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1408fd4e5da5Sopenharmony_ci    SampleMaskSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1409fd4e5da5Sopenharmony_ci    Combine(Values("SampleMask"), Values("Fragment"), Values("Input", "Output"),
1410fd4e5da5Sopenharmony_ci            Values("%u32arr2", "%u32arr4"), Values(nullptr),
1411fd4e5da5Sopenharmony_ci            Values(TestResult())));
1412fd4e5da5Sopenharmony_ci
1413fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1414fd4e5da5Sopenharmony_ci    SampleMaskInvalidExecutionModel,
1415fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1416fd4e5da5Sopenharmony_ci    Combine(
1417fd4e5da5Sopenharmony_ci        Values("SampleMask"),
1418fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
1419fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
1420fd4e5da5Sopenharmony_ci        Values("Input"), Values("%u32arr2"),
1421fd4e5da5Sopenharmony_ci        Values("VUID-SampleMask-SampleMask-04357"),
1422fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1423fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
1424fd4e5da5Sopenharmony_ci
1425fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1426fd4e5da5Sopenharmony_ci    SampleMaskWrongStorageClass,
1427fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1428fd4e5da5Sopenharmony_ci    Combine(Values("SampleMask"), Values("Fragment"), Values("Workgroup"),
1429fd4e5da5Sopenharmony_ci            Values("%u32arr2"), Values("VUID-SampleMask-SampleMask-04358"),
1430fd4e5da5Sopenharmony_ci            Values(TestResult(
1431fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1432fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn SampleMask to be only used for "
1433fd4e5da5Sopenharmony_ci                "variables with Input or Output storage class"))));
1434fd4e5da5Sopenharmony_ci
1435fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1436fd4e5da5Sopenharmony_ci    SampleMaskNotArray,
1437fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1438fd4e5da5Sopenharmony_ci    Combine(Values("SampleMask"), Values("Fragment"), Values("Input"),
1439fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"),
1440fd4e5da5Sopenharmony_ci            Values("VUID-SampleMask-SampleMask-04359"),
1441fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1442fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int array",
1443fd4e5da5Sopenharmony_ci                              "is not an array"))));
1444fd4e5da5Sopenharmony_ci
1445fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1446fd4e5da5Sopenharmony_ci    SampleMaskNotIntArray,
1447fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1448fd4e5da5Sopenharmony_ci    Combine(Values("SampleMask"), Values("Fragment"), Values("Input"),
1449fd4e5da5Sopenharmony_ci            Values("%f32arr2"), Values("VUID-SampleMask-SampleMask-04359"),
1450fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1451fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int array",
1452fd4e5da5Sopenharmony_ci                              "components are not int scalar"))));
1453fd4e5da5Sopenharmony_ci
1454fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1455fd4e5da5Sopenharmony_ci    SampleMaskNotInt32Array,
1456fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1457fd4e5da5Sopenharmony_ci    Combine(Values("SampleMask"), Values("Fragment"), Values("Input"),
1458fd4e5da5Sopenharmony_ci            Values("%u64arr2"), Values("VUID-SampleMask-SampleMask-04359"),
1459fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1460fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int array",
1461fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1462fd4e5da5Sopenharmony_ci
1463fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1464fd4e5da5Sopenharmony_ci    SamplePositionSuccess,
1465fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1466fd4e5da5Sopenharmony_ci    Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"),
1467fd4e5da5Sopenharmony_ci            Values("%f32vec2"), Values(nullptr), Values(TestResult())));
1468fd4e5da5Sopenharmony_ci
1469fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1470fd4e5da5Sopenharmony_ci    SamplePositionNotFragment,
1471fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1472fd4e5da5Sopenharmony_ci    Combine(
1473fd4e5da5Sopenharmony_ci        Values("SamplePosition"),
1474fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
1475fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
1476fd4e5da5Sopenharmony_ci        Values("Input"), Values("%f32vec2"),
1477fd4e5da5Sopenharmony_ci        Values("VUID-SamplePosition-SamplePosition-04360"),
1478fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1479fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
1480fd4e5da5Sopenharmony_ci
1481fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1482fd4e5da5Sopenharmony_ci    SamplePositionNotInput,
1483fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1484fd4e5da5Sopenharmony_ci    Combine(Values("SamplePosition"), Values("Fragment"), Values("Output"),
1485fd4e5da5Sopenharmony_ci            Values("%f32vec2"),
1486fd4e5da5Sopenharmony_ci            Values("VUID-SamplePosition-SamplePosition-04361"),
1487fd4e5da5Sopenharmony_ci            Values(TestResult(
1488fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1489fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
1490fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
1491fd4e5da5Sopenharmony_ci
1492fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1493fd4e5da5Sopenharmony_ci    SamplePositionNotFloatVector,
1494fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1495fd4e5da5Sopenharmony_ci    Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"),
1496fd4e5da5Sopenharmony_ci            Values("%f32arr2", "%u32vec4"),
1497fd4e5da5Sopenharmony_ci            Values("VUID-SamplePosition-SamplePosition-04362"),
1498fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1499fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float vector",
1500fd4e5da5Sopenharmony_ci                              "is not a float vector"))));
1501fd4e5da5Sopenharmony_ci
1502fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1503fd4e5da5Sopenharmony_ci    SamplePositionNotFloatVec2,
1504fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1505fd4e5da5Sopenharmony_ci    Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"),
1506fd4e5da5Sopenharmony_ci            Values("%f32vec3"),
1507fd4e5da5Sopenharmony_ci            Values("VUID-SamplePosition-SamplePosition-04362"),
1508fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1509fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float vector",
1510fd4e5da5Sopenharmony_ci                              "has 3 components"))));
1511fd4e5da5Sopenharmony_ci
1512fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1513fd4e5da5Sopenharmony_ci    SamplePositionNotF32Vec2,
1514fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1515fd4e5da5Sopenharmony_ci    Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"),
1516fd4e5da5Sopenharmony_ci            Values("%f64vec2"),
1517fd4e5da5Sopenharmony_ci            Values("VUID-SamplePosition-SamplePosition-04362"),
1518fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1519fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float vector",
1520fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1521fd4e5da5Sopenharmony_ci
1522fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1523fd4e5da5Sopenharmony_ci    TessCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1524fd4e5da5Sopenharmony_ci    Combine(Values("TessCoord"), Values("TessellationEvaluation"),
1525fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec3"), Values(nullptr),
1526fd4e5da5Sopenharmony_ci            Values(TestResult())));
1527fd4e5da5Sopenharmony_ci
1528fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1529fd4e5da5Sopenharmony_ci    TessCoordNotFragment,
1530fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1531fd4e5da5Sopenharmony_ci    Combine(
1532fd4e5da5Sopenharmony_ci        Values("TessCoord"),
1533fd4e5da5Sopenharmony_ci        Values("Vertex", "GLCompute", "Geometry", "TessellationControl",
1534fd4e5da5Sopenharmony_ci               "Fragment"),
1535fd4e5da5Sopenharmony_ci        Values("Input"), Values("%f32vec3"),
1536fd4e5da5Sopenharmony_ci        Values("VUID-TessCoord-TessCoord-04387"),
1537fd4e5da5Sopenharmony_ci        Values(TestResult(
1538fd4e5da5Sopenharmony_ci            SPV_ERROR_INVALID_DATA,
1539fd4e5da5Sopenharmony_ci            "to be used only with TessellationEvaluation execution model"))));
1540fd4e5da5Sopenharmony_ci
1541fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1542fd4e5da5Sopenharmony_ci    TessCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1543fd4e5da5Sopenharmony_ci    Combine(Values("TessCoord"), Values("Fragment"), Values("Output"),
1544fd4e5da5Sopenharmony_ci            Values("%f32vec3"), Values("VUID-TessCoord-TessCoord-04388"),
1545fd4e5da5Sopenharmony_ci            Values(TestResult(
1546fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1547fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
1548fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
1549fd4e5da5Sopenharmony_ci
1550fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1551fd4e5da5Sopenharmony_ci    TessCoordNotFloatVector,
1552fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1553fd4e5da5Sopenharmony_ci    Combine(Values("TessCoord"), Values("Fragment"), Values("Input"),
1554fd4e5da5Sopenharmony_ci            Values("%f32arr3", "%u32vec4"),
1555fd4e5da5Sopenharmony_ci            Values("VUID-TessCoord-TessCoord-04389"),
1556fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1557fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit float vector",
1558fd4e5da5Sopenharmony_ci                              "is not a float vector"))));
1559fd4e5da5Sopenharmony_ci
1560fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1561fd4e5da5Sopenharmony_ci    TessCoordNotFloatVec3,
1562fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1563fd4e5da5Sopenharmony_ci    Combine(Values("TessCoord"), Values("Fragment"), Values("Input"),
1564fd4e5da5Sopenharmony_ci            Values("%f32vec2"), Values("VUID-TessCoord-TessCoord-04389"),
1565fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1566fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit float vector",
1567fd4e5da5Sopenharmony_ci                              "has 2 components"))));
1568fd4e5da5Sopenharmony_ci
1569fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1570fd4e5da5Sopenharmony_ci    TessCoordNotF32Vec3,
1571fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1572fd4e5da5Sopenharmony_ci    Combine(Values("TessCoord"), Values("Fragment"), Values("Input"),
1573fd4e5da5Sopenharmony_ci            Values("%f64vec3"), Values("VUID-TessCoord-TessCoord-04389"),
1574fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1575fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit float vector",
1576fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1577fd4e5da5Sopenharmony_ci
1578fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1579fd4e5da5Sopenharmony_ci    TessLevelOuterTeseInputSuccess,
1580fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1581fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"),
1582fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr4"), Values(nullptr),
1583fd4e5da5Sopenharmony_ci            Values(TestResult())));
1584fd4e5da5Sopenharmony_ci
1585fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1586fd4e5da5Sopenharmony_ci    TessLevelOuterTescOutputSuccess,
1587fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1588fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationControl"),
1589fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr4"), Values(nullptr),
1590fd4e5da5Sopenharmony_ci            Values(TestResult())));
1591fd4e5da5Sopenharmony_ci
1592fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1593fd4e5da5Sopenharmony_ci    TessLevelOuterInvalidExecutionModel,
1594fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1595fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"),
1596fd4e5da5Sopenharmony_ci            Values("Vertex", "GLCompute", "Geometry", "Fragment"),
1597fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr4"),
1598fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04390"),
1599fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1600fd4e5da5Sopenharmony_ci                              "to be used only with TessellationControl or "
1601fd4e5da5Sopenharmony_ci                              "TessellationEvaluation execution models."))));
1602fd4e5da5Sopenharmony_ci
1603fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1604fd4e5da5Sopenharmony_ci    TessLevelOuterOutputTese,
1605fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1606fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"),
1607fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr4"),
1608fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04392"),
1609fd4e5da5Sopenharmony_ci            Values(TestResult(
1610fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1611fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be "
1612fd4e5da5Sopenharmony_ci                "used for variables with Output storage class if execution "
1613fd4e5da5Sopenharmony_ci                "model is TessellationEvaluation."))));
1614fd4e5da5Sopenharmony_ci
1615fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1616fd4e5da5Sopenharmony_ci    TessLevelOuterInputTesc,
1617fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1618fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationControl"),
1619fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr4"),
1620fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04391"),
1621fd4e5da5Sopenharmony_ci            Values(TestResult(
1622fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1623fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be "
1624fd4e5da5Sopenharmony_ci                "used for variables with Input storage class if execution "
1625fd4e5da5Sopenharmony_ci                "model is TessellationControl."))));
1626fd4e5da5Sopenharmony_ci
1627fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1628fd4e5da5Sopenharmony_ci    TessLevelOuterNotArray,
1629fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1630fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"),
1631fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec4", "%f32"),
1632fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04393"),
1633fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1634fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float array",
1635fd4e5da5Sopenharmony_ci                              "is not an array"))));
1636fd4e5da5Sopenharmony_ci
1637fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1638fd4e5da5Sopenharmony_ci    TessLevelOuterNotFloatArray,
1639fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1640fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"),
1641fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32arr4"),
1642fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04393"),
1643fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1644fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float array",
1645fd4e5da5Sopenharmony_ci                              "components are not float scalar"))));
1646fd4e5da5Sopenharmony_ci
1647fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1648fd4e5da5Sopenharmony_ci    TessLevelOuterNotFloatArr4,
1649fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1650fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"),
1651fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr3"),
1652fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04393"),
1653fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1654fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float array",
1655fd4e5da5Sopenharmony_ci                              "has 3 components"))));
1656fd4e5da5Sopenharmony_ci
1657fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1658fd4e5da5Sopenharmony_ci    TessLevelOuterNotF32Arr4,
1659fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1660fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"),
1661fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f64arr4"),
1662fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelOuter-TessLevelOuter-04393"),
1663fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1664fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float array",
1665fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1666fd4e5da5Sopenharmony_ci
1667fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1668fd4e5da5Sopenharmony_ci    TessLevelInnerTeseInputSuccess,
1669fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1670fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationEvaluation"),
1671fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr2"), Values(nullptr),
1672fd4e5da5Sopenharmony_ci            Values(TestResult())));
1673fd4e5da5Sopenharmony_ci
1674fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1675fd4e5da5Sopenharmony_ci    TessLevelInnerTescOutputSuccess,
1676fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1677fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationControl"),
1678fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr2"), Values(nullptr),
1679fd4e5da5Sopenharmony_ci            Values(TestResult())));
1680fd4e5da5Sopenharmony_ci
1681fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1682fd4e5da5Sopenharmony_ci    TessLevelInnerInvalidExecutionModel,
1683fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1684fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"),
1685fd4e5da5Sopenharmony_ci            Values("Vertex", "GLCompute", "Geometry", "Fragment"),
1686fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr2"),
1687fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04394"),
1688fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1689fd4e5da5Sopenharmony_ci                              "to be used only with TessellationControl or "
1690fd4e5da5Sopenharmony_ci                              "TessellationEvaluation execution models."))));
1691fd4e5da5Sopenharmony_ci
1692fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1693fd4e5da5Sopenharmony_ci    TessLevelInnerOutputTese,
1694fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1695fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationEvaluation"),
1696fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr2"),
1697fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04396"),
1698fd4e5da5Sopenharmony_ci            Values(TestResult(
1699fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1700fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be "
1701fd4e5da5Sopenharmony_ci                "used for variables with Output storage class if execution "
1702fd4e5da5Sopenharmony_ci                "model is TessellationEvaluation."))));
1703fd4e5da5Sopenharmony_ci
1704fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1705fd4e5da5Sopenharmony_ci    TessLevelInnerInputTesc,
1706fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1707fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationControl"),
1708fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr2"),
1709fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04395"),
1710fd4e5da5Sopenharmony_ci            Values(TestResult(
1711fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1712fd4e5da5Sopenharmony_ci                "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be "
1713fd4e5da5Sopenharmony_ci                "used for variables with Input storage class if execution "
1714fd4e5da5Sopenharmony_ci                "model is TessellationControl."))));
1715fd4e5da5Sopenharmony_ci
1716fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1717fd4e5da5Sopenharmony_ci    TessLevelInnerNotArray,
1718fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1719fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationEvaluation"),
1720fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec2", "%f32"),
1721fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04397"),
1722fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1723fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float array",
1724fd4e5da5Sopenharmony_ci                              "is not an array"))));
1725fd4e5da5Sopenharmony_ci
1726fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1727fd4e5da5Sopenharmony_ci    TessLevelInnerNotFloatArray,
1728fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1729fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationEvaluation"),
1730fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32arr2"),
1731fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04397"),
1732fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1733fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float array",
1734fd4e5da5Sopenharmony_ci                              "components are not float scalar"))));
1735fd4e5da5Sopenharmony_ci
1736fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1737fd4e5da5Sopenharmony_ci    TessLevelInnerNotFloatArr2,
1738fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1739fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationEvaluation"),
1740fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr3"),
1741fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04397"),
1742fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1743fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float array",
1744fd4e5da5Sopenharmony_ci                              "has 3 components"))));
1745fd4e5da5Sopenharmony_ci
1746fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1747fd4e5da5Sopenharmony_ci    TessLevelInnerNotF32Arr2,
1748fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1749fd4e5da5Sopenharmony_ci    Combine(Values("TessLevelInner"), Values("TessellationEvaluation"),
1750fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f64arr2"),
1751fd4e5da5Sopenharmony_ci            Values("VUID-TessLevelInner-TessLevelInner-04397"),
1752fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1753fd4e5da5Sopenharmony_ci                              "needs to be a 2-component 32-bit float array",
1754fd4e5da5Sopenharmony_ci                              "has components with bit width 64"))));
1755fd4e5da5Sopenharmony_ci
1756fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1757fd4e5da5Sopenharmony_ci    VertexIndexSuccess,
1758fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1759fd4e5da5Sopenharmony_ci    Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"),
1760fd4e5da5Sopenharmony_ci            Values("%u32"), Values(nullptr), Values(TestResult())));
1761fd4e5da5Sopenharmony_ci
1762fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1763fd4e5da5Sopenharmony_ci    VertexIndexInvalidExecutionModel,
1764fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1765fd4e5da5Sopenharmony_ci    Combine(Values("VertexIndex"),
1766fd4e5da5Sopenharmony_ci            Values("Fragment", "GLCompute", "Geometry", "TessellationControl",
1767fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
1768fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
1769fd4e5da5Sopenharmony_ci            Values("VUID-VertexIndex-VertexIndex-04398"),
1770fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1771fd4e5da5Sopenharmony_ci                              "to be used only with Vertex execution model"))));
1772fd4e5da5Sopenharmony_ci
1773fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1774fd4e5da5Sopenharmony_ci    VertexIndexNotInput,
1775fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1776fd4e5da5Sopenharmony_ci    Combine(
1777fd4e5da5Sopenharmony_ci        Values("VertexIndex"), Values("Vertex"), Values("Output"),
1778fd4e5da5Sopenharmony_ci        Values("%u32"), Values("VUID-VertexIndex-VertexIndex-04399"),
1779fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
1780fd4e5da5Sopenharmony_ci                          "Vulkan spec allows BuiltIn VertexIndex to be only "
1781fd4e5da5Sopenharmony_ci                          "used for variables with Input storage class"))));
1782fd4e5da5Sopenharmony_ci
1783fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1784fd4e5da5Sopenharmony_ci    VertexIndexNotIntScalar,
1785fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1786fd4e5da5Sopenharmony_ci    Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"),
1787fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"),
1788fd4e5da5Sopenharmony_ci            Values("VUID-VertexIndex-VertexIndex-04400"),
1789fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1790fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1791fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1792fd4e5da5Sopenharmony_ci
1793fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1794fd4e5da5Sopenharmony_ci    VertexIndexNotInt32,
1795fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeResult,
1796fd4e5da5Sopenharmony_ci    Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"),
1797fd4e5da5Sopenharmony_ci            Values("%u64"), Values("VUID-VertexIndex-VertexIndex-04400"),
1798fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1799fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1800fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
1801fd4e5da5Sopenharmony_ci
1802fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1803fd4e5da5Sopenharmony_ci    BaseInstanceOrVertexSuccess,
1804fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1805fd4e5da5Sopenharmony_ci    Combine(Values("BaseInstance", "BaseVertex"), Values("Vertex"),
1806fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
1807fd4e5da5Sopenharmony_ci            Values("OpCapability DrawParameters\n"),
1808fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1809fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
1810fd4e5da5Sopenharmony_ci
1811fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1812fd4e5da5Sopenharmony_ci    BaseInstanceOrVertexInvalidExecutionModel,
1813fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1814fd4e5da5Sopenharmony_ci    Combine(Values("BaseInstance", "BaseVertex"),
1815fd4e5da5Sopenharmony_ci            Values("Fragment", "GLCompute", "Geometry", "TessellationControl",
1816fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
1817fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
1818fd4e5da5Sopenharmony_ci            Values("OpCapability DrawParameters\n"),
1819fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1820fd4e5da5Sopenharmony_ci            Values("VUID-BaseInstance-BaseInstance-04181 "
1821fd4e5da5Sopenharmony_ci                   "VUID-BaseVertex-BaseVertex-04184"),
1822fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1823fd4e5da5Sopenharmony_ci                              "to be used only with Vertex execution model"))));
1824fd4e5da5Sopenharmony_ci
1825fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1826fd4e5da5Sopenharmony_ci    BaseInstanceOrVertexNotInput,
1827fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1828fd4e5da5Sopenharmony_ci    Combine(Values("BaseInstance", "BaseVertex"), Values("Vertex"),
1829fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
1830fd4e5da5Sopenharmony_ci            Values("OpCapability DrawParameters\n"),
1831fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1832fd4e5da5Sopenharmony_ci            Values("VUID-BaseInstance-BaseInstance-04182 "
1833fd4e5da5Sopenharmony_ci                   "VUID-BaseVertex-BaseVertex-04185"),
1834fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
1835fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
1836fd4e5da5Sopenharmony_ci
1837fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1838fd4e5da5Sopenharmony_ci    BaseInstanceOrVertexNotIntScalar,
1839fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1840fd4e5da5Sopenharmony_ci    Combine(Values("BaseInstance", "BaseVertex"), Values("Vertex"),
1841fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
1842fd4e5da5Sopenharmony_ci            Values("OpCapability DrawParameters\n"),
1843fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1844fd4e5da5Sopenharmony_ci            Values("VUID-BaseInstance-BaseInstance-04183 "
1845fd4e5da5Sopenharmony_ci                   "VUID-BaseVertex-BaseVertex-04186"),
1846fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1847fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1848fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1849fd4e5da5Sopenharmony_ci
1850fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1851fd4e5da5Sopenharmony_ci    DrawIndexSuccess,
1852fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1853fd4e5da5Sopenharmony_ci    Combine(Values("DrawIndex"), Values("Vertex"), Values("Input"),
1854fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability DrawParameters\n"),
1855fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1856fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
1857fd4e5da5Sopenharmony_ci
1858fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1859fd4e5da5Sopenharmony_ci    DrawIndexMeshSuccess,
1860fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1861fd4e5da5Sopenharmony_ci    Combine(
1862fd4e5da5Sopenharmony_ci        Values("DrawIndex"), Values("MeshNV", "TaskNV"), Values("Input"),
1863fd4e5da5Sopenharmony_ci        Values("%u32"), Values("OpCapability MeshShadingNV\n"),
1864fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\nOpExtension "
1865fd4e5da5Sopenharmony_ci               "\"SPV_NV_mesh_shader\"\n"),
1866fd4e5da5Sopenharmony_ci        Values(nullptr), Values(TestResult())));
1867fd4e5da5Sopenharmony_ci
1868fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1869fd4e5da5Sopenharmony_ci    DrawIndexInvalidExecutionModel,
1870fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1871fd4e5da5Sopenharmony_ci    Combine(
1872fd4e5da5Sopenharmony_ci        Values("DrawIndex"),
1873fd4e5da5Sopenharmony_ci        Values("Fragment", "GLCompute", "Geometry", "TessellationControl",
1874fd4e5da5Sopenharmony_ci               "TessellationEvaluation"),
1875fd4e5da5Sopenharmony_ci        Values("Input"), Values("%u32"),
1876fd4e5da5Sopenharmony_ci        Values("OpCapability DrawParameters\n"),
1877fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1878fd4e5da5Sopenharmony_ci        Values("VUID-DrawIndex-DrawIndex-04207"),
1879fd4e5da5Sopenharmony_ci        Values(TestResult(
1880fd4e5da5Sopenharmony_ci            SPV_ERROR_INVALID_DATA,
1881fd4e5da5Sopenharmony_ci            "to be used only with Vertex, MeshNV, TaskNV , MeshEXT or TaskEXT "
1882fd4e5da5Sopenharmony_ci            "execution model"))));
1883fd4e5da5Sopenharmony_ci
1884fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1885fd4e5da5Sopenharmony_ci    DrawIndexNotInput,
1886fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1887fd4e5da5Sopenharmony_ci    Combine(Values("DrawIndex"), Values("Vertex"), Values("Output"),
1888fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability DrawParameters\n"),
1889fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1890fd4e5da5Sopenharmony_ci            Values("VUID-DrawIndex-DrawIndex-04208"),
1891fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
1892fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
1893fd4e5da5Sopenharmony_ci
1894fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1895fd4e5da5Sopenharmony_ci    DrawIndexNotIntScalar,
1896fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1897fd4e5da5Sopenharmony_ci    Combine(Values("DrawIndex"), Values("Vertex"), Values("Input"),
1898fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"), Values("OpCapability DrawParameters\n"),
1899fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_shader_draw_parameters\"\n"),
1900fd4e5da5Sopenharmony_ci            Values("VUID-DrawIndex-DrawIndex-04209"),
1901fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1902fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1903fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1904fd4e5da5Sopenharmony_ci
1905fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1906fd4e5da5Sopenharmony_ci    ViewIndexSuccess,
1907fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1908fd4e5da5Sopenharmony_ci    Combine(Values("ViewIndex"),
1909fd4e5da5Sopenharmony_ci            Values("Fragment", "Vertex", "Geometry", "TessellationControl",
1910fd4e5da5Sopenharmony_ci                   "TessellationEvaluation"),
1911fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"), Values("OpCapability MultiView\n"),
1912fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_multiview\"\n"), Values(nullptr),
1913fd4e5da5Sopenharmony_ci            Values(TestResult())));
1914fd4e5da5Sopenharmony_ci
1915fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1916fd4e5da5Sopenharmony_ci    ViewIndexInvalidExecutionModel,
1917fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1918fd4e5da5Sopenharmony_ci    Combine(Values("ViewIndex"), Values("GLCompute"), Values("Input"),
1919fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability MultiView\n"),
1920fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_multiview\"\n"),
1921fd4e5da5Sopenharmony_ci            Values("VUID-ViewIndex-ViewIndex-04401"),
1922fd4e5da5Sopenharmony_ci            Values(TestResult(
1923fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
1924fd4e5da5Sopenharmony_ci                "to be not be used with GLCompute execution model"))));
1925fd4e5da5Sopenharmony_ci
1926fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1927fd4e5da5Sopenharmony_ci    ViewIndexNotInput,
1928fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1929fd4e5da5Sopenharmony_ci    Combine(Values("ViewIndex"), Values("Vertex"), Values("Output"),
1930fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability MultiView\n"),
1931fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_multiview\"\n"),
1932fd4e5da5Sopenharmony_ci            Values("VUID-ViewIndex-ViewIndex-04402"),
1933fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
1934fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
1935fd4e5da5Sopenharmony_ci
1936fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1937fd4e5da5Sopenharmony_ci    ViewIndexNotIntScalar,
1938fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1939fd4e5da5Sopenharmony_ci    Combine(Values("ViewIndex"), Values("Vertex"), Values("Input"),
1940fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"), Values("OpCapability MultiView\n"),
1941fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_multiview\"\n"),
1942fd4e5da5Sopenharmony_ci            Values("VUID-ViewIndex-ViewIndex-04403"),
1943fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1944fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1945fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1946fd4e5da5Sopenharmony_ci
1947fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1948fd4e5da5Sopenharmony_ci    DeviceIndexSuccess,
1949fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1950fd4e5da5Sopenharmony_ci    Combine(Values("DeviceIndex"),
1951fd4e5da5Sopenharmony_ci            Values("Fragment", "Vertex", "Geometry", "TessellationControl",
1952fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "GLCompute"),
1953fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
1954fd4e5da5Sopenharmony_ci            Values("OpCapability DeviceGroup\n"),
1955fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_device_group\"\n"), Values(nullptr),
1956fd4e5da5Sopenharmony_ci            Values(TestResult())));
1957fd4e5da5Sopenharmony_ci
1958fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1959fd4e5da5Sopenharmony_ci    DeviceIndexNotInput,
1960fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1961fd4e5da5Sopenharmony_ci    Combine(Values("DeviceIndex"), Values("Fragment", "Vertex", "GLCompute"),
1962fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
1963fd4e5da5Sopenharmony_ci            Values("OpCapability DeviceGroup\n"),
1964fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_device_group\"\n"),
1965fd4e5da5Sopenharmony_ci            Values("VUID-DeviceIndex-DeviceIndex-04205"),
1966fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
1967fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
1968fd4e5da5Sopenharmony_ci
1969fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1970fd4e5da5Sopenharmony_ci    DeviceIndexNotIntScalar,
1971fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1972fd4e5da5Sopenharmony_ci    Combine(Values("DeviceIndex"), Values("Fragment", "Vertex", "GLCompute"),
1973fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
1974fd4e5da5Sopenharmony_ci            Values("OpCapability DeviceGroup\n"),
1975fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_device_group\"\n"),
1976fd4e5da5Sopenharmony_ci            Values("VUID-DeviceIndex-DeviceIndex-04206"),
1977fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
1978fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
1979fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
1980fd4e5da5Sopenharmony_ci
1981fd4e5da5Sopenharmony_ci// Test HitKind in NV RT shaders
1982fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1983fd4e5da5Sopenharmony_ci    HitKindNVSuccess,
1984fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1985fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitKindNV"),
1986fd4e5da5Sopenharmony_ci            Values("AnyHitNV", "ClosestHitNV"), Values("Input"), Values("%u32"),
1987fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingNV\n"),
1988fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_ray_tracing\"\n"), Values(nullptr),
1989fd4e5da5Sopenharmony_ci            Values(TestResult())));
1990fd4e5da5Sopenharmony_ci
1991fd4e5da5Sopenharmony_ci// HitKind is valid in AH, CH shaders as input i32 scalar
1992fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
1993fd4e5da5Sopenharmony_ci    HitKindSuccess,
1994fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
1995fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitKindKHR"),
1996fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR"), Values("Input"),
1997fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability RayTracingKHR\n"),
1998fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
1999fd4e5da5Sopenharmony_ci            Values(TestResult())));
2000fd4e5da5Sopenharmony_ci
2001fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2002fd4e5da5Sopenharmony_ci    HitKindNotExecutionMode,
2003fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2004fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitKindKHR"),
2005fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2006fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2007fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "IntersectionKHR",
2008fd4e5da5Sopenharmony_ci                   "MissKHR", "CallableKHR"),
2009fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2010fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2011fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2012fd4e5da5Sopenharmony_ci            Values("VUID-HitKindKHR-HitKindKHR-04242"),
2013fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2014fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2015fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2016fd4e5da5Sopenharmony_ci
2017fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2018fd4e5da5Sopenharmony_ci    HitKindNotInput,
2019fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2020fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitKindKHR"),
2021fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR"), Values("Output"),
2022fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability RayTracingKHR\n"),
2023fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2024fd4e5da5Sopenharmony_ci            Values("VUID-HitKindKHR-HitKindKHR-04243"),
2025fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2026fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2027fd4e5da5Sopenharmony_ci
2028fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2029fd4e5da5Sopenharmony_ci    HitKindNotIntScalar,
2030fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2031fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitKindKHR"),
2032fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR"), Values("Input"),
2033fd4e5da5Sopenharmony_ci            Values("%f32", "%u32vec3"), Values("OpCapability RayTracingKHR\n"),
2034fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2035fd4e5da5Sopenharmony_ci            Values("VUID-HitKindKHR-HitKindKHR-04244"),
2036fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2037fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2038fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2039fd4e5da5Sopenharmony_ci
2040fd4e5da5Sopenharmony_ci// Ensure HitT is not supported in KHR RT shaders
2041fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2042fd4e5da5Sopenharmony_ci    HitTNVNotSupportedInKHR,
2043fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2044fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitTNV"),
2045fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR"), Values("Input"),
2046fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability RayTracingKHR\n"),
2047fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2048fd4e5da5Sopenharmony_ci            Values(TestResult(
2049fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_CAPABILITY,
2050fd4e5da5Sopenharmony_ci                "of MemberDecorate requires one of these capabilities"))));
2051fd4e5da5Sopenharmony_ci
2052fd4e5da5Sopenharmony_ci// HitT is valid in AH, CH shaders as input f32 scalar (NV RT only)
2053fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2054fd4e5da5Sopenharmony_ci    HitTNVSuccess,
2055fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2056fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitTNV"),
2057fd4e5da5Sopenharmony_ci            Values("AnyHitNV", "ClosestHitNV"), Values("Input"), Values("%f32"),
2058fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingNV\n"),
2059fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_ray_tracing\"\n"), Values(nullptr),
2060fd4e5da5Sopenharmony_ci            Values(TestResult())));
2061fd4e5da5Sopenharmony_ci
2062fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2063fd4e5da5Sopenharmony_ci    HitTNVNotExecutionMode,
2064fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2065fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitTNV"),
2066fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2067fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2068fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationNV", "IntersectionNV", "MissNV",
2069fd4e5da5Sopenharmony_ci                   "CallableNV"),
2070fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32"),
2071fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingNV\n"),
2072fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_ray_tracing\"\n"),
2073fd4e5da5Sopenharmony_ci            Values("VUID-HitTNV-HitTNV-04245"),
2074fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2075fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2076fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2077fd4e5da5Sopenharmony_ci
2078fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2079fd4e5da5Sopenharmony_ci    HitTNVNotInput,
2080fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2081fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitTNV"),
2082fd4e5da5Sopenharmony_ci            Values("AnyHitNV", "ClosestHitNV"), Values("Output"),
2083fd4e5da5Sopenharmony_ci            Values("%f32"), Values("OpCapability RayTracingNV\n"),
2084fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_ray_tracing\"\n"),
2085fd4e5da5Sopenharmony_ci            Values("VUID-HitTNV-HitTNV-04246"),
2086fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2087fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2088fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2089fd4e5da5Sopenharmony_ci    HitTNVNotIntScalar,
2090fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2091fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("HitTNV"),
2092fd4e5da5Sopenharmony_ci            Values("AnyHitNV", "ClosestHitNV"), Values("Input"),
2093fd4e5da5Sopenharmony_ci            Values("%u32", "%f32vec3"), Values("OpCapability RayTracingNV\n"),
2094fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_ray_tracing\"\n"),
2095fd4e5da5Sopenharmony_ci            Values("VUID-HitTNV-HitTNV-04247"),
2096fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2097fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
2098fd4e5da5Sopenharmony_ci                              "is not a float scalar"))));
2099fd4e5da5Sopenharmony_ci
2100fd4e5da5Sopenharmony_ci// InstanceCustomIndexKHR, InstanceId, PrimitiveId, RayGeometryIndexKHR are
2101fd4e5da5Sopenharmony_ci// valid in IS, AH, CH shaders as input i32 scalars
2102fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2103fd4e5da5Sopenharmony_ci    RTBuiltIn3StageI32Success,
2104fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2105fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2106fd4e5da5Sopenharmony_ci            Values("InstanceCustomIndexKHR", "RayGeometryIndexKHR",
2107fd4e5da5Sopenharmony_ci                   "InstanceId", "PrimitiveId"),
2108fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2109fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2110fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2111fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2112fd4e5da5Sopenharmony_ci            Values(TestResult())));
2113fd4e5da5Sopenharmony_ci
2114fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2115fd4e5da5Sopenharmony_ci    RTBuiltIn3StageI32NotExecutionMode,
2116fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2117fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2118fd4e5da5Sopenharmony_ci            Values("InstanceCustomIndexKHR", "RayGeometryIndexKHR",
2119fd4e5da5Sopenharmony_ci                   "InstanceId"),
2120fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2121fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2122fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "MissKHR", "CallableKHR"),
2123fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2124fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2125fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2126fd4e5da5Sopenharmony_ci            Values("VUID-InstanceCustomIndexKHR-InstanceCustomIndexKHR-04251 "
2127fd4e5da5Sopenharmony_ci                   "VUID-RayGeometryIndexKHR-RayGeometryIndexKHR-04345 "
2128fd4e5da5Sopenharmony_ci                   "VUID-InstanceId-InstanceId-04254 "),
2129fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2130fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2131fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2132fd4e5da5Sopenharmony_ci
2133fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2134fd4e5da5Sopenharmony_ci    RTBuiltIn3StageI32NotInput,
2135fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2136fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2137fd4e5da5Sopenharmony_ci            Values("InstanceCustomIndexKHR", "RayGeometryIndexKHR",
2138fd4e5da5Sopenharmony_ci                   "InstanceId"),
2139fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2140fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
2141fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2142fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2143fd4e5da5Sopenharmony_ci            Values("VUID-InstanceCustomIndexKHR-InstanceCustomIndexKHR-04252 "
2144fd4e5da5Sopenharmony_ci                   "VUID-RayGeometryIndexKHR-RayGeometryIndexKHR-04346 "
2145fd4e5da5Sopenharmony_ci                   "VUID-InstanceId-InstanceId-04255 "),
2146fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2147fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2148fd4e5da5Sopenharmony_ci
2149fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2150fd4e5da5Sopenharmony_ci    RTBuiltIn3StageI32NotIntScalar,
2151fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2152fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2153fd4e5da5Sopenharmony_ci            Values("InstanceCustomIndexKHR", "RayGeometryIndexKHR",
2154fd4e5da5Sopenharmony_ci                   "InstanceId"),
2155fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2156fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
2157fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2158fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2159fd4e5da5Sopenharmony_ci            Values("VUID-InstanceCustomIndexKHR-InstanceCustomIndexKHR-04253 "
2160fd4e5da5Sopenharmony_ci                   "VUID-RayGeometryIndexKHR-RayGeometryIndexKHR-04347 "
2161fd4e5da5Sopenharmony_ci                   "VUID-InstanceId-InstanceId-04256 "),
2162fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2163fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2164fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2165fd4e5da5Sopenharmony_ci
2166fd4e5da5Sopenharmony_ci// PrimitiveId needs special negative testing because it has non-RT uses
2167fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2168fd4e5da5Sopenharmony_ci    PrimitiveIdRTNotExecutionMode,
2169fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2170fd4e5da5Sopenharmony_ci    Combine(
2171fd4e5da5Sopenharmony_ci        Values(SPV_ENV_VULKAN_1_2), Values("PrimitiveId"),
2172fd4e5da5Sopenharmony_ci        Values("RayGenerationKHR", "MissKHR", "CallableKHR"), Values("Input"),
2173fd4e5da5Sopenharmony_ci        Values("%u32"), Values("OpCapability RayTracingKHR\n"),
2174fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2175fd4e5da5Sopenharmony_ci        Values("VUID-PrimitiveId-PrimitiveId-04330"),
2176fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
2177fd4e5da5Sopenharmony_ci                          "to be used only with Fragment, TessellationControl, "
2178fd4e5da5Sopenharmony_ci                          "TessellationEvaluation, Geometry, MeshNV, MeshEXT, "
2179fd4e5da5Sopenharmony_ci                          "IntersectionKHR, "
2180fd4e5da5Sopenharmony_ci                          "AnyHitKHR, and ClosestHitKHR execution models"))));
2181fd4e5da5Sopenharmony_ci
2182fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2183fd4e5da5Sopenharmony_ci    PrimitiveIdRTNotInput,
2184fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2185fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("PrimitiveId"),
2186fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2187fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
2188fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2189fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2190fd4e5da5Sopenharmony_ci            Values("VUID-PrimitiveId-PrimitiveId-04334"),
2191fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2192fd4e5da5Sopenharmony_ci                              "Output storage class if execution model is "))));
2193fd4e5da5Sopenharmony_ci
2194fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2195fd4e5da5Sopenharmony_ci    PrimitiveIdRTNotIntScalar,
2196fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2197fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("PrimitiveId"),
2198fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2199fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
2200fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2201fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2202fd4e5da5Sopenharmony_ci            Values("VUID-PrimitiveId-PrimitiveId-04337"),
2203fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2204fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2205fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2206fd4e5da5Sopenharmony_ci
2207fd4e5da5Sopenharmony_ci// ObjectRayDirectionKHR and ObjectRayOriginKHR valid
2208fd4e5da5Sopenharmony_ci// in IS, AH, CH shaders as input 32-bit float vec3
2209fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2210fd4e5da5Sopenharmony_ci    ObjectRayDirectionAndOriginSuccess,
2211fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2212fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2213fd4e5da5Sopenharmony_ci            Values("ObjectRayDirectionKHR", "ObjectRayOriginKHR"),
2214fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2215fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec3"),
2216fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2217fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2218fd4e5da5Sopenharmony_ci            Values(TestResult())));
2219fd4e5da5Sopenharmony_ci
2220fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2221fd4e5da5Sopenharmony_ci    ObjectRayDirectionAndOriginNotExecutionMode,
2222fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2223fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2224fd4e5da5Sopenharmony_ci            Values("ObjectRayDirectionKHR", "ObjectRayOriginKHR"),
2225fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2226fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2227fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "MissKHR", "CallableKHR"),
2228fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec3"),
2229fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2230fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2231fd4e5da5Sopenharmony_ci            Values("VUID-ObjectRayDirectionKHR-ObjectRayDirectionKHR-04299 "
2232fd4e5da5Sopenharmony_ci                   "VUID-ObjectRayOriginKHR-ObjectRayOriginKHR-04302 "),
2233fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2234fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2235fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2236fd4e5da5Sopenharmony_ci
2237fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2238fd4e5da5Sopenharmony_ci    ObjectRayDirectionAndOriginNotInput,
2239fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2240fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2241fd4e5da5Sopenharmony_ci            Values("ObjectRayDirectionKHR", "ObjectRayOriginKHR"),
2242fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2243fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32vec3"),
2244fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2245fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2246fd4e5da5Sopenharmony_ci            Values("VUID-ObjectRayDirectionKHR-ObjectRayDirectionKHR-04300 "
2247fd4e5da5Sopenharmony_ci                   "VUID-ObjectRayOriginKHR-ObjectRayOriginKHR-04303 "),
2248fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2249fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2250fd4e5da5Sopenharmony_ci
2251fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2252fd4e5da5Sopenharmony_ci    ObjectRayDirectionAndOriginNotFloatVec3,
2253fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2254fd4e5da5Sopenharmony_ci    Combine(
2255fd4e5da5Sopenharmony_ci        Values(SPV_ENV_VULKAN_1_2),
2256fd4e5da5Sopenharmony_ci        Values("ObjectRayDirectionKHR", "ObjectRayOriginKHR"),
2257fd4e5da5Sopenharmony_ci        Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2258fd4e5da5Sopenharmony_ci        Values("Input"), Values("%u32vec3", "%f32", "%f32vec2", "%f32vec4"),
2259fd4e5da5Sopenharmony_ci        Values("OpCapability RayTracingKHR\n"),
2260fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2261fd4e5da5Sopenharmony_ci        Values("VUID-ObjectRayDirectionKHR-ObjectRayDirectionKHR-04301 "
2262fd4e5da5Sopenharmony_ci               "VUID-ObjectRayOriginKHR-ObjectRayOriginKHR-04304 "),
2263fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
2264fd4e5da5Sopenharmony_ci                          "needs to be a 3-component 32-bit float vector"))));
2265fd4e5da5Sopenharmony_ci
2266fd4e5da5Sopenharmony_ci// ObjectToWorldKHR and WorldToObjectKHR valid
2267fd4e5da5Sopenharmony_ci// in IS, AH, CH shaders as input mat4x3
2268fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2269fd4e5da5Sopenharmony_ci    RTObjectMatrixSuccess,
2270fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2271fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2272fd4e5da5Sopenharmony_ci            Values("ObjectToWorldKHR", "WorldToObjectKHR"),
2273fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2274fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32mat34"),
2275fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2276fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2277fd4e5da5Sopenharmony_ci            Values(TestResult())));
2278fd4e5da5Sopenharmony_ci
2279fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2280fd4e5da5Sopenharmony_ci    RTObjectMatrixNotExecutionMode,
2281fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2282fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2283fd4e5da5Sopenharmony_ci            Values("ObjectToWorldKHR", "WorldToObjectKHR"),
2284fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2285fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2286fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "MissKHR", "CallableKHR"),
2287fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32mat34"),
2288fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2289fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2290fd4e5da5Sopenharmony_ci            Values("VUID-ObjectToWorldKHR-ObjectToWorldKHR-04305 "
2291fd4e5da5Sopenharmony_ci                   "VUID-WorldToObjectKHR-WorldToObjectKHR-04434 "),
2292fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2293fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2294fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2295fd4e5da5Sopenharmony_ci
2296fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2297fd4e5da5Sopenharmony_ci    RTObjectMatrixNotInput,
2298fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2299fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2300fd4e5da5Sopenharmony_ci            Values("ObjectToWorldKHR", "WorldToObjectKHR"),
2301fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2302fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32mat34"),
2303fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2304fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2305fd4e5da5Sopenharmony_ci            Values("VUID-ObjectToWorldKHR-ObjectToWorldKHR-04306 "
2306fd4e5da5Sopenharmony_ci                   "VUID-WorldToObjectKHR-WorldToObjectKHR-04435 "),
2307fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2308fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2309fd4e5da5Sopenharmony_ci
2310fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2311fd4e5da5Sopenharmony_ci    RTObjectMatrixNotMat4x3,
2312fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2313fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2314fd4e5da5Sopenharmony_ci            Values("ObjectToWorldKHR", "WorldToObjectKHR"),
2315fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR"),
2316fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32mat43", "%f32mat44", "%f32vec4"),
2317fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2318fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2319fd4e5da5Sopenharmony_ci            Values("VUID-ObjectToWorldKHR-ObjectToWorldKHR-04307 "
2320fd4e5da5Sopenharmony_ci                   "VUID-WorldToObjectKHR-WorldToObjectKHR-04436 "),
2321fd4e5da5Sopenharmony_ci            Values(TestResult(
2322fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
2323fd4e5da5Sopenharmony_ci                "variable needs to be a matrix with "
2324fd4e5da5Sopenharmony_ci                "4 columns of 3-component vectors of 32-bit floats"))));
2325fd4e5da5Sopenharmony_ci
2326fd4e5da5Sopenharmony_ci// IncomingRayFlagsKHR is valid
2327fd4e5da5Sopenharmony_ci// in IS, AH, CH, MS shaders as an input i32 scalar
2328fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2329fd4e5da5Sopenharmony_ci    IncomingRayFlagsSuccess,
2330fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2331fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("IncomingRayFlagsKHR"),
2332fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2333fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2334fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2335fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2336fd4e5da5Sopenharmony_ci            Values(TestResult())));
2337fd4e5da5Sopenharmony_ci
2338fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2339fd4e5da5Sopenharmony_ci    IncomingRayFlagsNotExecutionMode,
2340fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2341fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("IncomingRayFlagsKHR"),
2342fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2343fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2344fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "CallableKHR"),
2345fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2346fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2347fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2348fd4e5da5Sopenharmony_ci            Values("VUID-IncomingRayFlagsKHR-IncomingRayFlagsKHR-04248 "
2349fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04348 "
2350fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04351 "),
2351fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2352fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2353fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2354fd4e5da5Sopenharmony_ci
2355fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2356fd4e5da5Sopenharmony_ci    IncomingRayFlagsNotInput,
2357fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2358fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("IncomingRayFlagsKHR"),
2359fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2360fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
2361fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2362fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2363fd4e5da5Sopenharmony_ci            Values("VUID-IncomingRayFlagsKHR-IncomingRayFlagsKHR-04249 "
2364fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04349 "
2365fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04352 "),
2366fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2367fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2368fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2369fd4e5da5Sopenharmony_ci    IncomingRayFlagsNotIntScalar,
2370fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2371fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("IncomingRayFlagsKHR"),
2372fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2373fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
2374fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2375fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2376fd4e5da5Sopenharmony_ci            Values("VUID-IncomingRayFlagsKHR-IncomingRayFlagsKHR-04250 "
2377fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04350 "
2378fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04353 "),
2379fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2380fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2381fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2382fd4e5da5Sopenharmony_ci
2383fd4e5da5Sopenharmony_ci// CullMaskKHR is valid
2384fd4e5da5Sopenharmony_ci// in IS, AH, CH, MS shaders as an input i32 scalar
2385fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2386fd4e5da5Sopenharmony_ci    CullMaskSuccess,
2387fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2388fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("CullMaskKHR"),
2389fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2390fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2391fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\nOpCapability RayCullMaskKHR\n"),
2392fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\nOpExtension "
2393fd4e5da5Sopenharmony_ci                   "\"SPV_KHR_ray_cull_mask\"\n"),
2394fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
2395fd4e5da5Sopenharmony_ci
2396fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2397fd4e5da5Sopenharmony_ci    CullMaskNotExecutionMode,
2398fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2399fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("CullMaskKHR"),
2400fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2401fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2402fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "CallableKHR"),
2403fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2404fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\nOpCapability RayCullMaskKHR\n"),
2405fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\nOpExtension "
2406fd4e5da5Sopenharmony_ci                   "\"SPV_KHR_ray_cull_mask\"\n"),
2407fd4e5da5Sopenharmony_ci            Values("VUID-CullMaskKHR-CullMaskKHR-06735 "
2408fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04348 "
2409fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04351 "),
2410fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2411fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2412fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2413fd4e5da5Sopenharmony_ci
2414fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2415fd4e5da5Sopenharmony_ci    ICullMaskNotInput,
2416fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2417fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("CullMaskKHR"),
2418fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2419fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
2420fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\nOpCapability RayCullMaskKHR\n"),
2421fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\nOpExtension "
2422fd4e5da5Sopenharmony_ci                   "\"SPV_KHR_ray_cull_mask\"\n"),
2423fd4e5da5Sopenharmony_ci            Values("VUID-CullMaskKHR-CullMaskKHR-06736 "
2424fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04349 "
2425fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04352 "),
2426fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2427fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2428fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2429fd4e5da5Sopenharmony_ci    CullMaskNotIntScalar,
2430fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2431fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("CullMaskKHR"),
2432fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2433fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
2434fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\nOpCapability RayCullMaskKHR\n"),
2435fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\nOpExtension "
2436fd4e5da5Sopenharmony_ci                   "\"SPV_KHR_ray_cull_mask\"\n"),
2437fd4e5da5Sopenharmony_ci            Values("VUID-CullMaskKHR-CullMaskKHR-06737 "
2438fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04350 "
2439fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04353 "),
2440fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2441fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2442fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2443fd4e5da5Sopenharmony_ci
2444fd4e5da5Sopenharmony_ci// RayTmaxKHR, RayTminKHR are all valid
2445fd4e5da5Sopenharmony_ci// in IS, AH, CH, MS shaders as input f32 scalars
2446fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2447fd4e5da5Sopenharmony_ci    RayTSuccess,
2448fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2449fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("RayTmaxKHR", "RayTminKHR"),
2450fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2451fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32"),
2452fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2453fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2454fd4e5da5Sopenharmony_ci            Values(TestResult())));
2455fd4e5da5Sopenharmony_ci
2456fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2457fd4e5da5Sopenharmony_ci    RayTNotExecutionMode,
2458fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2459fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("RayTmaxKHR", "RayTminKHR"),
2460fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2461fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2462fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "CallableKHR"),
2463fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32"),
2464fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2465fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2466fd4e5da5Sopenharmony_ci            Values("VUID-IncomingRayFlagsKHR-IncomingRayFlagsKHR-04248 "
2467fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04348 "
2468fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04351 "),
2469fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2470fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2471fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2472fd4e5da5Sopenharmony_ci
2473fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2474fd4e5da5Sopenharmony_ci    RayTNotInput,
2475fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2476fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("RayTmaxKHR", "RayTminKHR"),
2477fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2478fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32"),
2479fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2480fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2481fd4e5da5Sopenharmony_ci            Values("VUID-IncomingRayFlagsKHR-IncomingRayFlagsKHR-04249 "
2482fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04349 "
2483fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04352 "),
2484fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2485fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2486fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2487fd4e5da5Sopenharmony_ci    RayTNotFloatScalar,
2488fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2489fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("RayTmaxKHR", "RayTminKHR"),
2490fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2491fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32", "%f32vec3"),
2492fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2493fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2494fd4e5da5Sopenharmony_ci            Values("VUID-IncomingRayFlagsKHR-IncomingRayFlagsKHR-04250 "
2495fd4e5da5Sopenharmony_ci                   "VUID-RayTmaxKHR-RayTmaxKHR-04350 "
2496fd4e5da5Sopenharmony_ci                   "VUID-RayTminKHR-RayTminKHR-04353 "),
2497fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2498fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
2499fd4e5da5Sopenharmony_ci                              "is not a float scalar"))));
2500fd4e5da5Sopenharmony_ci
2501fd4e5da5Sopenharmony_ci// WorldRayDirectionKHR and WorldRayOriginKHR are valid
2502fd4e5da5Sopenharmony_ci// in IS, AH, CH, MS shaders as input 32-bit float vec3
2503fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2504fd4e5da5Sopenharmony_ci    WorldRayDirectionAndOriginSuccess,
2505fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2506fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2507fd4e5da5Sopenharmony_ci            Values("WorldRayDirectionKHR", "WorldRayOriginKHR"),
2508fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2509fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec3"),
2510fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2511fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2512fd4e5da5Sopenharmony_ci            Values(TestResult())));
2513fd4e5da5Sopenharmony_ci
2514fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2515fd4e5da5Sopenharmony_ci    WorldRayDirectionAndOriginNotExecutionMode,
2516fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2517fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2518fd4e5da5Sopenharmony_ci            Values("WorldRayDirectionKHR", "WorldRayOriginKHR"),
2519fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2520fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2521fd4e5da5Sopenharmony_ci                   "GLCompute", "RayGenerationKHR", "CallableKHR"),
2522fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec3"),
2523fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2524fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2525fd4e5da5Sopenharmony_ci            Values("VUID-WorldRayDirectionKHR-WorldRayDirectionKHR-04428 "
2526fd4e5da5Sopenharmony_ci                   "VUID-WorldRayOriginKHR-WorldRayOriginKHR-04431 "),
2527fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2528fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2529fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2530fd4e5da5Sopenharmony_ci
2531fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2532fd4e5da5Sopenharmony_ci    WorldRayDirectionAndOriginNotInput,
2533fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2534fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2),
2535fd4e5da5Sopenharmony_ci            Values("WorldRayDirectionKHR", "WorldRayOriginKHR"),
2536fd4e5da5Sopenharmony_ci            Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2537fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32vec3"),
2538fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2539fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2540fd4e5da5Sopenharmony_ci            Values("VUID-WorldRayDirectionKHR-WorldRayDirectionKHR-04429 "
2541fd4e5da5Sopenharmony_ci                   "VUID-WorldRayOriginKHR-WorldRayOriginKHR-04432 "),
2542fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2543fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2544fd4e5da5Sopenharmony_ci
2545fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2546fd4e5da5Sopenharmony_ci    WorldRayDirectionAndOriginNotFloatVec3,
2547fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2548fd4e5da5Sopenharmony_ci    Combine(
2549fd4e5da5Sopenharmony_ci        Values(SPV_ENV_VULKAN_1_2),
2550fd4e5da5Sopenharmony_ci        Values("WorldRayDirectionKHR", "WorldRayOriginKHR"),
2551fd4e5da5Sopenharmony_ci        Values("AnyHitKHR", "ClosestHitKHR", "IntersectionKHR", "MissKHR"),
2552fd4e5da5Sopenharmony_ci        Values("Input"), Values("%u32vec3", "%f32", "%f32vec2", "%f32vec4"),
2553fd4e5da5Sopenharmony_ci        Values("OpCapability RayTracingKHR\n"),
2554fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2555fd4e5da5Sopenharmony_ci        Values("VUID-WorldRayDirectionKHR-WorldRayDirectionKHR-04430 "
2556fd4e5da5Sopenharmony_ci               "VUID-WorldRayOriginKHR-WorldRayOriginKHR-04433 "),
2557fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
2558fd4e5da5Sopenharmony_ci                          "needs to be a 3-component 32-bit float vector"))));
2559fd4e5da5Sopenharmony_ci
2560fd4e5da5Sopenharmony_ci// LaunchIdKHR and LaunchSizeKHR are valid
2561fd4e5da5Sopenharmony_ci// in RG, IS, AH, CH, MS shaders as input 32-bit ivec3
2562fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2563fd4e5da5Sopenharmony_ci    LaunchRTSuccess,
2564fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2565fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("LaunchIdKHR", "LaunchSizeKHR"),
2566fd4e5da5Sopenharmony_ci            Values("RayGenerationKHR", "AnyHitKHR", "ClosestHitKHR",
2567fd4e5da5Sopenharmony_ci                   "IntersectionKHR", "MissKHR", "CallableKHR"),
2568fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32vec3"),
2569fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2570fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"), Values(nullptr),
2571fd4e5da5Sopenharmony_ci            Values(TestResult())));
2572fd4e5da5Sopenharmony_ci
2573fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2574fd4e5da5Sopenharmony_ci    LaunchRTNotExecutionMode,
2575fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2576fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("LaunchIdKHR", "LaunchSizeKHR"),
2577fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2578fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "Fragment",
2579fd4e5da5Sopenharmony_ci                   "GLCompute"),
2580fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32vec3"),
2581fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2582fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2583fd4e5da5Sopenharmony_ci            Values("VUID-LaunchIdKHR-LaunchIdKHR-04266 "
2584fd4e5da5Sopenharmony_ci                   "VUID-LaunchSizeKHR-LaunchSizeKHR-04269 "),
2585fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2586fd4e5da5Sopenharmony_ci                              "Vulkan spec does not allow BuiltIn",
2587fd4e5da5Sopenharmony_ci                              "to be used with the execution model"))));
2588fd4e5da5Sopenharmony_ci
2589fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2590fd4e5da5Sopenharmony_ci    LaunchRTNotInput,
2591fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2592fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("LaunchIdKHR", "LaunchSizeKHR"),
2593fd4e5da5Sopenharmony_ci            Values("RayGenerationKHR", "AnyHitKHR", "ClosestHitKHR",
2594fd4e5da5Sopenharmony_ci                   "IntersectionKHR", "MissKHR", "CallableKHR"),
2595fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32vec3"),
2596fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2597fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2598fd4e5da5Sopenharmony_ci            Values("VUID-LaunchIdKHR-LaunchIdKHR-04267 "
2599fd4e5da5Sopenharmony_ci                   "VUID-LaunchSizeKHR-LaunchSizeKHR-04270 "),
2600fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows",
2601fd4e5da5Sopenharmony_ci                              "used for variables with Input storage class"))));
2602fd4e5da5Sopenharmony_ci
2603fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2604fd4e5da5Sopenharmony_ci    LaunchRTNotIntVec3,
2605fd4e5da5Sopenharmony_ci    ValidateGenericCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2606fd4e5da5Sopenharmony_ci    Combine(Values(SPV_ENV_VULKAN_1_2), Values("LaunchIdKHR", "LaunchSizeKHR"),
2607fd4e5da5Sopenharmony_ci            Values("RayGenerationKHR", "AnyHitKHR", "ClosestHitKHR",
2608fd4e5da5Sopenharmony_ci                   "IntersectionKHR", "MissKHR", "CallableKHR"),
2609fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec3", "%u32", "%u32vec2", "%u32vec4"),
2610fd4e5da5Sopenharmony_ci            Values("OpCapability RayTracingKHR\n"),
2611fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_ray_tracing\"\n"),
2612fd4e5da5Sopenharmony_ci            Values("VUID-LaunchIdKHR-LaunchIdKHR-04268 "
2613fd4e5da5Sopenharmony_ci                   "VUID-LaunchSizeKHR-LaunchSizeKHR-04271 "),
2614fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2615fd4e5da5Sopenharmony_ci                              "needs to be a 3-component 32-bit int vector"))));
2616fd4e5da5Sopenharmony_ci
2617fd4e5da5Sopenharmony_ciCodeGenerator GetArrayedVariableCodeGenerator(const char* const built_in,
2618fd4e5da5Sopenharmony_ci                                              const char* const execution_model,
2619fd4e5da5Sopenharmony_ci                                              const char* const storage_class,
2620fd4e5da5Sopenharmony_ci                                              const char* const data_type) {
2621fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
2622fd4e5da5Sopenharmony_ci
2623fd4e5da5Sopenharmony_ci  generator.before_types_ = "OpDecorate %built_in_var BuiltIn ";
2624fd4e5da5Sopenharmony_ci  generator.before_types_ += built_in;
2625fd4e5da5Sopenharmony_ci  generator.before_types_ += "\n";
2626fd4e5da5Sopenharmony_ci
2627fd4e5da5Sopenharmony_ci  std::ostringstream after_types;
2628fd4e5da5Sopenharmony_ci  after_types << "%built_in_array = OpTypeArray " << data_type << " %u32_3\n";
2629fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
2630fd4e5da5Sopenharmony_ci    after_types << "%built_in_array_null = OpConstantNull %built_in_array\n";
2631fd4e5da5Sopenharmony_ci  }
2632fd4e5da5Sopenharmony_ci
2633fd4e5da5Sopenharmony_ci  after_types << "%built_in_ptr = OpTypePointer " << storage_class
2634fd4e5da5Sopenharmony_ci              << " %built_in_array\n";
2635fd4e5da5Sopenharmony_ci  after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class;
2636fd4e5da5Sopenharmony_ci  if (InitializerRequired(storage_class)) {
2637fd4e5da5Sopenharmony_ci    after_types << " %built_in_array_null";
2638fd4e5da5Sopenharmony_ci  }
2639fd4e5da5Sopenharmony_ci  after_types << "\n";
2640fd4e5da5Sopenharmony_ci  generator.after_types_ = after_types.str();
2641fd4e5da5Sopenharmony_ci
2642fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
2643fd4e5da5Sopenharmony_ci  entry_point.name = "main";
2644fd4e5da5Sopenharmony_ci  entry_point.execution_model = execution_model;
2645fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%built_in_var";
2646fd4e5da5Sopenharmony_ci  // Any kind of reference would do.
2647fd4e5da5Sopenharmony_ci  entry_point.body = R"(
2648fd4e5da5Sopenharmony_ci%val = OpBitcast %u32 %built_in_var
2649fd4e5da5Sopenharmony_ci)";
2650fd4e5da5Sopenharmony_ci
2651fd4e5da5Sopenharmony_ci  std::ostringstream execution_modes;
2652fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Fragment")) {
2653fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
2654fd4e5da5Sopenharmony_ci                    << " OriginUpperLeft\n";
2655fd4e5da5Sopenharmony_ci    if (0 == std::strcmp(built_in, "FragDepth")) {
2656fd4e5da5Sopenharmony_ci      execution_modes << "OpExecutionMode %" << entry_point.name
2657fd4e5da5Sopenharmony_ci                      << " DepthReplacing\n";
2658fd4e5da5Sopenharmony_ci    }
2659fd4e5da5Sopenharmony_ci  }
2660fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Geometry")) {
2661fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
2662fd4e5da5Sopenharmony_ci                    << " InputPoints\n";
2663fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
2664fd4e5da5Sopenharmony_ci                    << " OutputPoints\n";
2665fd4e5da5Sopenharmony_ci  }
2666fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "GLCompute")) {
2667fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
2668fd4e5da5Sopenharmony_ci                    << " LocalSize 1 1 1\n";
2669fd4e5da5Sopenharmony_ci  }
2670fd4e5da5Sopenharmony_ci  entry_point.execution_modes = execution_modes.str();
2671fd4e5da5Sopenharmony_ci
2672fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
2673fd4e5da5Sopenharmony_ci
2674fd4e5da5Sopenharmony_ci  return generator;
2675fd4e5da5Sopenharmony_ci}
2676fd4e5da5Sopenharmony_ci
2677fd4e5da5Sopenharmony_ciTEST_P(ValidateVulkanCombineBuiltInArrayedVariable, Variable) {
2678fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
2679fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
2680fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
2681fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
2682fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<4>(GetParam());
2683fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<5>(GetParam());
2684fd4e5da5Sopenharmony_ci
2685fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetArrayedVariableCodeGenerator(
2686fd4e5da5Sopenharmony_ci      built_in, execution_model, storage_class, data_type);
2687fd4e5da5Sopenharmony_ci
2688fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
2689fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
2690fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_0));
2691fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
2692fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
2693fd4e5da5Sopenharmony_ci  }
2694fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
2695fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
2696fd4e5da5Sopenharmony_ci  }
2697fd4e5da5Sopenharmony_ci  if (vuid) {
2698fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
2699fd4e5da5Sopenharmony_ci  }
2700fd4e5da5Sopenharmony_ci}
2701fd4e5da5Sopenharmony_ci
2702fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2703fd4e5da5Sopenharmony_ci    PointSizeArrayedF32TessControl, ValidateVulkanCombineBuiltInArrayedVariable,
2704fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("TessellationControl"), Values("Input"),
2705fd4e5da5Sopenharmony_ci            Values("%f32"), Values(nullptr), Values(TestResult())));
2706fd4e5da5Sopenharmony_ci
2707fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2708fd4e5da5Sopenharmony_ci    PointSizeArrayedF64TessControl, ValidateVulkanCombineBuiltInArrayedVariable,
2709fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("TessellationControl"), Values("Input"),
2710fd4e5da5Sopenharmony_ci            Values("%f64"), Values("VUID-PointSize-PointSize-04317"),
2711fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2712fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
2713fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
2714fd4e5da5Sopenharmony_ci
2715fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2716fd4e5da5Sopenharmony_ci    PointSizeArrayedF32Vertex, ValidateVulkanCombineBuiltInArrayedVariable,
2717fd4e5da5Sopenharmony_ci    Combine(Values("PointSize"), Values("Vertex"), Values("Output"),
2718fd4e5da5Sopenharmony_ci            Values("%f32"), Values("VUID-PointSize-PointSize-04317"),
2719fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2720fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float scalar",
2721fd4e5da5Sopenharmony_ci                              "is not a float scalar"))));
2722fd4e5da5Sopenharmony_ci
2723fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(PositionArrayedF32Vec4TessControl,
2724fd4e5da5Sopenharmony_ci                         ValidateVulkanCombineBuiltInArrayedVariable,
2725fd4e5da5Sopenharmony_ci                         Combine(Values("Position"),
2726fd4e5da5Sopenharmony_ci                                 Values("TessellationControl"), Values("Input"),
2727fd4e5da5Sopenharmony_ci                                 Values("%f32vec4"), Values(nullptr),
2728fd4e5da5Sopenharmony_ci                                 Values(TestResult())));
2729fd4e5da5Sopenharmony_ci
2730fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2731fd4e5da5Sopenharmony_ci    PositionArrayedF32Vec3TessControl,
2732fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInArrayedVariable,
2733fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("TessellationControl"), Values("Input"),
2734fd4e5da5Sopenharmony_ci            Values("%f32vec3"), Values("VUID-Position-Position-04321"),
2735fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2736fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
2737fd4e5da5Sopenharmony_ci                              "has 3 components"))));
2738fd4e5da5Sopenharmony_ci
2739fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2740fd4e5da5Sopenharmony_ci    PositionArrayedF32Vec4Vertex, ValidateVulkanCombineBuiltInArrayedVariable,
2741fd4e5da5Sopenharmony_ci    Combine(Values("Position"), Values("Vertex"), Values("Output"),
2742fd4e5da5Sopenharmony_ci            Values("%f32vec4"), Values("VUID-Position-Position-04321"),
2743fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2744fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit float vector",
2745fd4e5da5Sopenharmony_ci                              "is not a float vector"))));
2746fd4e5da5Sopenharmony_ci
2747fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2748fd4e5da5Sopenharmony_ci    ClipAndCullDistanceOutputSuccess,
2749fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInArrayedVariable,
2750fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"),
2751fd4e5da5Sopenharmony_ci            Values("Geometry", "TessellationControl", "TessellationEvaluation"),
2752fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32arr2", "%f32arr4"), Values(nullptr),
2753fd4e5da5Sopenharmony_ci            Values(TestResult())));
2754fd4e5da5Sopenharmony_ci
2755fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2756fd4e5da5Sopenharmony_ci    ClipAndCullDistanceVertexInput, ValidateVulkanCombineBuiltInArrayedVariable,
2757fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"),
2758fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32arr4"),
2759fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04191 "
2760fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04200"),
2761fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2762fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float array",
2763fd4e5da5Sopenharmony_ci                              "components are not float scalar"))));
2764fd4e5da5Sopenharmony_ci
2765fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2766fd4e5da5Sopenharmony_ci    ClipAndCullDistanceNotArray, ValidateVulkanCombineBuiltInArrayedVariable,
2767fd4e5da5Sopenharmony_ci    Combine(Values("ClipDistance", "CullDistance"),
2768fd4e5da5Sopenharmony_ci            Values("Geometry", "TessellationControl", "TessellationEvaluation"),
2769fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32vec2", "%f32vec4"),
2770fd4e5da5Sopenharmony_ci            Values("VUID-ClipDistance-ClipDistance-04191 "
2771fd4e5da5Sopenharmony_ci                   "VUID-CullDistance-CullDistance-04200"),
2772fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2773fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit float array",
2774fd4e5da5Sopenharmony_ci                              "components are not float scalar"))));
2775fd4e5da5Sopenharmony_ci
2776fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2777fd4e5da5Sopenharmony_ci    SMBuiltinsInputSuccess,
2778fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2779fd4e5da5Sopenharmony_ci    Combine(Values("SMCountNV", "SMIDNV", "WarpsPerSMNV", "WarpIDNV"),
2780fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2781fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2782fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2783fd4e5da5Sopenharmony_ci            Values("OpCapability ShaderSMBuiltinsNV\n"),
2784fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_shader_sm_builtins\"\n"),
2785fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
2786fd4e5da5Sopenharmony_ci
2787fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2788fd4e5da5Sopenharmony_ci    SMBuiltinsInputMeshSuccess,
2789fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2790fd4e5da5Sopenharmony_ci    Combine(
2791fd4e5da5Sopenharmony_ci        Values("SMCountNV", "SMIDNV", "WarpsPerSMNV", "WarpIDNV"),
2792fd4e5da5Sopenharmony_ci        Values("MeshNV", "TaskNV"), Values("Input"), Values("%u32"),
2793fd4e5da5Sopenharmony_ci        Values("OpCapability ShaderSMBuiltinsNV\nOpCapability MeshShadingNV\n"),
2794fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_NV_shader_sm_builtins\"\nOpExtension "
2795fd4e5da5Sopenharmony_ci               "\"SPV_NV_mesh_shader\"\n"),
2796fd4e5da5Sopenharmony_ci        Values(nullptr), Values(TestResult())));
2797fd4e5da5Sopenharmony_ci
2798fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2799fd4e5da5Sopenharmony_ci    SMBuiltinsInputRaySuccess,
2800fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2801fd4e5da5Sopenharmony_ci    Combine(
2802fd4e5da5Sopenharmony_ci        Values("SMCountNV", "SMIDNV", "WarpsPerSMNV", "WarpIDNV"),
2803fd4e5da5Sopenharmony_ci        Values("RayGenerationNV", "IntersectionNV", "AnyHitNV", "ClosestHitNV",
2804fd4e5da5Sopenharmony_ci               "MissNV", "CallableNV"),
2805fd4e5da5Sopenharmony_ci        Values("Input"), Values("%u32"),
2806fd4e5da5Sopenharmony_ci        Values("OpCapability ShaderSMBuiltinsNV\nOpCapability RayTracingNV\n"),
2807fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_NV_shader_sm_builtins\"\nOpExtension "
2808fd4e5da5Sopenharmony_ci               "\"SPV_NV_ray_tracing\"\n"),
2809fd4e5da5Sopenharmony_ci        Values(nullptr), Values(TestResult())));
2810fd4e5da5Sopenharmony_ci
2811fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2812fd4e5da5Sopenharmony_ci    SMBuiltinsNotInput,
2813fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2814fd4e5da5Sopenharmony_ci    Combine(Values("SMCountNV", "SMIDNV", "WarpsPerSMNV", "WarpIDNV"),
2815fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2816fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2817fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
2818fd4e5da5Sopenharmony_ci            Values("OpCapability ShaderSMBuiltinsNV\n"),
2819fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_shader_sm_builtins\"\n"),
2820fd4e5da5Sopenharmony_ci            Values(nullptr),
2821fd4e5da5Sopenharmony_ci            Values(TestResult(
2822fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
2823fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
2824fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
2825fd4e5da5Sopenharmony_ci
2826fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2827fd4e5da5Sopenharmony_ci    SMBuiltinsNotIntScalar,
2828fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2829fd4e5da5Sopenharmony_ci    Combine(Values("SMCountNV", "SMIDNV", "WarpsPerSMNV", "WarpIDNV"),
2830fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2831fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2832fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
2833fd4e5da5Sopenharmony_ci            Values("OpCapability ShaderSMBuiltinsNV\n"),
2834fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_shader_sm_builtins\"\n"),
2835fd4e5da5Sopenharmony_ci            Values(nullptr),
2836fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2837fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2838fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2839fd4e5da5Sopenharmony_ci
2840fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2841fd4e5da5Sopenharmony_ci    SMBuiltinsNotInt32,
2842fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2843fd4e5da5Sopenharmony_ci    Combine(Values("SMCountNV", "SMIDNV", "WarpsPerSMNV", "WarpIDNV"),
2844fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2845fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2846fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u64"),
2847fd4e5da5Sopenharmony_ci            Values("OpCapability ShaderSMBuiltinsNV\n"),
2848fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_NV_shader_sm_builtins\"\n"),
2849fd4e5da5Sopenharmony_ci            Values(nullptr),
2850fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2851fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2852fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
2853fd4e5da5Sopenharmony_ci
2854fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2855fd4e5da5Sopenharmony_ci    ArmCoreBuiltinsInputSuccess,
2856fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2857fd4e5da5Sopenharmony_ci    Combine(Values("CoreIDARM", "CoreCountARM", "CoreMaxIDARM", "WarpIDARM",
2858fd4e5da5Sopenharmony_ci                   "WarpMaxIDARM"),
2859fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2860fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2861fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
2862fd4e5da5Sopenharmony_ci            Values("OpCapability CoreBuiltinsARM\n"),
2863fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_ARM_core_builtins\"\n"), Values(nullptr),
2864fd4e5da5Sopenharmony_ci            Values(TestResult())));
2865fd4e5da5Sopenharmony_ci
2866fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2867fd4e5da5Sopenharmony_ci    ArmCoreBuiltinsNotInput,
2868fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2869fd4e5da5Sopenharmony_ci    Combine(Values("CoreIDARM", "CoreCountARM", "CoreMaxIDARM", "WarpIDARM",
2870fd4e5da5Sopenharmony_ci                   "WarpMaxIDARM"),
2871fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2872fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2873fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
2874fd4e5da5Sopenharmony_ci            Values("OpCapability CoreBuiltinsARM\n"),
2875fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_ARM_core_builtins\"\n"), Values(nullptr),
2876fd4e5da5Sopenharmony_ci            Values(TestResult(
2877fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
2878fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class",
2879fd4e5da5Sopenharmony_ci                "uses storage class Output"))));
2880fd4e5da5Sopenharmony_ci
2881fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2882fd4e5da5Sopenharmony_ci    ArmCoreBuiltinsNotIntScalar,
2883fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2884fd4e5da5Sopenharmony_ci    Combine(Values("CoreIDARM", "CoreCountARM", "CoreMaxIDARM", "WarpIDARM",
2885fd4e5da5Sopenharmony_ci                   "WarpMaxIDARM"),
2886fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2887fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2888fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32", "%u32vec3"),
2889fd4e5da5Sopenharmony_ci            Values("OpCapability CoreBuiltinsARM\n"),
2890fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_ARM_core_builtins\"\n"), Values(nullptr),
2891fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2892fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2893fd4e5da5Sopenharmony_ci                              "is not an int scalar"))));
2894fd4e5da5Sopenharmony_ci
2895fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
2896fd4e5da5Sopenharmony_ci    ArmCoreBuiltinsNotInt32,
2897fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
2898fd4e5da5Sopenharmony_ci    Combine(Values("CoreIDARM", "CoreCountARM", "CoreMaxIDARM", "WarpIDARM",
2899fd4e5da5Sopenharmony_ci                   "WarpMaxIDARM"),
2900fd4e5da5Sopenharmony_ci            Values("Vertex", "Fragment", "TessellationControl",
2901fd4e5da5Sopenharmony_ci                   "TessellationEvaluation", "Geometry", "GLCompute"),
2902fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u64"),
2903fd4e5da5Sopenharmony_ci            Values("OpCapability CoreBuiltinsARM\n"),
2904fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_ARM_core_builtins\"\n"), Values(nullptr),
2905fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
2906fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int scalar",
2907fd4e5da5Sopenharmony_ci                              "has bit width 64"))));
2908fd4e5da5Sopenharmony_ci
2909fd4e5da5Sopenharmony_ciCodeGenerator GetWorkgroupSizeSuccessGenerator() {
2910fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
2911fd4e5da5Sopenharmony_ci
2912fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
2913fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
2914fd4e5da5Sopenharmony_ci)";
2915fd4e5da5Sopenharmony_ci
2916fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
2917fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1
2918fd4e5da5Sopenharmony_ci)";
2919fd4e5da5Sopenharmony_ci
2920fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
2921fd4e5da5Sopenharmony_ci  entry_point.name = "main";
2922fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
2923fd4e5da5Sopenharmony_ci  entry_point.body = R"(
2924fd4e5da5Sopenharmony_ci%copy = OpCopyObject %u32vec3 %workgroup_size
2925fd4e5da5Sopenharmony_ci)";
2926fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
2927fd4e5da5Sopenharmony_ci
2928fd4e5da5Sopenharmony_ci  return generator;
2929fd4e5da5Sopenharmony_ci}
2930fd4e5da5Sopenharmony_ci
2931fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VulkanWorkgroupSizeSuccess) {
2932fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetWorkgroupSizeSuccessGenerator();
2933fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
2934fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
2935fd4e5da5Sopenharmony_ci}
2936fd4e5da5Sopenharmony_ci
2937fd4e5da5Sopenharmony_ciCodeGenerator GetWorkgroupSizeFragmentGenerator() {
2938fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
2939fd4e5da5Sopenharmony_ci
2940fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
2941fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
2942fd4e5da5Sopenharmony_ci)";
2943fd4e5da5Sopenharmony_ci
2944fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
2945fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1
2946fd4e5da5Sopenharmony_ci)";
2947fd4e5da5Sopenharmony_ci
2948fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
2949fd4e5da5Sopenharmony_ci  entry_point.name = "main";
2950fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Fragment";
2951fd4e5da5Sopenharmony_ci  entry_point.execution_modes = "OpExecutionMode %main OriginUpperLeft";
2952fd4e5da5Sopenharmony_ci  entry_point.body = R"(
2953fd4e5da5Sopenharmony_ci%copy = OpCopyObject %u32vec3 %workgroup_size
2954fd4e5da5Sopenharmony_ci)";
2955fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
2956fd4e5da5Sopenharmony_ci
2957fd4e5da5Sopenharmony_ci  return generator;
2958fd4e5da5Sopenharmony_ci}
2959fd4e5da5Sopenharmony_ci
2960fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VulkanWorkgroupSizeFragment) {
2961fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetWorkgroupSizeFragmentGenerator();
2962fd4e5da5Sopenharmony_ci
2963fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
2964fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
2965fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
2966fd4e5da5Sopenharmony_ci              HasSubstr("Vulkan spec allows BuiltIn WorkgroupSize to be used "
2967fd4e5da5Sopenharmony_ci                        "only with GLCompute, MeshNV, TaskNV, MeshEXT or "
2968fd4e5da5Sopenharmony_ci                        "TaskEXT execution model"));
2969fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
2970fd4e5da5Sopenharmony_ci              HasSubstr("is referencing ID <2> (OpConstantComposite) which is "
2971fd4e5da5Sopenharmony_ci                        "decorated with BuiltIn WorkgroupSize in function <1> "
2972fd4e5da5Sopenharmony_ci                        "called with execution model Fragment"));
2973fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
2974fd4e5da5Sopenharmony_ci              AnyVUID("VUID-WorkgroupSize-WorkgroupSize-04425 "
2975fd4e5da5Sopenharmony_ci                      "VUID-WorkgroupSize-WorkgroupSize-04427"));
2976fd4e5da5Sopenharmony_ci}
2977fd4e5da5Sopenharmony_ci
2978fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, WorkgroupSizeNotConstant) {
2979fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
2980fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
2981fd4e5da5Sopenharmony_ciOpDecorate %copy BuiltIn WorkgroupSize
2982fd4e5da5Sopenharmony_ci)";
2983fd4e5da5Sopenharmony_ci
2984fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
2985fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1
2986fd4e5da5Sopenharmony_ci)";
2987fd4e5da5Sopenharmony_ci
2988fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
2989fd4e5da5Sopenharmony_ci  entry_point.name = "main";
2990fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
2991fd4e5da5Sopenharmony_ci  entry_point.body = R"(
2992fd4e5da5Sopenharmony_ci%copy = OpCopyObject %u32vec3 %workgroup_size
2993fd4e5da5Sopenharmony_ci)";
2994fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
2995fd4e5da5Sopenharmony_ci
2996fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
2997fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
2998fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
2999fd4e5da5Sopenharmony_ci              HasSubstr("BuiltIns can only target variables, structure "
3000fd4e5da5Sopenharmony_ci                        "members or constants"));
3001fd4e5da5Sopenharmony_ci}
3002fd4e5da5Sopenharmony_ci
3003fd4e5da5Sopenharmony_ciCodeGenerator GetWorkgroupSizeNotVectorGenerator() {
3004fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3005fd4e5da5Sopenharmony_ci
3006fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3007fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
3008fd4e5da5Sopenharmony_ci)";
3009fd4e5da5Sopenharmony_ci
3010fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3011fd4e5da5Sopenharmony_ci%workgroup_size = OpConstant %u32 16
3012fd4e5da5Sopenharmony_ci)";
3013fd4e5da5Sopenharmony_ci
3014fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3015fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3016fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
3017fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3018fd4e5da5Sopenharmony_ci%copy = OpCopyObject %u32 %workgroup_size
3019fd4e5da5Sopenharmony_ci)";
3020fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3021fd4e5da5Sopenharmony_ci
3022fd4e5da5Sopenharmony_ci  return generator;
3023fd4e5da5Sopenharmony_ci}
3024fd4e5da5Sopenharmony_ci
3025fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VulkanWorkgroupSizeNotVector) {
3026fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetWorkgroupSizeNotVectorGenerator();
3027fd4e5da5Sopenharmony_ci
3028fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3029fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3030fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3031fd4e5da5Sopenharmony_ci              HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize "
3032fd4e5da5Sopenharmony_ci                        "variable needs to be a 3-component 32-bit int vector. "
3033fd4e5da5Sopenharmony_ci                        "ID <2> (OpConstant) is not an int vector."));
3034fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3035fd4e5da5Sopenharmony_ci              AnyVUID("VUID-WorkgroupSize-WorkgroupSize-04427"));
3036fd4e5da5Sopenharmony_ci}
3037fd4e5da5Sopenharmony_ci
3038fd4e5da5Sopenharmony_ciCodeGenerator GetWorkgroupSizeNotIntVectorGenerator() {
3039fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3040fd4e5da5Sopenharmony_ci
3041fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3042fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
3043fd4e5da5Sopenharmony_ci)";
3044fd4e5da5Sopenharmony_ci
3045fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3046fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %f32vec3 %f32_1 %f32_1 %f32_1
3047fd4e5da5Sopenharmony_ci)";
3048fd4e5da5Sopenharmony_ci
3049fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3050fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3051fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
3052fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3053fd4e5da5Sopenharmony_ci%copy = OpCopyObject %f32vec3 %workgroup_size
3054fd4e5da5Sopenharmony_ci)";
3055fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3056fd4e5da5Sopenharmony_ci
3057fd4e5da5Sopenharmony_ci  return generator;
3058fd4e5da5Sopenharmony_ci}
3059fd4e5da5Sopenharmony_ci
3060fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VulkanWorkgroupSizeNotIntVector) {
3061fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetWorkgroupSizeNotIntVectorGenerator();
3062fd4e5da5Sopenharmony_ci
3063fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3064fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3065fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3066fd4e5da5Sopenharmony_ci              HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize "
3067fd4e5da5Sopenharmony_ci                        "variable needs to be a 3-component 32-bit int vector. "
3068fd4e5da5Sopenharmony_ci                        "ID <2> (OpConstantComposite) is not an int vector."));
3069fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3070fd4e5da5Sopenharmony_ci              AnyVUID("VUID-WorkgroupSize-WorkgroupSize-04427"));
3071fd4e5da5Sopenharmony_ci}
3072fd4e5da5Sopenharmony_ci
3073fd4e5da5Sopenharmony_ciCodeGenerator GetWorkgroupSizeNotVec3Generator() {
3074fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3075fd4e5da5Sopenharmony_ci
3076fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3077fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
3078fd4e5da5Sopenharmony_ci)";
3079fd4e5da5Sopenharmony_ci
3080fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3081fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u32vec2 %u32_1 %u32_1
3082fd4e5da5Sopenharmony_ci)";
3083fd4e5da5Sopenharmony_ci
3084fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3085fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3086fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
3087fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3088fd4e5da5Sopenharmony_ci%copy = OpCopyObject %u32vec2 %workgroup_size
3089fd4e5da5Sopenharmony_ci)";
3090fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3091fd4e5da5Sopenharmony_ci
3092fd4e5da5Sopenharmony_ci  return generator;
3093fd4e5da5Sopenharmony_ci}
3094fd4e5da5Sopenharmony_ci
3095fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VulkanWorkgroupSizeNotVec3) {
3096fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetWorkgroupSizeNotVec3Generator();
3097fd4e5da5Sopenharmony_ci
3098fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3099fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3100fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3101fd4e5da5Sopenharmony_ci              HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize "
3102fd4e5da5Sopenharmony_ci                        "variable needs to be a 3-component 32-bit int vector. "
3103fd4e5da5Sopenharmony_ci                        "ID <2> (OpConstantComposite) has 2 components."));
3104fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3105fd4e5da5Sopenharmony_ci              AnyVUID("VUID-WorkgroupSize-WorkgroupSize-04427"));
3106fd4e5da5Sopenharmony_ci}
3107fd4e5da5Sopenharmony_ci
3108fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, WorkgroupSizeNotInt32Vec) {
3109fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3110fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3111fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
3112fd4e5da5Sopenharmony_ci)";
3113fd4e5da5Sopenharmony_ci
3114fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3115fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u64vec3 %u64_1 %u64_1 %u64_1
3116fd4e5da5Sopenharmony_ci)";
3117fd4e5da5Sopenharmony_ci
3118fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3119fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3120fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
3121fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3122fd4e5da5Sopenharmony_ci%copy = OpCopyObject %u64vec3 %workgroup_size
3123fd4e5da5Sopenharmony_ci)";
3124fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3125fd4e5da5Sopenharmony_ci
3126fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3127fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3128fd4e5da5Sopenharmony_ci  EXPECT_THAT(
3129fd4e5da5Sopenharmony_ci      getDiagnosticString(),
3130fd4e5da5Sopenharmony_ci      HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize variable "
3131fd4e5da5Sopenharmony_ci                "needs to be a 3-component 32-bit int vector. ID <2> "
3132fd4e5da5Sopenharmony_ci                "(OpConstantComposite) has components with bit width 64."));
3133fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3134fd4e5da5Sopenharmony_ci              AnyVUID("VUID-WorkgroupSize-WorkgroupSize-04427"));
3135fd4e5da5Sopenharmony_ci}
3136fd4e5da5Sopenharmony_ci
3137fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, WorkgroupSizePrivateVar) {
3138fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3139fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3140fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
3141fd4e5da5Sopenharmony_ci)";
3142fd4e5da5Sopenharmony_ci
3143fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3144fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1
3145fd4e5da5Sopenharmony_ci%private_ptr_u32vec3 = OpTypePointer Private %u32vec3
3146fd4e5da5Sopenharmony_ci%var = OpVariable %private_ptr_u32vec3 Private %workgroup_size
3147fd4e5da5Sopenharmony_ci)";
3148fd4e5da5Sopenharmony_ci
3149fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3150fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3151fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
3152fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3153fd4e5da5Sopenharmony_ci)";
3154fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3155fd4e5da5Sopenharmony_ci
3156fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3157fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3158fd4e5da5Sopenharmony_ci}
3159fd4e5da5Sopenharmony_ci
3160fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, GeometryPositionInOutSuccess) {
3161fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3162fd4e5da5Sopenharmony_ci
3163fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3164fd4e5da5Sopenharmony_ciOpDecorate %input_type Block
3165fd4e5da5Sopenharmony_ciOpMemberDecorate %input_type 0 BuiltIn Position
3166fd4e5da5Sopenharmony_ciOpDecorate %output_type Block
3167fd4e5da5Sopenharmony_ciOpMemberDecorate %output_type 0 BuiltIn Position
3168fd4e5da5Sopenharmony_ci)";
3169fd4e5da5Sopenharmony_ci
3170fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3171fd4e5da5Sopenharmony_ci%input_type = OpTypeStruct %f32vec4
3172fd4e5da5Sopenharmony_ci%arrayed_input_type = OpTypeArray %input_type %u32_3
3173fd4e5da5Sopenharmony_ci%input_ptr = OpTypePointer Input %arrayed_input_type
3174fd4e5da5Sopenharmony_ci%input = OpVariable %input_ptr Input
3175fd4e5da5Sopenharmony_ci%input_f32vec4_ptr = OpTypePointer Input %f32vec4
3176fd4e5da5Sopenharmony_ci%output_type = OpTypeStruct %f32vec4
3177fd4e5da5Sopenharmony_ci%output_ptr = OpTypePointer Output %output_type
3178fd4e5da5Sopenharmony_ci%output = OpVariable %output_ptr Output
3179fd4e5da5Sopenharmony_ci%output_f32vec4_ptr = OpTypePointer Output %f32vec4
3180fd4e5da5Sopenharmony_ci)";
3181fd4e5da5Sopenharmony_ci
3182fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3183fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3184fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Geometry";
3185fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%input %output";
3186fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3187fd4e5da5Sopenharmony_ci%input_pos = OpAccessChain %input_f32vec4_ptr %input %u32_0 %u32_0
3188fd4e5da5Sopenharmony_ci%output_pos = OpAccessChain %output_f32vec4_ptr %output %u32_0
3189fd4e5da5Sopenharmony_ci%pos = OpLoad %f32vec4 %input_pos
3190fd4e5da5Sopenharmony_ciOpStore %output_pos %pos
3191fd4e5da5Sopenharmony_ci)";
3192fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3193fd4e5da5Sopenharmony_ci  generator.entry_points_[0].execution_modes =
3194fd4e5da5Sopenharmony_ci      "OpExecutionMode %main InputPoints\nOpExecutionMode %main OutputPoints\n";
3195fd4e5da5Sopenharmony_ci
3196fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3197fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3198fd4e5da5Sopenharmony_ci}
3199fd4e5da5Sopenharmony_ci
3200fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, WorkgroupIdNotVec3) {
3201fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3202fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3203fd4e5da5Sopenharmony_ciOpDecorate %workgroup_size BuiltIn WorkgroupSize
3204fd4e5da5Sopenharmony_ciOpDecorate %workgroup_id BuiltIn WorkgroupId
3205fd4e5da5Sopenharmony_ci)";
3206fd4e5da5Sopenharmony_ci
3207fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3208fd4e5da5Sopenharmony_ci%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1
3209fd4e5da5Sopenharmony_ci     %input_ptr = OpTypePointer Input %u32vec2
3210fd4e5da5Sopenharmony_ci  %workgroup_id = OpVariable %input_ptr Input
3211fd4e5da5Sopenharmony_ci)";
3212fd4e5da5Sopenharmony_ci
3213fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3214fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3215fd4e5da5Sopenharmony_ci  entry_point.execution_model = "GLCompute";
3216fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%workgroup_id";
3217fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3218fd4e5da5Sopenharmony_ci%copy_size = OpCopyObject %u32vec3 %workgroup_size
3219fd4e5da5Sopenharmony_ci  %load_id = OpLoad %u32vec2 %workgroup_id
3220fd4e5da5Sopenharmony_ci)";
3221fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3222fd4e5da5Sopenharmony_ci
3223fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3224fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3225fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3226fd4e5da5Sopenharmony_ci              HasSubstr("According to the Vulkan spec BuiltIn WorkgroupId "
3227fd4e5da5Sopenharmony_ci                        "variable needs to be a 3-component 32-bit int vector. "
3228fd4e5da5Sopenharmony_ci                        "ID <2> (OpVariable) has 2 components."));
3229fd4e5da5Sopenharmony_ci}
3230fd4e5da5Sopenharmony_ci
3231fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, TwoBuiltInsFirstFails) {
3232fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3233fd4e5da5Sopenharmony_ci
3234fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3235fd4e5da5Sopenharmony_ciOpDecorate %input_type Block
3236fd4e5da5Sopenharmony_ciOpDecorate %output_type Block
3237fd4e5da5Sopenharmony_ciOpMemberDecorate %input_type 0 BuiltIn FragCoord
3238fd4e5da5Sopenharmony_ciOpMemberDecorate %output_type 0 BuiltIn Position
3239fd4e5da5Sopenharmony_ci)";
3240fd4e5da5Sopenharmony_ci
3241fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3242fd4e5da5Sopenharmony_ci%input_type = OpTypeStruct %f32vec4
3243fd4e5da5Sopenharmony_ci%input_ptr = OpTypePointer Input %input_type
3244fd4e5da5Sopenharmony_ci%input = OpVariable %input_ptr Input
3245fd4e5da5Sopenharmony_ci%input_f32vec4_ptr = OpTypePointer Input %f32vec4
3246fd4e5da5Sopenharmony_ci%output_type = OpTypeStruct %f32vec4
3247fd4e5da5Sopenharmony_ci%output_ptr = OpTypePointer Output %output_type
3248fd4e5da5Sopenharmony_ci%output = OpVariable %output_ptr Output
3249fd4e5da5Sopenharmony_ci%output_f32vec4_ptr = OpTypePointer Output %f32vec4
3250fd4e5da5Sopenharmony_ci)";
3251fd4e5da5Sopenharmony_ci
3252fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3253fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3254fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Geometry";
3255fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%input %output";
3256fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3257fd4e5da5Sopenharmony_ci%input_pos = OpAccessChain %input_f32vec4_ptr %input %u32_0
3258fd4e5da5Sopenharmony_ci%output_pos = OpAccessChain %output_f32vec4_ptr %output %u32_0
3259fd4e5da5Sopenharmony_ci%pos = OpLoad %f32vec4 %input_pos
3260fd4e5da5Sopenharmony_ciOpStore %output_pos %pos
3261fd4e5da5Sopenharmony_ci)";
3262fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3263fd4e5da5Sopenharmony_ci  generator.entry_points_[0].execution_modes =
3264fd4e5da5Sopenharmony_ci      "OpExecutionMode %main InputPoints\nOpExecutionMode %main OutputPoints\n";
3265fd4e5da5Sopenharmony_ci
3266fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3267fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3268fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3269fd4e5da5Sopenharmony_ci              HasSubstr("Vulkan spec allows BuiltIn FragCoord to be used only "
3270fd4e5da5Sopenharmony_ci                        "with Fragment execution model"));
3271fd4e5da5Sopenharmony_ci}
3272fd4e5da5Sopenharmony_ci
3273fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, TwoBuiltInsSecondFails) {
3274fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3275fd4e5da5Sopenharmony_ci
3276fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3277fd4e5da5Sopenharmony_ciOpDecorate %input_type Block
3278fd4e5da5Sopenharmony_ciOpDecorate %output_type Block
3279fd4e5da5Sopenharmony_ciOpMemberDecorate %input_type 0 BuiltIn Position
3280fd4e5da5Sopenharmony_ciOpMemberDecorate %output_type 0 BuiltIn FragCoord
3281fd4e5da5Sopenharmony_ci)";
3282fd4e5da5Sopenharmony_ci
3283fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3284fd4e5da5Sopenharmony_ci%input_type = OpTypeStruct %f32vec4
3285fd4e5da5Sopenharmony_ci%input_ptr = OpTypePointer Input %input_type
3286fd4e5da5Sopenharmony_ci%input = OpVariable %input_ptr Input
3287fd4e5da5Sopenharmony_ci%input_f32vec4_ptr = OpTypePointer Input %f32vec4
3288fd4e5da5Sopenharmony_ci%output_type = OpTypeStruct %f32vec4
3289fd4e5da5Sopenharmony_ci%output_ptr = OpTypePointer Output %output_type
3290fd4e5da5Sopenharmony_ci%output = OpVariable %output_ptr Output
3291fd4e5da5Sopenharmony_ci%output_f32vec4_ptr = OpTypePointer Output %f32vec4
3292fd4e5da5Sopenharmony_ci)";
3293fd4e5da5Sopenharmony_ci
3294fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3295fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3296fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Geometry";
3297fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%input %output";
3298fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3299fd4e5da5Sopenharmony_ci%input_pos = OpAccessChain %input_f32vec4_ptr %input %u32_0
3300fd4e5da5Sopenharmony_ci%output_pos = OpAccessChain %output_f32vec4_ptr %output %u32_0
3301fd4e5da5Sopenharmony_ci%pos = OpLoad %f32vec4 %input_pos
3302fd4e5da5Sopenharmony_ciOpStore %output_pos %pos
3303fd4e5da5Sopenharmony_ci)";
3304fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3305fd4e5da5Sopenharmony_ci  generator.entry_points_[0].execution_modes =
3306fd4e5da5Sopenharmony_ci      "OpExecutionMode %main InputPoints\nOpExecutionMode %main OutputPoints\n";
3307fd4e5da5Sopenharmony_ci
3308fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3309fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3310fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3311fd4e5da5Sopenharmony_ci              HasSubstr("Vulkan spec allows BuiltIn FragCoord to be only used "
3312fd4e5da5Sopenharmony_ci                        "for variables with Input storage class"));
3313fd4e5da5Sopenharmony_ci}
3314fd4e5da5Sopenharmony_ci
3315fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VertexPositionVariableSuccess) {
3316fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3317fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3318fd4e5da5Sopenharmony_ciOpDecorate %position BuiltIn Position
3319fd4e5da5Sopenharmony_ci)";
3320fd4e5da5Sopenharmony_ci
3321fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3322fd4e5da5Sopenharmony_ci%f32vec4_ptr_output = OpTypePointer Output %f32vec4
3323fd4e5da5Sopenharmony_ci%position = OpVariable %f32vec4_ptr_output Output
3324fd4e5da5Sopenharmony_ci)";
3325fd4e5da5Sopenharmony_ci
3326fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3327fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3328fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Vertex";
3329fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%position";
3330fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3331fd4e5da5Sopenharmony_ciOpStore %position %f32vec4_0123
3332fd4e5da5Sopenharmony_ci)";
3333fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3334fd4e5da5Sopenharmony_ci
3335fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3336fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3337fd4e5da5Sopenharmony_ci}
3338fd4e5da5Sopenharmony_ci
3339fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, FragmentPositionTwoEntryPoints) {
3340fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3341fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3342fd4e5da5Sopenharmony_ciOpDecorate %output_type Block
3343fd4e5da5Sopenharmony_ciOpMemberDecorate %output_type 0 BuiltIn Position
3344fd4e5da5Sopenharmony_ci)";
3345fd4e5da5Sopenharmony_ci
3346fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3347fd4e5da5Sopenharmony_ci%output_type = OpTypeStruct %f32vec4
3348fd4e5da5Sopenharmony_ci%output_ptr = OpTypePointer Output %output_type
3349fd4e5da5Sopenharmony_ci%output = OpVariable %output_ptr Output
3350fd4e5da5Sopenharmony_ci%output_f32vec4_ptr = OpTypePointer Output %f32vec4
3351fd4e5da5Sopenharmony_ci)";
3352fd4e5da5Sopenharmony_ci
3353fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3354fd4e5da5Sopenharmony_ci  entry_point.name = "vmain";
3355fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Vertex";
3356fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%output";
3357fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3358fd4e5da5Sopenharmony_ci%val1 = OpFunctionCall %void %foo
3359fd4e5da5Sopenharmony_ci)";
3360fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3361fd4e5da5Sopenharmony_ci
3362fd4e5da5Sopenharmony_ci  entry_point.name = "fmain";
3363fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Fragment";
3364fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%output";
3365fd4e5da5Sopenharmony_ci  entry_point.execution_modes = "OpExecutionMode %fmain OriginUpperLeft";
3366fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3367fd4e5da5Sopenharmony_ci%val2 = OpFunctionCall %void %foo
3368fd4e5da5Sopenharmony_ci)";
3369fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3370fd4e5da5Sopenharmony_ci
3371fd4e5da5Sopenharmony_ci  generator.add_at_the_end_ = R"(
3372fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %func
3373fd4e5da5Sopenharmony_ci%foo_entry = OpLabel
3374fd4e5da5Sopenharmony_ci%position = OpAccessChain %output_f32vec4_ptr %output %u32_0
3375fd4e5da5Sopenharmony_ciOpStore %position %f32vec4_0123
3376fd4e5da5Sopenharmony_ciOpReturn
3377fd4e5da5Sopenharmony_ciOpFunctionEnd
3378fd4e5da5Sopenharmony_ci)";
3379fd4e5da5Sopenharmony_ci
3380fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3381fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3382fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3383fd4e5da5Sopenharmony_ci              HasSubstr("Vulkan spec allows BuiltIn Position to be used only "
3384fd4e5da5Sopenharmony_ci                        "with Vertex, TessellationControl, "
3385fd4e5da5Sopenharmony_ci                        "TessellationEvaluation or Geometry execution models"));
3386fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3387fd4e5da5Sopenharmony_ci              HasSubstr("called with execution model Fragment"));
3388fd4e5da5Sopenharmony_ci}
3389fd4e5da5Sopenharmony_ci
3390fd4e5da5Sopenharmony_ciCodeGenerator GetNoDepthReplacingGenerator() {
3391fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3392fd4e5da5Sopenharmony_ci
3393fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3394fd4e5da5Sopenharmony_ciOpDecorate %output_type Block
3395fd4e5da5Sopenharmony_ciOpMemberDecorate %output_type 0 BuiltIn FragDepth
3396fd4e5da5Sopenharmony_ci)";
3397fd4e5da5Sopenharmony_ci
3398fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3399fd4e5da5Sopenharmony_ci%output_type = OpTypeStruct %f32
3400fd4e5da5Sopenharmony_ci%output_null = OpConstantNull %output_type
3401fd4e5da5Sopenharmony_ci%output_ptr = OpTypePointer Output %output_type
3402fd4e5da5Sopenharmony_ci%output = OpVariable %output_ptr Output %output_null
3403fd4e5da5Sopenharmony_ci%output_f32_ptr = OpTypePointer Output %f32
3404fd4e5da5Sopenharmony_ci)";
3405fd4e5da5Sopenharmony_ci
3406fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3407fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3408fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Fragment";
3409fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%output";
3410fd4e5da5Sopenharmony_ci  entry_point.execution_modes = "OpExecutionMode %main OriginUpperLeft";
3411fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3412fd4e5da5Sopenharmony_ci%val2 = OpFunctionCall %void %foo
3413fd4e5da5Sopenharmony_ci)";
3414fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3415fd4e5da5Sopenharmony_ci
3416fd4e5da5Sopenharmony_ci  const std::string function_body = R"(
3417fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %func
3418fd4e5da5Sopenharmony_ci%foo_entry = OpLabel
3419fd4e5da5Sopenharmony_ci%frag_depth = OpAccessChain %output_f32_ptr %output %u32_0
3420fd4e5da5Sopenharmony_ciOpStore %frag_depth %f32_1
3421fd4e5da5Sopenharmony_ciOpReturn
3422fd4e5da5Sopenharmony_ciOpFunctionEnd
3423fd4e5da5Sopenharmony_ci)";
3424fd4e5da5Sopenharmony_ci
3425fd4e5da5Sopenharmony_ci  generator.add_at_the_end_ = function_body;
3426fd4e5da5Sopenharmony_ci
3427fd4e5da5Sopenharmony_ci  return generator;
3428fd4e5da5Sopenharmony_ci}
3429fd4e5da5Sopenharmony_ci
3430fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, VulkanFragmentFragDepthNoDepthReplacing) {
3431fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetNoDepthReplacingGenerator();
3432fd4e5da5Sopenharmony_ci
3433fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3434fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3435fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3436fd4e5da5Sopenharmony_ci              HasSubstr("Vulkan spec requires DepthReplacing execution mode to "
3437fd4e5da5Sopenharmony_ci                        "be declared when using BuiltIn FragDepth"));
3438fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3439fd4e5da5Sopenharmony_ci              HasSubstr("VUID-FragDepth-FragDepth-04216"));
3440fd4e5da5Sopenharmony_ci}
3441fd4e5da5Sopenharmony_ci
3442fd4e5da5Sopenharmony_ciCodeGenerator GetOneMainHasDepthReplacingOtherHasntGenerator() {
3443fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3444fd4e5da5Sopenharmony_ci
3445fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3446fd4e5da5Sopenharmony_ciOpDecorate %output_type Block
3447fd4e5da5Sopenharmony_ciOpMemberDecorate %output_type 0 BuiltIn FragDepth
3448fd4e5da5Sopenharmony_ci)";
3449fd4e5da5Sopenharmony_ci
3450fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3451fd4e5da5Sopenharmony_ci%output_type = OpTypeStruct %f32
3452fd4e5da5Sopenharmony_ci%output_null = OpConstantNull %output_type
3453fd4e5da5Sopenharmony_ci%output_ptr = OpTypePointer Output %output_type
3454fd4e5da5Sopenharmony_ci%output = OpVariable %output_ptr Output %output_null
3455fd4e5da5Sopenharmony_ci%output_f32_ptr = OpTypePointer Output %f32
3456fd4e5da5Sopenharmony_ci)";
3457fd4e5da5Sopenharmony_ci
3458fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3459fd4e5da5Sopenharmony_ci  entry_point.name = "main_d_r";
3460fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Fragment";
3461fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%output";
3462fd4e5da5Sopenharmony_ci  entry_point.execution_modes =
3463fd4e5da5Sopenharmony_ci      "OpExecutionMode %main_d_r OriginUpperLeft\n"
3464fd4e5da5Sopenharmony_ci      "OpExecutionMode %main_d_r DepthReplacing";
3465fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3466fd4e5da5Sopenharmony_ci%val2 = OpFunctionCall %void %foo
3467fd4e5da5Sopenharmony_ci)";
3468fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3469fd4e5da5Sopenharmony_ci
3470fd4e5da5Sopenharmony_ci  entry_point.name = "main_no_d_r";
3471fd4e5da5Sopenharmony_ci  entry_point.execution_model = "Fragment";
3472fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%output";
3473fd4e5da5Sopenharmony_ci  entry_point.execution_modes = "OpExecutionMode %main_no_d_r OriginUpperLeft";
3474fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3475fd4e5da5Sopenharmony_ci%val3 = OpFunctionCall %void %foo
3476fd4e5da5Sopenharmony_ci)";
3477fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3478fd4e5da5Sopenharmony_ci
3479fd4e5da5Sopenharmony_ci  const std::string function_body = R"(
3480fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %func
3481fd4e5da5Sopenharmony_ci%foo_entry = OpLabel
3482fd4e5da5Sopenharmony_ci%frag_depth = OpAccessChain %output_f32_ptr %output %u32_0
3483fd4e5da5Sopenharmony_ciOpStore %frag_depth %f32_1
3484fd4e5da5Sopenharmony_ciOpReturn
3485fd4e5da5Sopenharmony_ciOpFunctionEnd
3486fd4e5da5Sopenharmony_ci)";
3487fd4e5da5Sopenharmony_ci
3488fd4e5da5Sopenharmony_ci  generator.add_at_the_end_ = function_body;
3489fd4e5da5Sopenharmony_ci
3490fd4e5da5Sopenharmony_ci  return generator;
3491fd4e5da5Sopenharmony_ci}
3492fd4e5da5Sopenharmony_ci
3493fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns,
3494fd4e5da5Sopenharmony_ci       VulkanFragmentFragDepthOneMainHasDepthReplacingOtherHasnt) {
3495fd4e5da5Sopenharmony_ci  CodeGenerator generator = GetOneMainHasDepthReplacingOtherHasntGenerator();
3496fd4e5da5Sopenharmony_ci
3497fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3498fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3499fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3500fd4e5da5Sopenharmony_ci              HasSubstr("Vulkan spec requires DepthReplacing execution mode to "
3501fd4e5da5Sopenharmony_ci                        "be declared when using BuiltIn FragDepth"));
3502fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3503fd4e5da5Sopenharmony_ci              HasSubstr("VUID-FragDepth-FragDepth-04216"));
3504fd4e5da5Sopenharmony_ci}
3505fd4e5da5Sopenharmony_ci
3506fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, AllowInstanceIdWithIntersectionShader) {
3507fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3508fd4e5da5Sopenharmony_ci  generator.capabilities_ += R"(
3509fd4e5da5Sopenharmony_ciOpCapability RayTracingNV
3510fd4e5da5Sopenharmony_ci)";
3511fd4e5da5Sopenharmony_ci
3512fd4e5da5Sopenharmony_ci  generator.extensions_ = R"(
3513fd4e5da5Sopenharmony_ciOpExtension "SPV_NV_ray_tracing"
3514fd4e5da5Sopenharmony_ci)";
3515fd4e5da5Sopenharmony_ci
3516fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3517fd4e5da5Sopenharmony_ciOpDecorate %input_type Block
3518fd4e5da5Sopenharmony_ciOpMemberDecorate %input_type 0 BuiltIn InstanceId
3519fd4e5da5Sopenharmony_ci)";
3520fd4e5da5Sopenharmony_ci
3521fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3522fd4e5da5Sopenharmony_ci%input_type = OpTypeStruct %u32
3523fd4e5da5Sopenharmony_ci%input_ptr = OpTypePointer Input %input_type
3524fd4e5da5Sopenharmony_ci%input = OpVariable %input_ptr Input
3525fd4e5da5Sopenharmony_ci)";
3526fd4e5da5Sopenharmony_ci
3527fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3528fd4e5da5Sopenharmony_ci  entry_point.name = "main_d_r";
3529fd4e5da5Sopenharmony_ci  entry_point.execution_model = "IntersectionNV";
3530fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%input";
3531fd4e5da5Sopenharmony_ci  entry_point.body = R"(
3532fd4e5da5Sopenharmony_ci%val2 = OpFunctionCall %void %foo
3533fd4e5da5Sopenharmony_ci)";
3534fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3535fd4e5da5Sopenharmony_ci
3536fd4e5da5Sopenharmony_ci  generator.add_at_the_end_ = R"(
3537fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %func
3538fd4e5da5Sopenharmony_ci%foo_entry = OpLabel
3539fd4e5da5Sopenharmony_ciOpReturn
3540fd4e5da5Sopenharmony_ciOpFunctionEnd
3541fd4e5da5Sopenharmony_ci)";
3542fd4e5da5Sopenharmony_ci
3543fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
3544fd4e5da5Sopenharmony_ci  EXPECT_THAT(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0));
3545fd4e5da5Sopenharmony_ci}
3546fd4e5da5Sopenharmony_ci
3547fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, ValidBuiltinsForMeshShader) {
3548fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3549fd4e5da5Sopenharmony_ci  generator.capabilities_ += R"(
3550fd4e5da5Sopenharmony_ciOpCapability MeshShadingNV
3551fd4e5da5Sopenharmony_ci)";
3552fd4e5da5Sopenharmony_ci
3553fd4e5da5Sopenharmony_ci  generator.extensions_ = R"(
3554fd4e5da5Sopenharmony_ciOpExtension "SPV_NV_mesh_shader"
3555fd4e5da5Sopenharmony_ci)";
3556fd4e5da5Sopenharmony_ci
3557fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3558fd4e5da5Sopenharmony_ciOpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
3559fd4e5da5Sopenharmony_ciOpDecorate %gl_PrimitiveID PerPrimitiveNV
3560fd4e5da5Sopenharmony_ciOpDecorate %gl_Layer BuiltIn Layer
3561fd4e5da5Sopenharmony_ciOpDecorate %gl_Layer PerPrimitiveNV
3562fd4e5da5Sopenharmony_ciOpDecorate %gl_ViewportIndex BuiltIn ViewportIndex
3563fd4e5da5Sopenharmony_ciOpDecorate %gl_ViewportIndex PerPrimitiveNV
3564fd4e5da5Sopenharmony_ci)";
3565fd4e5da5Sopenharmony_ci
3566fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3567fd4e5da5Sopenharmony_ci%u32_81 = OpConstant %u32 81
3568fd4e5da5Sopenharmony_ci%_arr_int_uint_81 = OpTypeArray %i32 %u32_81
3569fd4e5da5Sopenharmony_ci%_ptr_Output__arr_int_uint_81 = OpTypePointer Output %_arr_int_uint_81
3570fd4e5da5Sopenharmony_ci%gl_PrimitiveID = OpVariable %_ptr_Output__arr_int_uint_81 Output
3571fd4e5da5Sopenharmony_ci%gl_Layer = OpVariable %_ptr_Output__arr_int_uint_81 Output
3572fd4e5da5Sopenharmony_ci%gl_ViewportIndex = OpVariable %_ptr_Output__arr_int_uint_81 Output
3573fd4e5da5Sopenharmony_ci)";
3574fd4e5da5Sopenharmony_ci
3575fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3576fd4e5da5Sopenharmony_ci  entry_point.name = "main_d_r";
3577fd4e5da5Sopenharmony_ci  entry_point.execution_model = "MeshNV";
3578fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%gl_PrimitiveID %gl_Layer %gl_ViewportIndex";
3579fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3580fd4e5da5Sopenharmony_ci
3581fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_1);
3582fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1));
3583fd4e5da5Sopenharmony_ci}
3584fd4e5da5Sopenharmony_ci
3585fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, InvalidBuiltinsForMeshShader) {
3586fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3587fd4e5da5Sopenharmony_ci  generator.capabilities_ += R"(
3588fd4e5da5Sopenharmony_ciOpCapability MeshShadingNV
3589fd4e5da5Sopenharmony_ci)";
3590fd4e5da5Sopenharmony_ci
3591fd4e5da5Sopenharmony_ci  generator.extensions_ = R"(
3592fd4e5da5Sopenharmony_ciOpExtension "SPV_NV_mesh_shader"
3593fd4e5da5Sopenharmony_ci)";
3594fd4e5da5Sopenharmony_ci
3595fd4e5da5Sopenharmony_ci  generator.before_types_ = R"(
3596fd4e5da5Sopenharmony_ciOpDecorate %gl_PrimitiveID BuiltIn PrimitiveId
3597fd4e5da5Sopenharmony_ciOpDecorate %gl_PrimitiveID PerPrimitiveNV
3598fd4e5da5Sopenharmony_ciOpDecorate %gl_Layer BuiltIn Layer
3599fd4e5da5Sopenharmony_ciOpDecorate %gl_Layer PerPrimitiveNV
3600fd4e5da5Sopenharmony_ciOpDecorate %gl_ViewportIndex BuiltIn ViewportIndex
3601fd4e5da5Sopenharmony_ciOpDecorate %gl_ViewportIndex PerPrimitiveNV
3602fd4e5da5Sopenharmony_ci)";
3603fd4e5da5Sopenharmony_ci
3604fd4e5da5Sopenharmony_ci  generator.after_types_ = R"(
3605fd4e5da5Sopenharmony_ci%u32_81 = OpConstant %u32 81
3606fd4e5da5Sopenharmony_ci%_arr_float_uint_81 = OpTypeArray %f32 %u32_81
3607fd4e5da5Sopenharmony_ci%_ptr_Output__arr_float_uint_81 = OpTypePointer Output %_arr_float_uint_81
3608fd4e5da5Sopenharmony_ci%gl_PrimitiveID = OpVariable %_ptr_Output__arr_float_uint_81 Output
3609fd4e5da5Sopenharmony_ci%gl_Layer = OpVariable %_ptr_Output__arr_float_uint_81 Output
3610fd4e5da5Sopenharmony_ci%gl_ViewportIndex = OpVariable %_ptr_Output__arr_float_uint_81 Output
3611fd4e5da5Sopenharmony_ci)";
3612fd4e5da5Sopenharmony_ci
3613fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3614fd4e5da5Sopenharmony_ci  entry_point.name = "main_d_r";
3615fd4e5da5Sopenharmony_ci  entry_point.execution_model = "MeshNV";
3616fd4e5da5Sopenharmony_ci  entry_point.interfaces = "%gl_PrimitiveID %gl_Layer %gl_ViewportIndex";
3617fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3618fd4e5da5Sopenharmony_ci
3619fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_1);
3620fd4e5da5Sopenharmony_ci  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1));
3621fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3622fd4e5da5Sopenharmony_ci              HasSubstr("needs to be a 32-bit int scalar"));
3623fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(), HasSubstr("is not an int scalar"));
3624fd4e5da5Sopenharmony_ci}
3625fd4e5da5Sopenharmony_ci
3626fd4e5da5Sopenharmony_ciTEST_P(ValidateVulkanSubgroupBuiltIns, InMain) {
3627fd4e5da5Sopenharmony_ci  const char* const built_in = std::get<0>(GetParam());
3628fd4e5da5Sopenharmony_ci  const char* const execution_model = std::get<1>(GetParam());
3629fd4e5da5Sopenharmony_ci  const char* const storage_class = std::get<2>(GetParam());
3630fd4e5da5Sopenharmony_ci  const char* const data_type = std::get<3>(GetParam());
3631fd4e5da5Sopenharmony_ci  const char* const vuid = std::get<4>(GetParam());
3632fd4e5da5Sopenharmony_ci  const TestResult& test_result = std::get<5>(GetParam());
3633fd4e5da5Sopenharmony_ci
3634fd4e5da5Sopenharmony_ci  CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
3635fd4e5da5Sopenharmony_ci  generator.capabilities_ += R"(
3636fd4e5da5Sopenharmony_ciOpCapability GroupNonUniformBallot
3637fd4e5da5Sopenharmony_ci)";
3638fd4e5da5Sopenharmony_ci
3639fd4e5da5Sopenharmony_ci  generator.before_types_ = "OpDecorate %built_in_var BuiltIn ";
3640fd4e5da5Sopenharmony_ci  generator.before_types_ += built_in;
3641fd4e5da5Sopenharmony_ci  generator.before_types_ += "\n";
3642fd4e5da5Sopenharmony_ci
3643fd4e5da5Sopenharmony_ci  std::ostringstream after_types;
3644fd4e5da5Sopenharmony_ci  after_types << "%built_in_ptr = OpTypePointer " << storage_class << " "
3645fd4e5da5Sopenharmony_ci              << data_type << "\n";
3646fd4e5da5Sopenharmony_ci  after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class;
3647fd4e5da5Sopenharmony_ci  after_types << "\n";
3648fd4e5da5Sopenharmony_ci  generator.after_types_ = after_types.str();
3649fd4e5da5Sopenharmony_ci
3650fd4e5da5Sopenharmony_ci  EntryPoint entry_point;
3651fd4e5da5Sopenharmony_ci  entry_point.name = "main";
3652fd4e5da5Sopenharmony_ci  entry_point.execution_model = execution_model;
3653fd4e5da5Sopenharmony_ci  if (strncmp(storage_class, "Input", 5) == 0 ||
3654fd4e5da5Sopenharmony_ci      strncmp(storage_class, "Output", 6) == 0) {
3655fd4e5da5Sopenharmony_ci    entry_point.interfaces = "%built_in_var";
3656fd4e5da5Sopenharmony_ci  }
3657fd4e5da5Sopenharmony_ci  entry_point.body =
3658fd4e5da5Sopenharmony_ci      std::string("%ld = OpLoad ") + data_type + " %built_in_var\n";
3659fd4e5da5Sopenharmony_ci
3660fd4e5da5Sopenharmony_ci  std::ostringstream execution_modes;
3661fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Fragment")) {
3662fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
3663fd4e5da5Sopenharmony_ci                    << " OriginUpperLeft\n";
3664fd4e5da5Sopenharmony_ci    if (0 == std::strcmp(built_in, "FragDepth")) {
3665fd4e5da5Sopenharmony_ci      execution_modes << "OpExecutionMode %" << entry_point.name
3666fd4e5da5Sopenharmony_ci                      << " DepthReplacing\n";
3667fd4e5da5Sopenharmony_ci    }
3668fd4e5da5Sopenharmony_ci  }
3669fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "Geometry")) {
3670fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
3671fd4e5da5Sopenharmony_ci                    << " InputPoints\n";
3672fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
3673fd4e5da5Sopenharmony_ci                    << " OutputPoints\n";
3674fd4e5da5Sopenharmony_ci  }
3675fd4e5da5Sopenharmony_ci  if (0 == std::strcmp(execution_model, "GLCompute")) {
3676fd4e5da5Sopenharmony_ci    execution_modes << "OpExecutionMode %" << entry_point.name
3677fd4e5da5Sopenharmony_ci                    << " LocalSize 1 1 1\n";
3678fd4e5da5Sopenharmony_ci  }
3679fd4e5da5Sopenharmony_ci  entry_point.execution_modes = execution_modes.str();
3680fd4e5da5Sopenharmony_ci
3681fd4e5da5Sopenharmony_ci  generator.entry_points_.push_back(std::move(entry_point));
3682fd4e5da5Sopenharmony_ci
3683fd4e5da5Sopenharmony_ci  CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_1);
3684fd4e5da5Sopenharmony_ci  ASSERT_EQ(test_result.validation_result,
3685fd4e5da5Sopenharmony_ci            ValidateInstructions(SPV_ENV_VULKAN_1_1));
3686fd4e5da5Sopenharmony_ci  if (test_result.error_str) {
3687fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
3688fd4e5da5Sopenharmony_ci  }
3689fd4e5da5Sopenharmony_ci  if (test_result.error_str2) {
3690fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2));
3691fd4e5da5Sopenharmony_ci  }
3692fd4e5da5Sopenharmony_ci  if (vuid) {
3693fd4e5da5Sopenharmony_ci    EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
3694fd4e5da5Sopenharmony_ci  }
3695fd4e5da5Sopenharmony_ci}
3696fd4e5da5Sopenharmony_ci
3697fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3698fd4e5da5Sopenharmony_ci    SubgroupMaskNotVec4, ValidateVulkanSubgroupBuiltIns,
3699fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupEqMask", "SubgroupGeMask", "SubgroupGtMask",
3700fd4e5da5Sopenharmony_ci                   "SubgroupLeMask", "SubgroupLtMask"),
3701fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"), Values("%u32vec3"),
3702fd4e5da5Sopenharmony_ci            Values("VUID-SubgroupEqMask-SubgroupEqMask-04371 "
3703fd4e5da5Sopenharmony_ci                   "VUID-SubgroupGeMask-SubgroupGeMask-04373 "
3704fd4e5da5Sopenharmony_ci                   "VUID-SubgroupGtMask-SubgroupGtMask-04375 "
3705fd4e5da5Sopenharmony_ci                   "VUID-SubgroupLeMask-SubgroupLeMask-04377 "
3706fd4e5da5Sopenharmony_ci                   "VUID-SubgroupLtMask-SubgroupLtMask-04379"),
3707fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
3708fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit int vector"))));
3709fd4e5da5Sopenharmony_ci
3710fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3711fd4e5da5Sopenharmony_ci    SubgroupMaskNotU32, ValidateVulkanSubgroupBuiltIns,
3712fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupEqMask", "SubgroupGeMask", "SubgroupGtMask",
3713fd4e5da5Sopenharmony_ci                   "SubgroupLeMask", "SubgroupLtMask"),
3714fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"), Values("%f32vec4"),
3715fd4e5da5Sopenharmony_ci            Values("VUID-SubgroupEqMask-SubgroupEqMask-04371 "
3716fd4e5da5Sopenharmony_ci                   "VUID-SubgroupGeMask-SubgroupGeMask-04373 "
3717fd4e5da5Sopenharmony_ci                   "VUID-SubgroupGtMask-SubgroupGtMask-04375 "
3718fd4e5da5Sopenharmony_ci                   "VUID-SubgroupLeMask-SubgroupLeMask-04377 "
3719fd4e5da5Sopenharmony_ci                   "VUID-SubgroupLtMask-SubgroupLtMask-04379"),
3720fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
3721fd4e5da5Sopenharmony_ci                              "needs to be a 4-component 32-bit int vector"))));
3722fd4e5da5Sopenharmony_ci
3723fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3724fd4e5da5Sopenharmony_ci    SubgroupMaskNotInput, ValidateVulkanSubgroupBuiltIns,
3725fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupEqMask", "SubgroupGeMask", "SubgroupGtMask",
3726fd4e5da5Sopenharmony_ci                   "SubgroupLeMask", "SubgroupLtMask"),
3727fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Output", "Workgroup", "Private"),
3728fd4e5da5Sopenharmony_ci            Values("%u32vec4"),
3729fd4e5da5Sopenharmony_ci            Values("VUID-SubgroupEqMask-SubgroupEqMask-04370 "
3730fd4e5da5Sopenharmony_ci                   "VUID-SubgroupGeMask-SubgroupGeMask-04372 "
3731fd4e5da5Sopenharmony_ci                   "VUID-SubgroupGtMask-SubgroupGtMask-04374 "
3732fd4e5da5Sopenharmony_ci                   "VUID-SubgroupLeMask-SubgroupLeMask-04376  "
3733fd4e5da5Sopenharmony_ci                   "VUID-SubgroupLtMask-SubgroupLtMask-04378"),
3734fd4e5da5Sopenharmony_ci            Values(TestResult(
3735fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
3736fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class"))));
3737fd4e5da5Sopenharmony_ci
3738fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(SubgroupMaskOk, ValidateVulkanSubgroupBuiltIns,
3739fd4e5da5Sopenharmony_ci                         Combine(Values("SubgroupEqMask", "SubgroupGeMask",
3740fd4e5da5Sopenharmony_ci                                        "SubgroupGtMask", "SubgroupLeMask",
3741fd4e5da5Sopenharmony_ci                                        "SubgroupLtMask"),
3742fd4e5da5Sopenharmony_ci                                 Values("GLCompute"), Values("Input"),
3743fd4e5da5Sopenharmony_ci                                 Values("%u32vec4"), Values(nullptr),
3744fd4e5da5Sopenharmony_ci                                 Values(TestResult(SPV_SUCCESS, ""))));
3745fd4e5da5Sopenharmony_ci
3746fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, SubgroupMaskMemberDecorate) {
3747fd4e5da5Sopenharmony_ci  const std::string text = R"(
3748fd4e5da5Sopenharmony_ciOpCapability Shader
3749fd4e5da5Sopenharmony_ciOpCapability GroupNonUniformBallot
3750fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450
3751fd4e5da5Sopenharmony_ciOpEntryPoint GLCompute %foo "foo"
3752fd4e5da5Sopenharmony_ciOpExecutionMode %foo LocalSize 1 1 1
3753fd4e5da5Sopenharmony_ciOpDecorate %struct Block
3754fd4e5da5Sopenharmony_ciOpMemberDecorate %struct 0 BuiltIn SubgroupEqMask
3755fd4e5da5Sopenharmony_ci%void = OpTypeVoid
3756fd4e5da5Sopenharmony_ci%int = OpTypeInt 32 0
3757fd4e5da5Sopenharmony_ci%struct = OpTypeStruct %int
3758fd4e5da5Sopenharmony_ci%void_fn = OpTypeFunction %void
3759fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %void_fn
3760fd4e5da5Sopenharmony_ci%entry = OpLabel
3761fd4e5da5Sopenharmony_ciOpReturn
3762fd4e5da5Sopenharmony_ciOpFunctionEnd
3763fd4e5da5Sopenharmony_ci)";
3764fd4e5da5Sopenharmony_ci
3765fd4e5da5Sopenharmony_ci  CompileSuccessfully(text, SPV_ENV_VULKAN_1_1);
3766fd4e5da5Sopenharmony_ci  EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1));
3767fd4e5da5Sopenharmony_ci  EXPECT_THAT(
3768fd4e5da5Sopenharmony_ci      getDiagnosticString(),
3769fd4e5da5Sopenharmony_ci      HasSubstr(
3770fd4e5da5Sopenharmony_ci          "BuiltIn SubgroupEqMask cannot be used as a member decoration"));
3771fd4e5da5Sopenharmony_ci}
3772fd4e5da5Sopenharmony_ci
3773fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3774fd4e5da5Sopenharmony_ci    SubgroupInvocationIdAndSizeNotU32, ValidateVulkanSubgroupBuiltIns,
3775fd4e5da5Sopenharmony_ci    Combine(
3776fd4e5da5Sopenharmony_ci        Values("SubgroupLocalInvocationId", "SubgroupSize"),
3777fd4e5da5Sopenharmony_ci        Values("GLCompute"), Values("Input"), Values("%f32"),
3778fd4e5da5Sopenharmony_ci        Values("VUID-SubgroupLocalInvocationId-SubgroupLocalInvocationId-04381 "
3779fd4e5da5Sopenharmony_ci               "VUID-SubgroupSize-SubgroupSize-04383"),
3780fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
3781fd4e5da5Sopenharmony_ci                          "needs to be a 32-bit int"))));
3782fd4e5da5Sopenharmony_ci
3783fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3784fd4e5da5Sopenharmony_ci    SubgroupInvocationIdAndSizeNotInput, ValidateVulkanSubgroupBuiltIns,
3785fd4e5da5Sopenharmony_ci    Combine(
3786fd4e5da5Sopenharmony_ci        Values("SubgroupLocalInvocationId", "SubgroupSize"),
3787fd4e5da5Sopenharmony_ci        Values("GLCompute"), Values("Output", "Workgroup", "Private"),
3788fd4e5da5Sopenharmony_ci        Values("%u32"),
3789fd4e5da5Sopenharmony_ci        Values("VUID-SubgroupLocalInvocationId-SubgroupLocalInvocationId-04380 "
3790fd4e5da5Sopenharmony_ci               "VUID-SubgroupSize-SubgroupSize-04382"),
3791fd4e5da5Sopenharmony_ci        Values(TestResult(
3792fd4e5da5Sopenharmony_ci            SPV_ERROR_INVALID_DATA,
3793fd4e5da5Sopenharmony_ci            "to be only used for variables with Input storage class"))));
3794fd4e5da5Sopenharmony_ci
3795fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3796fd4e5da5Sopenharmony_ci    SubgroupInvocationIdAndSizeOk, ValidateVulkanSubgroupBuiltIns,
3797fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupLocalInvocationId", "SubgroupSize"),
3798fd4e5da5Sopenharmony_ci            Values("GLCompute"), Values("Input"), Values("%u32"),
3799fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult(SPV_SUCCESS, ""))));
3800fd4e5da5Sopenharmony_ci
3801fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, SubgroupSizeMemberDecorate) {
3802fd4e5da5Sopenharmony_ci  const std::string text = R"(
3803fd4e5da5Sopenharmony_ciOpCapability Shader
3804fd4e5da5Sopenharmony_ciOpCapability GroupNonUniform
3805fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450
3806fd4e5da5Sopenharmony_ciOpEntryPoint GLCompute %foo "foo"
3807fd4e5da5Sopenharmony_ciOpExecutionMode %foo LocalSize 1 1 1
3808fd4e5da5Sopenharmony_ciOpDecorate %struct Block
3809fd4e5da5Sopenharmony_ciOpMemberDecorate %struct 0 BuiltIn SubgroupSize
3810fd4e5da5Sopenharmony_ci%void = OpTypeVoid
3811fd4e5da5Sopenharmony_ci%int = OpTypeInt 32 0
3812fd4e5da5Sopenharmony_ci%struct = OpTypeStruct %int
3813fd4e5da5Sopenharmony_ci%void_fn = OpTypeFunction %void
3814fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %void_fn
3815fd4e5da5Sopenharmony_ci%entry = OpLabel
3816fd4e5da5Sopenharmony_ciOpReturn
3817fd4e5da5Sopenharmony_ciOpFunctionEnd
3818fd4e5da5Sopenharmony_ci)";
3819fd4e5da5Sopenharmony_ci
3820fd4e5da5Sopenharmony_ci  CompileSuccessfully(text, SPV_ENV_VULKAN_1_1);
3821fd4e5da5Sopenharmony_ci  EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1));
3822fd4e5da5Sopenharmony_ci  EXPECT_THAT(
3823fd4e5da5Sopenharmony_ci      getDiagnosticString(),
3824fd4e5da5Sopenharmony_ci      HasSubstr("BuiltIn SubgroupSize cannot be used as a member decoration"));
3825fd4e5da5Sopenharmony_ci}
3826fd4e5da5Sopenharmony_ci
3827fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3828fd4e5da5Sopenharmony_ci    SubgroupNumAndIdNotCompute, ValidateVulkanSubgroupBuiltIns,
3829fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupId", "NumSubgroups"), Values("Vertex"),
3830fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
3831fd4e5da5Sopenharmony_ci            Values("VUID-SubgroupId-SubgroupId-04367 "
3832fd4e5da5Sopenharmony_ci                   "VUID-NumSubgroups-NumSubgroups-04293"),
3833fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
3834fd4e5da5Sopenharmony_ci                              "to be used only with GLCompute, MeshNV, "
3835fd4e5da5Sopenharmony_ci                              "TaskNV, MeshEXT or TaskEXT execution model"))));
3836fd4e5da5Sopenharmony_ci
3837fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3838fd4e5da5Sopenharmony_ci    SubgroupNumAndIdNotU32, ValidateVulkanSubgroupBuiltIns,
3839fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupId", "NumSubgroups"), Values("GLCompute"),
3840fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32"),
3841fd4e5da5Sopenharmony_ci            Values("VUID-SubgroupId-SubgroupId-04369 "
3842fd4e5da5Sopenharmony_ci                   "VUID-NumSubgroups-NumSubgroups-04295"),
3843fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
3844fd4e5da5Sopenharmony_ci                              "needs to be a 32-bit int"))));
3845fd4e5da5Sopenharmony_ci
3846fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3847fd4e5da5Sopenharmony_ci    SubgroupNumAndIdNotInput, ValidateVulkanSubgroupBuiltIns,
3848fd4e5da5Sopenharmony_ci    Combine(Values("SubgroupId", "NumSubgroups"), Values("GLCompute"),
3849fd4e5da5Sopenharmony_ci            Values("Output", "Workgroup", "Private"), Values("%u32"),
3850fd4e5da5Sopenharmony_ci            Values("VUID-SubgroupId-SubgroupId-04368 "
3851fd4e5da5Sopenharmony_ci                   "VUID-NumSubgroups-NumSubgroups-04294"),
3852fd4e5da5Sopenharmony_ci            Values(TestResult(
3853fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
3854fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class"))));
3855fd4e5da5Sopenharmony_ci
3856fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(SubgroupNumAndIdOk, ValidateVulkanSubgroupBuiltIns,
3857fd4e5da5Sopenharmony_ci                         Combine(Values("SubgroupId", "NumSubgroups"),
3858fd4e5da5Sopenharmony_ci                                 Values("GLCompute"), Values("Input"),
3859fd4e5da5Sopenharmony_ci                                 Values("%u32"), Values(nullptr),
3860fd4e5da5Sopenharmony_ci                                 Values(TestResult(SPV_SUCCESS, ""))));
3861fd4e5da5Sopenharmony_ci
3862fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, SubgroupIdMemberDecorate) {
3863fd4e5da5Sopenharmony_ci  const std::string text = R"(
3864fd4e5da5Sopenharmony_ciOpCapability Shader
3865fd4e5da5Sopenharmony_ciOpCapability GroupNonUniform
3866fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450
3867fd4e5da5Sopenharmony_ciOpEntryPoint GLCompute %foo "foo"
3868fd4e5da5Sopenharmony_ciOpExecutionMode %foo LocalSize 1 1 1
3869fd4e5da5Sopenharmony_ciOpDecorate %struct Block
3870fd4e5da5Sopenharmony_ciOpMemberDecorate %struct 0 BuiltIn SubgroupId
3871fd4e5da5Sopenharmony_ci%void = OpTypeVoid
3872fd4e5da5Sopenharmony_ci%int = OpTypeInt 32 0
3873fd4e5da5Sopenharmony_ci%struct = OpTypeStruct %int
3874fd4e5da5Sopenharmony_ci%void_fn = OpTypeFunction %void
3875fd4e5da5Sopenharmony_ci%foo = OpFunction %void None %void_fn
3876fd4e5da5Sopenharmony_ci%entry = OpLabel
3877fd4e5da5Sopenharmony_ciOpReturn
3878fd4e5da5Sopenharmony_ciOpFunctionEnd
3879fd4e5da5Sopenharmony_ci)";
3880fd4e5da5Sopenharmony_ci
3881fd4e5da5Sopenharmony_ci  CompileSuccessfully(text, SPV_ENV_VULKAN_1_1);
3882fd4e5da5Sopenharmony_ci  EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1));
3883fd4e5da5Sopenharmony_ci  EXPECT_THAT(
3884fd4e5da5Sopenharmony_ci      getDiagnosticString(),
3885fd4e5da5Sopenharmony_ci      HasSubstr("BuiltIn SubgroupId cannot be used as a member decoration"));
3886fd4e5da5Sopenharmony_ci}
3887fd4e5da5Sopenharmony_ci
3888fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, TargetIsType) {
3889fd4e5da5Sopenharmony_ci  const std::string text = R"(
3890fd4e5da5Sopenharmony_ciOpCapability Shader
3891fd4e5da5Sopenharmony_ciOpCapability Linkage
3892fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450
3893fd4e5da5Sopenharmony_ciOpDecorate %void BuiltIn Position
3894fd4e5da5Sopenharmony_ci%void = OpTypeVoid
3895fd4e5da5Sopenharmony_ci)";
3896fd4e5da5Sopenharmony_ci
3897fd4e5da5Sopenharmony_ci  CompileSuccessfully(text);
3898fd4e5da5Sopenharmony_ci  EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
3899fd4e5da5Sopenharmony_ci  EXPECT_THAT(getDiagnosticString(),
3900fd4e5da5Sopenharmony_ci              HasSubstr("BuiltIns can only target variables, structure members "
3901fd4e5da5Sopenharmony_ci                        "or constants"));
3902fd4e5da5Sopenharmony_ci}
3903fd4e5da5Sopenharmony_ci
3904fd4e5da5Sopenharmony_ciTEST_F(ValidateBuiltIns, TargetIsVariable) {
3905fd4e5da5Sopenharmony_ci  const std::string text = R"(
3906fd4e5da5Sopenharmony_ciOpCapability Shader
3907fd4e5da5Sopenharmony_ciOpCapability Linkage
3908fd4e5da5Sopenharmony_ciOpMemoryModel Logical GLSL450
3909fd4e5da5Sopenharmony_ciOpDecorate %wg_var BuiltIn Position
3910fd4e5da5Sopenharmony_ci%int = OpTypeInt 32 0
3911fd4e5da5Sopenharmony_ci%int_wg_ptr = OpTypePointer Workgroup %int
3912fd4e5da5Sopenharmony_ci%wg_var = OpVariable %int_wg_ptr Workgroup
3913fd4e5da5Sopenharmony_ci)";
3914fd4e5da5Sopenharmony_ci
3915fd4e5da5Sopenharmony_ci  CompileSuccessfully(text);
3916fd4e5da5Sopenharmony_ci  EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
3917fd4e5da5Sopenharmony_ci}
3918fd4e5da5Sopenharmony_ci
3919fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3920fd4e5da5Sopenharmony_ci    PrimitiveShadingRateOutputSuccess,
3921fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3922fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveShadingRateKHR"), Values("Vertex", "Geometry"),
3923fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
3924fd4e5da5Sopenharmony_ci            Values("OpCapability FragmentShadingRateKHR\n"),
3925fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
3926fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
3927fd4e5da5Sopenharmony_ci
3928fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3929fd4e5da5Sopenharmony_ci    PrimitiveShadingRateMeshOutputSuccess,
3930fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3931fd4e5da5Sopenharmony_ci    Combine(Values("PrimitiveShadingRateKHR"), Values("MeshNV"),
3932fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
3933fd4e5da5Sopenharmony_ci            Values("OpCapability FragmentShadingRateKHR\nOpCapability "
3934fd4e5da5Sopenharmony_ci                   "MeshShadingNV\n"),
3935fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\nOpExtension "
3936fd4e5da5Sopenharmony_ci                   "\"SPV_NV_mesh_shader\"\n"),
3937fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
3938fd4e5da5Sopenharmony_ci
3939fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3940fd4e5da5Sopenharmony_ci    PrimitiveShadingRateInvalidExecutionModel,
3941fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3942fd4e5da5Sopenharmony_ci    Combine(
3943fd4e5da5Sopenharmony_ci        Values("PrimitiveShadingRateKHR"), Values("Fragment"), Values("Output"),
3944fd4e5da5Sopenharmony_ci        Values("%u32"), Values("OpCapability FragmentShadingRateKHR\n"),
3945fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
3946fd4e5da5Sopenharmony_ci        Values("VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04484 "),
3947fd4e5da5Sopenharmony_ci        Values(TestResult(
3948fd4e5da5Sopenharmony_ci            SPV_ERROR_INVALID_DATA,
3949fd4e5da5Sopenharmony_ci            "Vulkan spec allows BuiltIn PrimitiveShadingRateKHR to be used "
3950fd4e5da5Sopenharmony_ci            "only with Vertex, Geometry, or MeshNV execution models."))));
3951fd4e5da5Sopenharmony_ci
3952fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3953fd4e5da5Sopenharmony_ci    PrimitiveShadingRateInvalidStorageClass,
3954fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3955fd4e5da5Sopenharmony_ci    Combine(
3956fd4e5da5Sopenharmony_ci        Values("PrimitiveShadingRateKHR"), Values("Vertex"), Values("Input"),
3957fd4e5da5Sopenharmony_ci        Values("%u32"), Values("OpCapability FragmentShadingRateKHR\n"),
3958fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
3959fd4e5da5Sopenharmony_ci        Values("VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04485 "),
3960fd4e5da5Sopenharmony_ci        Values(TestResult(
3961fd4e5da5Sopenharmony_ci            SPV_ERROR_INVALID_DATA,
3962fd4e5da5Sopenharmony_ci            "Vulkan spec allows BuiltIn PrimitiveShadingRateKHR to be only "
3963fd4e5da5Sopenharmony_ci            "used for variables with Output storage class."))));
3964fd4e5da5Sopenharmony_ci
3965fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3966fd4e5da5Sopenharmony_ci    PrimitiveShadingRateInvalidType,
3967fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3968fd4e5da5Sopenharmony_ci    Combine(
3969fd4e5da5Sopenharmony_ci        Values("PrimitiveShadingRateKHR"), Values("Vertex"), Values("Output"),
3970fd4e5da5Sopenharmony_ci        Values("%f32"), Values("OpCapability FragmentShadingRateKHR\n"),
3971fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
3972fd4e5da5Sopenharmony_ci        Values("VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04486 "),
3973fd4e5da5Sopenharmony_ci        Values(TestResult(
3974fd4e5da5Sopenharmony_ci            SPV_ERROR_INVALID_DATA,
3975fd4e5da5Sopenharmony_ci            "According to the Vulkan spec BuiltIn PrimitiveShadingRateKHR "
3976fd4e5da5Sopenharmony_ci            "variable needs to be a 32-bit int scalar."))));
3977fd4e5da5Sopenharmony_ci
3978fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3979fd4e5da5Sopenharmony_ci    ShadingRateInputSuccess,
3980fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3981fd4e5da5Sopenharmony_ci    Combine(Values("ShadingRateKHR"), Values("Fragment"), Values("Input"),
3982fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability FragmentShadingRateKHR\n"),
3983fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
3984fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
3985fd4e5da5Sopenharmony_ci
3986fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3987fd4e5da5Sopenharmony_ci    ShadingRateInvalidExecutionModel,
3988fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
3989fd4e5da5Sopenharmony_ci    Combine(Values("ShadingRateKHR"), Values("Vertex"), Values("Input"),
3990fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability FragmentShadingRateKHR\n"),
3991fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
3992fd4e5da5Sopenharmony_ci            Values("VUID-ShadingRateKHR-ShadingRateKHR-04490 "),
3993fd4e5da5Sopenharmony_ci            Values(TestResult(
3994fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
3995fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn ShadingRateKHR to be used "
3996fd4e5da5Sopenharmony_ci                "only with the Fragment execution model."))));
3997fd4e5da5Sopenharmony_ci
3998fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
3999fd4e5da5Sopenharmony_ci    ShadingRateInvalidStorageClass,
4000fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4001fd4e5da5Sopenharmony_ci    Combine(Values("ShadingRateKHR"), Values("Fragment"), Values("Output"),
4002fd4e5da5Sopenharmony_ci            Values("%u32"), Values("OpCapability FragmentShadingRateKHR\n"),
4003fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
4004fd4e5da5Sopenharmony_ci            Values("VUID-ShadingRateKHR-ShadingRateKHR-04491 "),
4005fd4e5da5Sopenharmony_ci            Values(TestResult(
4006fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4007fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn ShadingRateKHR to be only "
4008fd4e5da5Sopenharmony_ci                "used for variables with Input storage class."))));
4009fd4e5da5Sopenharmony_ci
4010fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4011fd4e5da5Sopenharmony_ci    ShadingRateInvalidType,
4012fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4013fd4e5da5Sopenharmony_ci    Combine(
4014fd4e5da5Sopenharmony_ci        Values("ShadingRateKHR"), Values("Fragment"), Values("Input"),
4015fd4e5da5Sopenharmony_ci        Values("%f32"), Values("OpCapability FragmentShadingRateKHR\n"),
4016fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
4017fd4e5da5Sopenharmony_ci        Values("VUID-ShadingRateKHR-ShadingRateKHR-04492 "),
4018fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
4019fd4e5da5Sopenharmony_ci                          "According to the Vulkan spec BuiltIn ShadingRateKHR "
4020fd4e5da5Sopenharmony_ci                          "variable needs to be a 32-bit int scalar."))));
4021fd4e5da5Sopenharmony_ci
4022fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4023fd4e5da5Sopenharmony_ci    FragInvocationCountInputSuccess,
4024fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4025fd4e5da5Sopenharmony_ci    Combine(Values("FragInvocationCountEXT"), Values("Fragment"),
4026fd4e5da5Sopenharmony_ci            Values("Input"), Values("%u32"),
4027fd4e5da5Sopenharmony_ci            Values("OpCapability FragmentDensityEXT\n"),
4028fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4029fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
4030fd4e5da5Sopenharmony_ci
4031fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4032fd4e5da5Sopenharmony_ci    FragInvocationCountInvalidExecutionModel,
4033fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4034fd4e5da5Sopenharmony_ci    Combine(
4035fd4e5da5Sopenharmony_ci        Values("FragInvocationCountEXT"), Values("Vertex"), Values("Input"),
4036fd4e5da5Sopenharmony_ci        Values("%u32"), Values("OpCapability FragmentDensityEXT\n"),
4037fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4038fd4e5da5Sopenharmony_ci        Values("VUID-FragInvocationCountEXT-FragInvocationCountEXT-04217"),
4039fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
4040fd4e5da5Sopenharmony_ci                          "Vulkan spec allows BuiltIn FragInvocationCountEXT "
4041fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model."))));
4042fd4e5da5Sopenharmony_ci
4043fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4044fd4e5da5Sopenharmony_ci    FragInvocationCountInvalidStorageClass,
4045fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4046fd4e5da5Sopenharmony_ci    Combine(Values("FragInvocationCountEXT"), Values("Fragment"),
4047fd4e5da5Sopenharmony_ci            Values("Output"), Values("%u32"),
4048fd4e5da5Sopenharmony_ci            Values("OpCapability FragmentDensityEXT\n"),
4049fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4050fd4e5da5Sopenharmony_ci            Values("VUID-FragInvocationCountEXT-FragInvocationCountEXT-04218"),
4051fd4e5da5Sopenharmony_ci            Values(TestResult(
4052fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4053fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn FragInvocationCountEXT to be only "
4054fd4e5da5Sopenharmony_ci                "used for variables with Input storage class."))));
4055fd4e5da5Sopenharmony_ci
4056fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4057fd4e5da5Sopenharmony_ci    FragInvocationCountInvalidType,
4058fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4059fd4e5da5Sopenharmony_ci    Combine(Values("FragInvocationCountEXT"), Values("Fragment"),
4060fd4e5da5Sopenharmony_ci            Values("Input"), Values("%f32"),
4061fd4e5da5Sopenharmony_ci            Values("OpCapability FragmentDensityEXT\n"),
4062fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4063fd4e5da5Sopenharmony_ci            Values("VUID-FragInvocationCountEXT-FragInvocationCountEXT-04219"),
4064fd4e5da5Sopenharmony_ci            Values(TestResult(
4065fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4066fd4e5da5Sopenharmony_ci                "According to the Vulkan spec BuiltIn FragInvocationCountEXT "
4067fd4e5da5Sopenharmony_ci                "variable needs to be a 32-bit int scalar."))));
4068fd4e5da5Sopenharmony_ci
4069fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4070fd4e5da5Sopenharmony_ci    FragSizeInputSuccess,
4071fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4072fd4e5da5Sopenharmony_ci    Combine(Values("FragSizeEXT"), Values("Fragment"), Values("Input"),
4073fd4e5da5Sopenharmony_ci            Values("%u32vec2"), Values("OpCapability FragmentDensityEXT\n"),
4074fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4075fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
4076fd4e5da5Sopenharmony_ci
4077fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4078fd4e5da5Sopenharmony_ci    FragSizeInvalidExecutionModel,
4079fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4080fd4e5da5Sopenharmony_ci    Combine(Values("FragSizeEXT"), Values("Vertex"), Values("Input"),
4081fd4e5da5Sopenharmony_ci            Values("%u32vec2"), Values("OpCapability FragmentDensityEXT\n"),
4082fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4083fd4e5da5Sopenharmony_ci            Values("VUID-FragSizeEXT-FragSizeEXT-04220"),
4084fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
4085fd4e5da5Sopenharmony_ci                              "Vulkan spec allows BuiltIn FragSizeEXT to be "
4086fd4e5da5Sopenharmony_ci                              "used only with Fragment execution model."))));
4087fd4e5da5Sopenharmony_ci
4088fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4089fd4e5da5Sopenharmony_ci    FragSizeInvalidStorageClass,
4090fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4091fd4e5da5Sopenharmony_ci    Combine(
4092fd4e5da5Sopenharmony_ci        Values("FragSizeEXT"), Values("Fragment"), Values("Output"),
4093fd4e5da5Sopenharmony_ci        Values("%u32vec2"), Values("OpCapability FragmentDensityEXT\n"),
4094fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4095fd4e5da5Sopenharmony_ci        Values("VUID-FragSizeEXT-FragSizeEXT-04221"),
4096fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
4097fd4e5da5Sopenharmony_ci                          "Vulkan spec allows BuiltIn FragSizeEXT to be only "
4098fd4e5da5Sopenharmony_ci                          "used for variables with Input storage class."))));
4099fd4e5da5Sopenharmony_ci
4100fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4101fd4e5da5Sopenharmony_ci    FragSizeInvalidType,
4102fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4103fd4e5da5Sopenharmony_ci    Combine(Values("FragSizeEXT"), Values("Fragment"), Values("Input"),
4104fd4e5da5Sopenharmony_ci            Values("%u32vec3"), Values("OpCapability FragmentDensityEXT\n"),
4105fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_invocation_density\"\n"),
4106fd4e5da5Sopenharmony_ci            Values("VUID-FragSizeEXT-FragSizeEXT-04222"),
4107fd4e5da5Sopenharmony_ci            Values(TestResult(
4108fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4109fd4e5da5Sopenharmony_ci                "According to the Vulkan spec BuiltIn FragSizeEXT variable "
4110fd4e5da5Sopenharmony_ci                "needs to be a 2-component 32-bit int vector."))));
4111fd4e5da5Sopenharmony_ci
4112fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4113fd4e5da5Sopenharmony_ci    FragStencilRefOutputSuccess,
4114fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4115fd4e5da5Sopenharmony_ci    Combine(Values("FragStencilRefEXT"), Values("Fragment"), Values("Output"),
4116fd4e5da5Sopenharmony_ci            Values("%u32", "%u64"), Values("OpCapability StencilExportEXT\n"),
4117fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_shader_stencil_export\"\n"),
4118fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
4119fd4e5da5Sopenharmony_ci
4120fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4121fd4e5da5Sopenharmony_ci    FragStencilRefInvalidExecutionModel,
4122fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4123fd4e5da5Sopenharmony_ci    Combine(Values("FragStencilRefEXT"), Values("Vertex"), Values("Output"),
4124fd4e5da5Sopenharmony_ci            Values("%u32", "%u64"), Values("OpCapability StencilExportEXT\n"),
4125fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_shader_stencil_export\"\n"),
4126fd4e5da5Sopenharmony_ci            Values("VUID-FragStencilRefEXT-FragStencilRefEXT-04223"),
4127fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
4128fd4e5da5Sopenharmony_ci                              "Vulkan spec allows BuiltIn FragStencilRefEXT to "
4129fd4e5da5Sopenharmony_ci                              "be used only with Fragment execution model."))));
4130fd4e5da5Sopenharmony_ci
4131fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4132fd4e5da5Sopenharmony_ci    FragStencilRefInvalidStorageClass,
4133fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4134fd4e5da5Sopenharmony_ci    Combine(Values("FragStencilRefEXT"), Values("Fragment"), Values("Input"),
4135fd4e5da5Sopenharmony_ci            Values("%u32", "%u64"), Values("OpCapability StencilExportEXT\n"),
4136fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_shader_stencil_export\"\n"),
4137fd4e5da5Sopenharmony_ci            Values("VUID-FragStencilRefEXT-FragStencilRefEXT-04224"),
4138fd4e5da5Sopenharmony_ci            Values(TestResult(
4139fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4140fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn FragStencilRefEXT to be only used "
4141fd4e5da5Sopenharmony_ci                "for variables with Output storage class."))));
4142fd4e5da5Sopenharmony_ci
4143fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4144fd4e5da5Sopenharmony_ci    FragStencilRefInvalidType,
4145fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4146fd4e5da5Sopenharmony_ci    Combine(Values("FragStencilRefEXT"), Values("Fragment"), Values("Output"),
4147fd4e5da5Sopenharmony_ci            Values("%f32", "%f64", "%u32vec2"),
4148fd4e5da5Sopenharmony_ci            Values("OpCapability StencilExportEXT\n"),
4149fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_shader_stencil_export\"\n"),
4150fd4e5da5Sopenharmony_ci            Values("VUID-FragStencilRefEXT-FragStencilRefEXT-04225"),
4151fd4e5da5Sopenharmony_ci            Values(TestResult(
4152fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4153fd4e5da5Sopenharmony_ci                "According to the Vulkan spec BuiltIn FragStencilRefEXT "
4154fd4e5da5Sopenharmony_ci                "variable needs to be a int scalar."))));
4155fd4e5da5Sopenharmony_ci
4156fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4157fd4e5da5Sopenharmony_ci    FullyCoveredEXTInputSuccess,
4158fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4159fd4e5da5Sopenharmony_ci    Combine(Values("FullyCoveredEXT"), Values("Fragment"), Values("Input"),
4160fd4e5da5Sopenharmony_ci            Values("%bool"), Values("OpCapability FragmentFullyCoveredEXT\n"),
4161fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_fully_covered\"\n"),
4162fd4e5da5Sopenharmony_ci            Values(nullptr), Values(TestResult())));
4163fd4e5da5Sopenharmony_ci
4164fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4165fd4e5da5Sopenharmony_ci    FullyCoveredEXTInvalidExecutionModel,
4166fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4167fd4e5da5Sopenharmony_ci    Combine(Values("FullyCoveredEXT"), Values("Vertex"), Values("Input"),
4168fd4e5da5Sopenharmony_ci            Values("%bool"), Values("OpCapability FragmentFullyCoveredEXT\n"),
4169fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_fully_covered\"\n"),
4170fd4e5da5Sopenharmony_ci            Values("VUID-FullyCoveredEXT-FullyCoveredEXT-04232"),
4171fd4e5da5Sopenharmony_ci            Values(TestResult(SPV_ERROR_INVALID_DATA,
4172fd4e5da5Sopenharmony_ci                              "Vulkan spec allows BuiltIn FullyCoveredEXT to "
4173fd4e5da5Sopenharmony_ci                              "be used only with Fragment execution model."))));
4174fd4e5da5Sopenharmony_ci
4175fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4176fd4e5da5Sopenharmony_ci    FullyCoveredEXTInvalidStorageClass,
4177fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4178fd4e5da5Sopenharmony_ci    Combine(Values("FullyCoveredEXT"), Values("Fragment"), Values("Output"),
4179fd4e5da5Sopenharmony_ci            Values("%bool"), Values("OpCapability FragmentFullyCoveredEXT\n"),
4180fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_fully_covered\"\n"),
4181fd4e5da5Sopenharmony_ci            Values("VUID-FullyCoveredEXT-FullyCoveredEXT-04233"),
4182fd4e5da5Sopenharmony_ci            Values(TestResult(
4183fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4184fd4e5da5Sopenharmony_ci                "Vulkan spec allows BuiltIn FullyCoveredEXT to be only used "
4185fd4e5da5Sopenharmony_ci                "for variables with Input storage class."))));
4186fd4e5da5Sopenharmony_ci
4187fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4188fd4e5da5Sopenharmony_ci    FullyCoveredEXTInvalidType,
4189fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4190fd4e5da5Sopenharmony_ci    Combine(Values("FullyCoveredEXT"), Values("Fragment"), Values("Input"),
4191fd4e5da5Sopenharmony_ci            Values("%f32"), Values("OpCapability FragmentFullyCoveredEXT\n"),
4192fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_EXT_fragment_fully_covered\"\n"),
4193fd4e5da5Sopenharmony_ci            Values("VUID-FullyCoveredEXT-FullyCoveredEXT-04234"),
4194fd4e5da5Sopenharmony_ci            Values(TestResult(
4195fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA,
4196fd4e5da5Sopenharmony_ci                "According to the Vulkan spec BuiltIn FullyCoveredEXT variable "
4197fd4e5da5Sopenharmony_ci                "needs to be a bool scalar."))));
4198fd4e5da5Sopenharmony_ci
4199fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4200fd4e5da5Sopenharmony_ci    BaryCoordNotFragment,
4201fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4202fd4e5da5Sopenharmony_ci    Combine(
4203fd4e5da5Sopenharmony_ci        Values("BaryCoordKHR", "BaryCoordNoPerspKHR"), Values("Vertex"),
4204fd4e5da5Sopenharmony_ci        Values("Input"), Values("%f32vec3"),
4205fd4e5da5Sopenharmony_ci        Values("OpCapability FragmentBarycentricKHR\n"),
4206fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shader_barycentric\"\n"),
4207fd4e5da5Sopenharmony_ci        Values("VUID-BaryCoordKHR-BaryCoordKHR-04154 "
4208fd4e5da5Sopenharmony_ci               "VUID-BaryCoordNoPerspKHR-BaryCoordNoPerspKHR-04160 "),
4209fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows BuiltIn",
4210fd4e5da5Sopenharmony_ci                          "to be used only with Fragment execution model"))));
4211fd4e5da5Sopenharmony_ci
4212fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4213fd4e5da5Sopenharmony_ci    BaryCoordNotInput,
4214fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4215fd4e5da5Sopenharmony_ci    Combine(Values("BaryCoordKHR", "BaryCoordNoPerspKHR"), Values("Fragment"),
4216fd4e5da5Sopenharmony_ci            Values("Output"), Values("%f32vec3"),
4217fd4e5da5Sopenharmony_ci            Values("OpCapability FragmentBarycentricKHR\n"),
4218fd4e5da5Sopenharmony_ci            Values("OpExtension \"SPV_KHR_fragment_shader_barycentric\"\n"),
4219fd4e5da5Sopenharmony_ci            Values("VUID-BaryCoordKHR-BaryCoordKHR-04155 "
4220fd4e5da5Sopenharmony_ci                   "VUID-BaryCoordNoPerspKHR-BaryCoordNoPerspKHR-04161 "),
4221fd4e5da5Sopenharmony_ci            Values(TestResult(
4222fd4e5da5Sopenharmony_ci                SPV_ERROR_INVALID_DATA, "Vulkan spec allows BuiltIn",
4223fd4e5da5Sopenharmony_ci                "to be only used for variables with Input storage class"))));
4224fd4e5da5Sopenharmony_ci
4225fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4226fd4e5da5Sopenharmony_ci    BaryCoordNotFloatVector,
4227fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4228fd4e5da5Sopenharmony_ci    Combine(
4229fd4e5da5Sopenharmony_ci        Values("BaryCoordKHR", "BaryCoordNoPerspKHR"), Values("Fragment"),
4230fd4e5da5Sopenharmony_ci        Values("Output"), Values("%f32arr3", "%u32vec4"),
4231fd4e5da5Sopenharmony_ci        Values("OpCapability FragmentBarycentricKHR\n"),
4232fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shader_barycentric\"\n"),
4233fd4e5da5Sopenharmony_ci        Values("VUID-BaryCoordKHR-BaryCoordKHR-04156 "
4234fd4e5da5Sopenharmony_ci               "VUID-BaryCoordNoPerspKHR-BaryCoordNoPerspKHR-04162 "),
4235fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
4236fd4e5da5Sopenharmony_ci                          "needs to be a 3-component 32-bit float vector"))));
4237fd4e5da5Sopenharmony_ci
4238fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4239fd4e5da5Sopenharmony_ci    BaryCoordNotFloatVec3,
4240fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4241fd4e5da5Sopenharmony_ci    Combine(
4242fd4e5da5Sopenharmony_ci        Values("BaryCoordKHR", "BaryCoordNoPerspKHR"), Values("Fragment"),
4243fd4e5da5Sopenharmony_ci        Values("Output"), Values("%f32vec2"),
4244fd4e5da5Sopenharmony_ci        Values("OpCapability FragmentBarycentricKHR\n"),
4245fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shader_barycentric\"\n"),
4246fd4e5da5Sopenharmony_ci        Values("VUID-BaryCoordKHR-BaryCoordKHR-04156 "
4247fd4e5da5Sopenharmony_ci               "VUID-BaryCoordNoPerspKHR-BaryCoordNoPerspKHR-04162 "),
4248fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
4249fd4e5da5Sopenharmony_ci                          "needs to be a 3-component 32-bit float vector"))));
4250fd4e5da5Sopenharmony_ci
4251fd4e5da5Sopenharmony_ciINSTANTIATE_TEST_SUITE_P(
4252fd4e5da5Sopenharmony_ci    BaryCoordNotF32Vec3,
4253fd4e5da5Sopenharmony_ci    ValidateVulkanCombineBuiltInExecutionModelDataTypeCapabilityExtensionResult,
4254fd4e5da5Sopenharmony_ci    Combine(
4255fd4e5da5Sopenharmony_ci        Values("BaryCoordKHR", "BaryCoordNoPerspKHR"), Values("Fragment"),
4256fd4e5da5Sopenharmony_ci        Values("Output"), Values("%f64vec3"),
4257fd4e5da5Sopenharmony_ci        Values("OpCapability FragmentBarycentricKHR\n"),
4258fd4e5da5Sopenharmony_ci        Values("OpExtension \"SPV_KHR_fragment_shader_barycentric\"\n"),
4259fd4e5da5Sopenharmony_ci        Values("VUID-BaryCoordKHR-BaryCoordKHR-04156 "
4260fd4e5da5Sopenharmony_ci               "VUID-BaryCoordNoPerspKHR-BaryCoordNoPerspKHR-04162 "),
4261fd4e5da5Sopenharmony_ci        Values(TestResult(SPV_ERROR_INVALID_DATA,
4262fd4e5da5Sopenharmony_ci                          "needs to be a 3-component 32-bit float vector"))));
4263fd4e5da5Sopenharmony_ci
4264fd4e5da5Sopenharmony_ci}  // namespace
4265fd4e5da5Sopenharmony_ci}  // namespace val
4266fd4e5da5Sopenharmony_ci}  // namespace spvtools
4267