assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
- this->fields.structure = ralloc_array(this->mem_ctx,
- glsl_struct_field, length);
+ /* Zero-fill to prevent spurious Valgrind errors when serializing NIR
+ * due to uninitialized unused bits in bit fields. */
+ this->fields.structure = rzalloc_array(this->mem_ctx,
+ glsl_struct_field, length);
for (i = 0; i < length; i++) {
this->fields.structure[i] = fields[i];
return uint_type;
case GLSL_TYPE_UINT16:
return uint16_t_type;
+ case GLSL_TYPE_UINT8:
+ return uint8_t_type;
case GLSL_TYPE_INT:
return int_type;
case GLSL_TYPE_INT16:
return int16_t_type;
+ case GLSL_TYPE_INT8:
+ return int8_t_type;
case GLSL_TYPE_FLOAT:
return float_type;
case GLSL_TYPE_FLOAT16:
while (type->base_type == GLSL_TYPE_ARRAY)
type = type->fields.array;
- /* Handle vectors and matrices */
- switch (type->base_type) {
- case GLSL_TYPE_UINT:
- return uint_type;
- case GLSL_TYPE_UINT16:
- return uint16_t_type;
- case GLSL_TYPE_INT:
- return int_type;
- case GLSL_TYPE_INT16:
- return int16_t_type;
- case GLSL_TYPE_FLOAT:
- return float_type;
- case GLSL_TYPE_FLOAT16:
- return float16_t_type;
- case GLSL_TYPE_DOUBLE:
- return double_type;
- case GLSL_TYPE_BOOL:
- return bool_type;
- case GLSL_TYPE_UINT64:
- return uint64_t_type;
- case GLSL_TYPE_INT64:
- return int64_t_type;
- default:
- /* Handle everything else */
+ const glsl_type *scalar_type = type->get_base_type();
+ if (scalar_type == error_type)
return type;
- }
+
+ return scalar_type;
}
{
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];
}
-#define VECN(components, sname, vname) ({ \
- static const glsl_type *const ts[] = { \
- sname ## _type, vname ## 2_type, \
- vname ## 3_type, vname ## 4_type, \
- }; \
- glsl_type::vec(components, ts); \
- })
-
-const glsl_type *
-glsl_type::vec(unsigned components)
-{
- return VECN(components, float, vec);
-}
-
-const glsl_type *
-glsl_type::f16vec(unsigned components)
-{
- return VECN(components, float16_t, f16vec);
-}
-
-const glsl_type *
-glsl_type::dvec(unsigned components)
-{
- return VECN(components, double, dvec);
-}
-
-const glsl_type *
-glsl_type::ivec(unsigned components)
-{
- return VECN(components, int, ivec);
-}
-
-const glsl_type *
-glsl_type::uvec(unsigned components)
-{
- return VECN(components, uint, uvec);
-}
-
-const glsl_type *
-glsl_type::bvec(unsigned components)
-{
- return VECN(components, bool, bvec);
-}
-
-const glsl_type *
-glsl_type::i64vec(unsigned components)
-{
- return VECN(components, int64_t, i64vec);
-}
-
-
-const glsl_type *
-glsl_type::u64vec(unsigned components)
-{
- return VECN(components, uint64_t, u64vec);
-}
-
-const glsl_type *
-glsl_type::i16vec(unsigned components)
-{
- return VECN(components, int16_t, i16vec);
-}
-
-
-const glsl_type *
-glsl_type::u16vec(unsigned components)
-{
- return VECN(components, uint16_t, u16vec);
-}
-
-const glsl_type *
-glsl_type::i8vec(unsigned components)
-{
- return VECN(components, int8_t, i8vec);
-}
-
-
-const glsl_type *
-glsl_type::u8vec(unsigned components)
-{
- return VECN(components, uint8_t, u8vec);
-}
+#define VECN(components, sname, vname) \
+const glsl_type * \
+glsl_type:: vname (unsigned components) \
+{ \
+ static const glsl_type *const ts[] = { \
+ sname ## _type, vname ## 2_type, \
+ vname ## 3_type, vname ## 4_type, \
+ vname ## 8_type, vname ## 16_type, \
+ }; \
+ return glsl_type::vec(components, ts); \
+}
+
+VECN(components, float, vec)
+VECN(components, float16_t, f16vec)
+VECN(components, double, dvec)
+VECN(components, int, ivec)
+VECN(components, uint, uvec)
+VECN(components, bool, bvec)
+VECN(components, int64_t, i64vec)
+VECN(components, uint64_t, u64vec)
+VECN(components, int16_t, i16vec)
+VECN(components, uint16_t, u16vec)
+VECN(components, int8_t, i8vec)
+VECN(components, uint8_t, u8vec)
const glsl_type *
glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns)
case GLSL_TYPE_FLOAT16:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_BOOL:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_BOOL:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
return 1;