Not used in GL but 8 and 16 component vectors exist in OpenCL.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
DECL_TYPE(stype, etype ##__VA_ARGS__, btype, 1, 1) \
DECL_TYPE(vtype ## 2, etype ##_VEC2 ##__VA_ARGS__, btype, 2, 1) \
DECL_TYPE(vtype ## 3, etype ##_VEC3 ##__VA_ARGS__, btype, 3, 1) \
- DECL_TYPE(vtype ## 4, etype ##_VEC4 ##__VA_ARGS__, btype, 4, 1)
+ DECL_TYPE(vtype ## 4, etype ##_VEC4 ##__VA_ARGS__, btype, 4, 1) \
+ DECL_TYPE(vtype ## 8, 0, btype, 8, 1) \
+ DECL_TYPE(vtype ## 16, 0, btype, 16, 1)
DECL_VEC_TYPE(bool, bvec, GLSL_TYPE_BOOL, GL_BOOL)
DECL_VEC_TYPE(int, ivec, GLSL_TYPE_INT, GL_INT)
{
unsigned n = components;
- if (n == 0 || n > 4)
+ if (components == 8)
+ n = 5;
+ else if (components == 16)
+ n = 6;
+
+ if (n == 0 || n > 6)
return error_type;
return ts[n - 1];
static const glsl_type *const ts[] = { \
sname ## _type, vname ## 2_type, \
vname ## 3_type, vname ## 4_type, \
+ vname ## 8_type, vname ## 16_type, \
}; \
glsl_type::vec(components, ts); \
})
fprintf(fp, "r%u", reg->index);
}
-static const char *sizes[] = { "error", "vec1", "vec2", "vec3", "vec4" };
+static const char *sizes[] = { "error", "vec1", "vec2", "vec3", "vec4",
+ "error", "error", "error", "vec8",
+ "error", "error", "error", "vec16"};
static void
print_register_decl(nir_register *reg, print_state *state)
validate_assert(state, def->parent_instr == state->instr);
- validate_assert(state, def->num_components <= 4);
+ validate_assert(state, (def->num_components <= 4) ||
+ (def->num_components == 8) ||
+ (def->num_components == 16));
list_validate(&def->uses);
list_validate(&def->if_uses);
const glsl_type *
glsl_vector_type(enum glsl_base_type base_type, unsigned components)
{
- assert(components > 1 && components <= 4);
- return glsl_type::get_instance(base_type, components, 1);
+ const glsl_type *t = glsl_type::get_instance(base_type, components, 1);
+ assert(t != glsl_type::error_type);
+ return t;
}
const glsl_type *
glsl_matrix_type(enum glsl_base_type base_type, unsigned rows, unsigned columns)
{
- assert(rows > 1 && rows <= 4 && columns >= 1 && columns <= 4);
- return glsl_type::get_instance(base_type, rows, columns);
+ const glsl_type *t = glsl_type::get_instance(base_type, rows, columns);
+ assert(t != glsl_type::error_type);
+ return t;
}
const glsl_type *
case vtn_base_type_vector: {
uint32_t comp_size = glsl_get_bit_size(type->type) / 8;
- assert(type->length > 0 && type->length <= 4);
unsigned align_comps = type->length == 3 ? 4 : type->length;
*size_out = comp_size * type->length,
*align_out = comp_size * align_comps;
vtn_fail_if(base->base_type != vtn_base_type_scalar,
"Base type for OpTypeVector must be a scalar");
- vtn_fail_if(elems < 2 || elems > 4,
+ vtn_fail_if((elems < 2 || elems > 4) && (elems != 8) && (elems != 16),
"Invalid component count for OpTypeVector");
val->type->base_type = vtn_base_type_vector;