if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition)
var->data.origin_upper_left = b->origin_upper_left;
- b->builtins[dec->literals[0]] = var;
+ if (mode == nir_var_shader_out)
+ b->builtins[dec->literals[0]].out = var;
+ else
+ b->builtins[dec->literals[0]].in = var;
break;
}
case SpvDecorationRowMajor:
const struct glsl_type *type,
SpvBuiltIn builtin)
{
- nir_variable *var = b->builtins[builtin];
+ nir_variable *var;
+ if (mode == nir_var_shader_out)
+ var = b->builtins[builtin].out;
+ else
+ var = b->builtins[builtin].in;
if (!var) {
int location;
if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition)
var->data.origin_upper_left = b->origin_upper_left;
- b->builtins[builtin] = var;
+ if (mode == nir_var_shader_out)
+ b->builtins[builtin].out = var;
+ else
+ b->builtins[builtin].in = var;
}
return var;
/*
* NIR variable for each SPIR-V builtin.
*/
- nir_variable *builtins[42]; /* XXX need symbolic constant from SPIR-V header */
+ struct {
+ nir_variable *in;
+ nir_variable *out;
+ } builtins[42]; /* XXX need symbolic constant from SPIR-V header */
unsigned value_id_bound;
struct vtn_value *values;