*mode = nir_var_system_value;
}
-static void
-validate_per_vertex_mode(struct vtn_builder *b, nir_variable_mode mode)
-{
- switch (b->shader->stage) {
- case MESA_SHADER_VERTEX:
- assert(mode == nir_var_shader_out);
- break;
- case MESA_SHADER_GEOMETRY:
- assert(mode == nir_var_shader_out || mode == nir_var_shader_in);
- break;
- default:
- assert(!"Invalid shader stage");
- }
-}
-
static void
vtn_get_builtin_location(struct vtn_builder *b,
SpvBuiltIn builtin, int *location,
switch (builtin) {
case SpvBuiltInPosition:
*location = VARYING_SLOT_POS;
- validate_per_vertex_mode(b, *mode);
break;
case SpvBuiltInPointSize:
*location = VARYING_SLOT_PSIZ;
- validate_per_vertex_mode(b, *mode);
break;
case SpvBuiltInClipDistance:
*location = VARYING_SLOT_CLIP_DIST0; /* XXX CLIP_DIST1? */
- validate_per_vertex_mode(b, *mode);
break;
case SpvBuiltInCullDistance:
/* XXX figure this out */
unreachable("no tessellation support");
case SpvBuiltInFragCoord:
*location = VARYING_SLOT_POS;
- assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_in);
break;
case SpvBuiltInPointCoord:
*location = VARYING_SLOT_PNTC;
- assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_in);
break;
case SpvBuiltInFrontFacing:
*location = VARYING_SLOT_FACE;
- assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_in);
break;
case SpvBuiltInSampleId:
break;
case SpvBuiltInFragDepth:
*location = FRAG_RESULT_DEPTH;
- assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_out);
break;
case SpvBuiltInNumWorkgroups: