}
const glsl_type *
-glsl_get_array_instance(const glsl_type *type,
- unsigned array_size)
+glsl_get_struct_field(const glsl_type *type, unsigned index)
{
- return glsl_type::get_array_instance(type, array_size);
+ return type->fields.structure[index].type;
}
-const glsl_type *
-glsl_get_struct_field(const glsl_type *type, unsigned index)
+const int
+glsl_get_struct_field_offset(const struct glsl_type *type,
+ unsigned index)
{
- return type->fields.structure[index].type;
+ return type->fields.structure[index].offset;
}
const glsl_type *
return type->sampler_index();
}
+int
+glsl_get_sampler_coordinate_components(const struct glsl_type *type)
+{
+ assert(glsl_type_is_sampler(type) || glsl_type_is_image(type));
+ return type->coordinate_components();
+}
+
unsigned
glsl_get_record_location_offset(const struct glsl_type *type,
unsigned length)
{
return type->is_boolean();
}
+bool
+glsl_type_is_integer(const struct glsl_type *type)
+{
+ return type->is_integer();
+}
const glsl_type *
glsl_void_type(void)
unsigned *size, unsigned *align)
{
switch (type->base_type) {
+ case GLSL_TYPE_BOOL:
+ /* We special-case Booleans to 32 bits to not cause heartburn for
+ * drivers that suddenly get an 8-bit load.
+ */
+ *size = 4 * type->components();
+ *align = 4;
+ break;
+
case GLSL_TYPE_UINT8:
case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_FLOAT:
- case GLSL_TYPE_BOOL:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64: {