1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2013 Intel Corporation 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21bf215546Sopenharmony_ci * DEALINGS IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci#include <gtest/gtest.h> 24bf215546Sopenharmony_ci#include "standalone_scaffolding.h" 25bf215546Sopenharmony_ci#include "util/compiler.h" 26bf215546Sopenharmony_ci#include "main/mtypes.h" 27bf215546Sopenharmony_ci#include "main/macros.h" 28bf215546Sopenharmony_ci#include "ir.h" 29bf215546Sopenharmony_ci#include "glsl_parser_extras.h" 30bf215546Sopenharmony_ci#include "glsl_symbol_table.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ciclass common_builtin : public ::testing::Test { 33bf215546Sopenharmony_cipublic: 34bf215546Sopenharmony_ci common_builtin(GLenum shader_type) 35bf215546Sopenharmony_ci : shader_type(shader_type) 36bf215546Sopenharmony_ci { 37bf215546Sopenharmony_ci /* empty */ 38bf215546Sopenharmony_ci } 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_ci virtual void SetUp(); 41bf215546Sopenharmony_ci virtual void TearDown(); 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci void string_starts_with_prefix(const char *str, const char *prefix); 44bf215546Sopenharmony_ci void names_start_with_gl(); 45bf215546Sopenharmony_ci void uniforms_and_system_values_dont_have_explicit_location(); 46bf215546Sopenharmony_ci void constants_are_constant(); 47bf215546Sopenharmony_ci void no_invalid_variable_modes(); 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ci GLenum shader_type; 50bf215546Sopenharmony_ci struct _mesa_glsl_parse_state *state; 51bf215546Sopenharmony_ci struct gl_shader *shader; 52bf215546Sopenharmony_ci void *mem_ctx; 53bf215546Sopenharmony_ci gl_context ctx; 54bf215546Sopenharmony_ci exec_list ir; 55bf215546Sopenharmony_ci}; 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_civoid 58bf215546Sopenharmony_cicommon_builtin::SetUp() 59bf215546Sopenharmony_ci{ 60bf215546Sopenharmony_ci glsl_type_singleton_init_or_ref(); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci this->mem_ctx = ralloc_context(NULL); 63bf215546Sopenharmony_ci this->ir.make_empty(); 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci initialize_context_to_defaults(&this->ctx, API_OPENGL_COMPAT); 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci this->shader = rzalloc(this->mem_ctx, gl_shader); 68bf215546Sopenharmony_ci this->shader->Type = this->shader_type; 69bf215546Sopenharmony_ci this->shader->Stage = _mesa_shader_enum_to_shader_stage(this->shader_type); 70bf215546Sopenharmony_ci 71bf215546Sopenharmony_ci this->state = 72bf215546Sopenharmony_ci new(mem_ctx) _mesa_glsl_parse_state(&this->ctx, this->shader->Stage, 73bf215546Sopenharmony_ci this->shader); 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_ci _mesa_glsl_initialize_types(this->state); 76bf215546Sopenharmony_ci _mesa_glsl_initialize_variables(&this->ir, this->state); 77bf215546Sopenharmony_ci} 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_civoid 80bf215546Sopenharmony_cicommon_builtin::TearDown() 81bf215546Sopenharmony_ci{ 82bf215546Sopenharmony_ci ralloc_free(this->mem_ctx); 83bf215546Sopenharmony_ci this->mem_ctx = NULL; 84bf215546Sopenharmony_ci 85bf215546Sopenharmony_ci glsl_type_singleton_decref(); 86bf215546Sopenharmony_ci} 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_civoid 89bf215546Sopenharmony_cicommon_builtin::string_starts_with_prefix(const char *str, const char *prefix) 90bf215546Sopenharmony_ci{ 91bf215546Sopenharmony_ci const size_t len = strlen(prefix); 92bf215546Sopenharmony_ci char *const name_prefix = new char[len + 1]; 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ci strncpy(name_prefix, str, len); 95bf215546Sopenharmony_ci name_prefix[len] = '\0'; 96bf215546Sopenharmony_ci EXPECT_STREQ(prefix, name_prefix) << "Bad name " << str; 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci delete [] name_prefix; 99bf215546Sopenharmony_ci} 100bf215546Sopenharmony_ci 101bf215546Sopenharmony_civoid 102bf215546Sopenharmony_cicommon_builtin::names_start_with_gl() 103bf215546Sopenharmony_ci{ 104bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 105bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 106bf215546Sopenharmony_ci 107bf215546Sopenharmony_ci string_starts_with_prefix(var->name, "gl_"); 108bf215546Sopenharmony_ci } 109bf215546Sopenharmony_ci} 110bf215546Sopenharmony_ci 111bf215546Sopenharmony_civoid 112bf215546Sopenharmony_cicommon_builtin::uniforms_and_system_values_dont_have_explicit_location() 113bf215546Sopenharmony_ci{ 114bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 115bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci if (var->data.mode != ir_var_uniform && var->data.mode != ir_var_system_value) 118bf215546Sopenharmony_ci continue; 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_ci EXPECT_FALSE(var->data.explicit_location); 121bf215546Sopenharmony_ci EXPECT_EQ(-1, var->data.location); 122bf215546Sopenharmony_ci } 123bf215546Sopenharmony_ci} 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_civoid 126bf215546Sopenharmony_cicommon_builtin::constants_are_constant() 127bf215546Sopenharmony_ci{ 128bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 129bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 130bf215546Sopenharmony_ci 131bf215546Sopenharmony_ci if (var->data.mode != ir_var_auto) 132bf215546Sopenharmony_ci continue; 133bf215546Sopenharmony_ci 134bf215546Sopenharmony_ci EXPECT_FALSE(var->data.explicit_location); 135bf215546Sopenharmony_ci EXPECT_EQ(-1, var->data.location); 136bf215546Sopenharmony_ci EXPECT_TRUE(var->data.read_only); 137bf215546Sopenharmony_ci } 138bf215546Sopenharmony_ci} 139bf215546Sopenharmony_ci 140bf215546Sopenharmony_civoid 141bf215546Sopenharmony_cicommon_builtin::no_invalid_variable_modes() 142bf215546Sopenharmony_ci{ 143bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 144bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 145bf215546Sopenharmony_ci 146bf215546Sopenharmony_ci switch (var->data.mode) { 147bf215546Sopenharmony_ci case ir_var_auto: 148bf215546Sopenharmony_ci case ir_var_uniform: 149bf215546Sopenharmony_ci case ir_var_shader_in: 150bf215546Sopenharmony_ci case ir_var_shader_out: 151bf215546Sopenharmony_ci case ir_var_system_value: 152bf215546Sopenharmony_ci break; 153bf215546Sopenharmony_ci 154bf215546Sopenharmony_ci default: 155bf215546Sopenharmony_ci ADD_FAILURE() << "Built-in variable " << var->name 156bf215546Sopenharmony_ci << " has an invalid mode " << int(var->data.mode); 157bf215546Sopenharmony_ci break; 158bf215546Sopenharmony_ci } 159bf215546Sopenharmony_ci } 160bf215546Sopenharmony_ci} 161bf215546Sopenharmony_ci 162bf215546Sopenharmony_ci/************************************************************/ 163bf215546Sopenharmony_ci 164bf215546Sopenharmony_ciclass vertex_builtin : public common_builtin { 165bf215546Sopenharmony_cipublic: 166bf215546Sopenharmony_ci vertex_builtin() 167bf215546Sopenharmony_ci : common_builtin(GL_VERTEX_SHADER) 168bf215546Sopenharmony_ci { 169bf215546Sopenharmony_ci /* empty */ 170bf215546Sopenharmony_ci } 171bf215546Sopenharmony_ci}; 172bf215546Sopenharmony_ci 173bf215546Sopenharmony_ciTEST_F(vertex_builtin, names_start_with_gl) 174bf215546Sopenharmony_ci{ 175bf215546Sopenharmony_ci common_builtin::names_start_with_gl(); 176bf215546Sopenharmony_ci} 177bf215546Sopenharmony_ci 178bf215546Sopenharmony_ciTEST_F(vertex_builtin, inputs_have_explicit_location) 179bf215546Sopenharmony_ci{ 180bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 181bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci if (var->data.mode != ir_var_shader_in) 184bf215546Sopenharmony_ci continue; 185bf215546Sopenharmony_ci 186bf215546Sopenharmony_ci EXPECT_TRUE(var->data.explicit_location); 187bf215546Sopenharmony_ci EXPECT_NE(-1, var->data.location); 188bf215546Sopenharmony_ci EXPECT_GT(VERT_ATTRIB_GENERIC0, var->data.location); 189bf215546Sopenharmony_ci EXPECT_EQ(0u, var->data.location_frac); 190bf215546Sopenharmony_ci } 191bf215546Sopenharmony_ci} 192bf215546Sopenharmony_ci 193bf215546Sopenharmony_ciTEST_F(vertex_builtin, outputs_have_explicit_location) 194bf215546Sopenharmony_ci{ 195bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 196bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 197bf215546Sopenharmony_ci 198bf215546Sopenharmony_ci if (var->data.mode != ir_var_shader_out) 199bf215546Sopenharmony_ci continue; 200bf215546Sopenharmony_ci 201bf215546Sopenharmony_ci EXPECT_TRUE(var->data.explicit_location); 202bf215546Sopenharmony_ci EXPECT_NE(-1, var->data.location); 203bf215546Sopenharmony_ci EXPECT_GT(VARYING_SLOT_VAR0, var->data.location); 204bf215546Sopenharmony_ci EXPECT_EQ(0u, var->data.location_frac); 205bf215546Sopenharmony_ci 206bf215546Sopenharmony_ci /* Several varyings only exist in the fragment shader. Be sure that no 207bf215546Sopenharmony_ci * outputs with these locations exist. 208bf215546Sopenharmony_ci */ 209bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_PNTC, var->data.location); 210bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_FACE, var->data.location); 211bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_PRIMITIVE_ID, var->data.location); 212bf215546Sopenharmony_ci } 213bf215546Sopenharmony_ci} 214bf215546Sopenharmony_ci 215bf215546Sopenharmony_ciTEST_F(vertex_builtin, uniforms_and_system_values_dont_have_explicit_location) 216bf215546Sopenharmony_ci{ 217bf215546Sopenharmony_ci common_builtin::uniforms_and_system_values_dont_have_explicit_location(); 218bf215546Sopenharmony_ci} 219bf215546Sopenharmony_ci 220bf215546Sopenharmony_ciTEST_F(vertex_builtin, constants_are_constant) 221bf215546Sopenharmony_ci{ 222bf215546Sopenharmony_ci common_builtin::constants_are_constant(); 223bf215546Sopenharmony_ci} 224bf215546Sopenharmony_ci 225bf215546Sopenharmony_ciTEST_F(vertex_builtin, no_invalid_variable_modes) 226bf215546Sopenharmony_ci{ 227bf215546Sopenharmony_ci common_builtin::no_invalid_variable_modes(); 228bf215546Sopenharmony_ci} 229bf215546Sopenharmony_ci 230bf215546Sopenharmony_ci/********************************************************************/ 231bf215546Sopenharmony_ci 232bf215546Sopenharmony_ciclass fragment_builtin : public common_builtin { 233bf215546Sopenharmony_cipublic: 234bf215546Sopenharmony_ci fragment_builtin() 235bf215546Sopenharmony_ci : common_builtin(GL_FRAGMENT_SHADER) 236bf215546Sopenharmony_ci { 237bf215546Sopenharmony_ci /* empty */ 238bf215546Sopenharmony_ci } 239bf215546Sopenharmony_ci}; 240bf215546Sopenharmony_ci 241bf215546Sopenharmony_ciTEST_F(fragment_builtin, names_start_with_gl) 242bf215546Sopenharmony_ci{ 243bf215546Sopenharmony_ci common_builtin::names_start_with_gl(); 244bf215546Sopenharmony_ci} 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ciTEST_F(fragment_builtin, inputs_have_explicit_location) 247bf215546Sopenharmony_ci{ 248bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 249bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 250bf215546Sopenharmony_ci 251bf215546Sopenharmony_ci if (var->data.mode != ir_var_shader_in) 252bf215546Sopenharmony_ci continue; 253bf215546Sopenharmony_ci 254bf215546Sopenharmony_ci EXPECT_TRUE(var->data.explicit_location); 255bf215546Sopenharmony_ci EXPECT_NE(-1, var->data.location); 256bf215546Sopenharmony_ci EXPECT_GT(VARYING_SLOT_VAR0, var->data.location); 257bf215546Sopenharmony_ci EXPECT_EQ(0u, var->data.location_frac); 258bf215546Sopenharmony_ci 259bf215546Sopenharmony_ci /* Several varyings only exist in the vertex / geometry shader. Be sure 260bf215546Sopenharmony_ci * that no inputs with these locations exist. 261bf215546Sopenharmony_ci */ 262bf215546Sopenharmony_ci EXPECT_TRUE(_mesa_varying_slot_in_fs((gl_varying_slot) var->data.location)); 263bf215546Sopenharmony_ci } 264bf215546Sopenharmony_ci} 265bf215546Sopenharmony_ci 266bf215546Sopenharmony_ciTEST_F(fragment_builtin, outputs_have_explicit_location) 267bf215546Sopenharmony_ci{ 268bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 269bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 270bf215546Sopenharmony_ci 271bf215546Sopenharmony_ci if (var->data.mode != ir_var_shader_out) 272bf215546Sopenharmony_ci continue; 273bf215546Sopenharmony_ci 274bf215546Sopenharmony_ci EXPECT_TRUE(var->data.explicit_location); 275bf215546Sopenharmony_ci EXPECT_NE(-1, var->data.location); 276bf215546Sopenharmony_ci 277bf215546Sopenharmony_ci /* gl_FragData[] has location FRAG_RESULT_DATA0. Locations beyond that 278bf215546Sopenharmony_ci * are invalid. 279bf215546Sopenharmony_ci */ 280bf215546Sopenharmony_ci EXPECT_GE(FRAG_RESULT_DATA0, var->data.location); 281bf215546Sopenharmony_ci 282bf215546Sopenharmony_ci EXPECT_EQ(0u, var->data.location_frac); 283bf215546Sopenharmony_ci } 284bf215546Sopenharmony_ci} 285bf215546Sopenharmony_ci 286bf215546Sopenharmony_ciTEST_F(fragment_builtin, uniforms_and_system_values_dont_have_explicit_location) 287bf215546Sopenharmony_ci{ 288bf215546Sopenharmony_ci common_builtin::uniforms_and_system_values_dont_have_explicit_location(); 289bf215546Sopenharmony_ci} 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ciTEST_F(fragment_builtin, constants_are_constant) 292bf215546Sopenharmony_ci{ 293bf215546Sopenharmony_ci common_builtin::constants_are_constant(); 294bf215546Sopenharmony_ci} 295bf215546Sopenharmony_ci 296bf215546Sopenharmony_ciTEST_F(fragment_builtin, no_invalid_variable_modes) 297bf215546Sopenharmony_ci{ 298bf215546Sopenharmony_ci common_builtin::no_invalid_variable_modes(); 299bf215546Sopenharmony_ci} 300bf215546Sopenharmony_ci 301bf215546Sopenharmony_ci/********************************************************************/ 302bf215546Sopenharmony_ci 303bf215546Sopenharmony_ciclass geometry_builtin : public common_builtin { 304bf215546Sopenharmony_cipublic: 305bf215546Sopenharmony_ci geometry_builtin() 306bf215546Sopenharmony_ci : common_builtin(GL_GEOMETRY_SHADER) 307bf215546Sopenharmony_ci { 308bf215546Sopenharmony_ci /* empty */ 309bf215546Sopenharmony_ci } 310bf215546Sopenharmony_ci}; 311bf215546Sopenharmony_ci 312bf215546Sopenharmony_ciTEST_F(geometry_builtin, names_start_with_gl) 313bf215546Sopenharmony_ci{ 314bf215546Sopenharmony_ci common_builtin::names_start_with_gl(); 315bf215546Sopenharmony_ci} 316bf215546Sopenharmony_ci 317bf215546Sopenharmony_ciTEST_F(geometry_builtin, inputs_have_explicit_location) 318bf215546Sopenharmony_ci{ 319bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 320bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 321bf215546Sopenharmony_ci 322bf215546Sopenharmony_ci if (var->data.mode != ir_var_shader_in) 323bf215546Sopenharmony_ci continue; 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_ci if (var->is_interface_instance()) { 326bf215546Sopenharmony_ci EXPECT_STREQ("gl_in", var->name); 327bf215546Sopenharmony_ci EXPECT_FALSE(var->data.explicit_location); 328bf215546Sopenharmony_ci EXPECT_EQ(-1, var->data.location); 329bf215546Sopenharmony_ci 330bf215546Sopenharmony_ci ASSERT_TRUE(var->type->is_array()); 331bf215546Sopenharmony_ci 332bf215546Sopenharmony_ci const glsl_type *const instance_type = var->type->fields.array; 333bf215546Sopenharmony_ci 334bf215546Sopenharmony_ci for (unsigned i = 0; i < instance_type->length; i++) { 335bf215546Sopenharmony_ci const glsl_struct_field *const input = 336bf215546Sopenharmony_ci &instance_type->fields.structure[i]; 337bf215546Sopenharmony_ci 338bf215546Sopenharmony_ci string_starts_with_prefix(input->name, "gl_"); 339bf215546Sopenharmony_ci EXPECT_NE(-1, input->location); 340bf215546Sopenharmony_ci EXPECT_GT(VARYING_SLOT_VAR0, input->location); 341bf215546Sopenharmony_ci 342bf215546Sopenharmony_ci /* Several varyings only exist in the fragment shader. Be sure 343bf215546Sopenharmony_ci * that no inputs with these locations exist. 344bf215546Sopenharmony_ci */ 345bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_PNTC, input->location); 346bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_FACE, input->location); 347bf215546Sopenharmony_ci } 348bf215546Sopenharmony_ci } else { 349bf215546Sopenharmony_ci EXPECT_TRUE(var->data.explicit_location); 350bf215546Sopenharmony_ci EXPECT_NE(-1, var->data.location); 351bf215546Sopenharmony_ci EXPECT_GT(VARYING_SLOT_VAR0, var->data.location); 352bf215546Sopenharmony_ci EXPECT_EQ(0u, var->data.location_frac); 353bf215546Sopenharmony_ci } 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci /* Several varyings only exist in the fragment shader. Be sure that no 356bf215546Sopenharmony_ci * inputs with these locations exist. 357bf215546Sopenharmony_ci */ 358bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_PNTC, var->data.location); 359bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_FACE, var->data.location); 360bf215546Sopenharmony_ci } 361bf215546Sopenharmony_ci} 362bf215546Sopenharmony_ci 363bf215546Sopenharmony_ciTEST_F(geometry_builtin, outputs_have_explicit_location) 364bf215546Sopenharmony_ci{ 365bf215546Sopenharmony_ci foreach_in_list(ir_instruction, node, &this->ir) { 366bf215546Sopenharmony_ci ir_variable *const var = node->as_variable(); 367bf215546Sopenharmony_ci 368bf215546Sopenharmony_ci if (var->data.mode != ir_var_shader_out) 369bf215546Sopenharmony_ci continue; 370bf215546Sopenharmony_ci 371bf215546Sopenharmony_ci EXPECT_TRUE(var->data.explicit_location); 372bf215546Sopenharmony_ci EXPECT_NE(-1, var->data.location); 373bf215546Sopenharmony_ci EXPECT_GT(VARYING_SLOT_VAR0, var->data.location); 374bf215546Sopenharmony_ci EXPECT_EQ(0u, var->data.location_frac); 375bf215546Sopenharmony_ci 376bf215546Sopenharmony_ci /* Several varyings only exist in the fragment shader. Be sure that no 377bf215546Sopenharmony_ci * outputs with these locations exist. 378bf215546Sopenharmony_ci */ 379bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_PNTC, var->data.location); 380bf215546Sopenharmony_ci EXPECT_NE(VARYING_SLOT_FACE, var->data.location); 381bf215546Sopenharmony_ci } 382bf215546Sopenharmony_ci} 383bf215546Sopenharmony_ci 384bf215546Sopenharmony_ciTEST_F(geometry_builtin, uniforms_and_system_values_dont_have_explicit_location) 385bf215546Sopenharmony_ci{ 386bf215546Sopenharmony_ci common_builtin::uniforms_and_system_values_dont_have_explicit_location(); 387bf215546Sopenharmony_ci} 388bf215546Sopenharmony_ci 389bf215546Sopenharmony_ciTEST_F(geometry_builtin, constants_are_constant) 390bf215546Sopenharmony_ci{ 391bf215546Sopenharmony_ci common_builtin::constants_are_constant(); 392bf215546Sopenharmony_ci} 393bf215546Sopenharmony_ci 394bf215546Sopenharmony_ciTEST_F(geometry_builtin, no_invalid_variable_modes) 395bf215546Sopenharmony_ci{ 396bf215546Sopenharmony_ci common_builtin::no_invalid_variable_modes(); 397bf215546Sopenharmony_ci} 398