MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / TEST_P

Function TEST_P

test/val/val_function_test.cpp:165–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165TEST_P(ValidateFunctionCall, VariableNoVariablePointers) {
166 const std::string storage_class = GetParam();
167
168 std::string spirv = GenerateShader(storage_class, "", "");
169
170 const std::vector<std::string> valid_storage_classes = {
171 "UniformConstant", "Function", "Private", "Workgroup", "AtomicCounter"};
172 bool valid =
173 std::find(valid_storage_classes.begin(), valid_storage_classes.end(),
174 storage_class) != valid_storage_classes.end();
175
176 CompileSuccessfully(spirv);
177 if (valid) {
178 EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
179 } else {
180 EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions());
181 if (storage_class == "StorageBuffer") {
182 EXPECT_THAT(
183 getDiagnosticString(),
184 HasSubstr("StorageBuffer pointer operand '1[%var]' requires a "
185 "variable pointers capability"));
186 } else {
187 EXPECT_THAT(
188 getDiagnosticString(),
189 HasSubstr("Invalid storage class for pointer operand '1[%var]'"));
190 }
191 }
192}
193
194TEST_P(ValidateFunctionCall, VariableVariablePointersStorageClass) {
195 const std::string storage_class = GetParam();

Callers

nothing calls this directly

Calls 6

GenerateShaderFunction · 0.85
findFunction · 0.85
GenerateShaderParameterFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected