length(0)
{
init_ralloc_type_ctx();
+ assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
/* Neither dimension is zero or both dimensions are zero.
*/
length(0)
{
init_ralloc_type_ctx();
+ assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
memset(& fields, 0, sizeof(fields));
}
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
const char *name) :
+ gl_type(0),
base_type(GLSL_TYPE_STRUCT),
sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
sampler_type(0), interface_packing(0),
unsigned int i;
init_ralloc_type_ctx();
+ assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
this->fields.structure = ralloc_array(this->mem_ctx,
glsl_struct_field, length);
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
enum glsl_interface_packing packing, const char *name) :
+ gl_type(0),
base_type(GLSL_TYPE_INTERFACE),
sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
sampler_type(0), interface_packing((unsigned) packing),
unsigned int i;
init_ralloc_type_ctx();
+ assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
this->fields.structure = ralloc_array(this->mem_ctx,
glsl_struct_field, length);
}
}
+
+bool
+glsl_type::contains_integer() const
+{
+ if (this->is_array()) {
+ return this->fields.array->contains_integer();
+ } else if (this->is_record()) {
+ for (unsigned int i = 0; i < this->length; i++) {
+ if (this->fields.structure[i].type->contains_integer())
+ return true;
+ }
+ return false;
+ } else {
+ return this->is_integer();
+ }
+}
+
+
gl_texture_index
glsl_type::sampler_index() const
{
return TEXTURE_BUFFER_INDEX;
case GLSL_SAMPLER_DIM_EXTERNAL:
return TEXTURE_EXTERNAL_INDEX;
+ case GLSL_SAMPLER_DIM_MS:
+ return (t->sampler_array) ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX : TEXTURE_2D_MULTISAMPLE_INDEX;
default:
assert(!"Should not get here.");
return TEXTURE_BUFFER_INDEX;
}
+void
+glsl_type::generate_150_types(glsl_symbol_table *symtab)
+{
+ generate_140_types(symtab);
+ generate_ARB_texture_multisample_types(symtab, false);
+}
+
+
void
glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
bool warn)
warn, skip_1d);
}
+void
+glsl_type::generate_ARB_texture_multisample_types(glsl_symbol_table *symtab,
+ bool warn)
+{
+ bool skip_1d = false;
+ add_types_to_symbol_table(symtab, builtin_ARB_texture_multisample_types,
+ Elements(builtin_ARB_texture_multisample_types),
+ warn, skip_1d);
+}
+
void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
{
case 140:
glsl_type::generate_140_types(state->symbols);
break;
+ case 150:
+ glsl_type::generate_150_types(state->symbols);
+ break;
default:
assert(!"Unexpected language version");
break;
glsl_type::generate_ARB_texture_cube_map_array_types(state->symbols,
state->ARB_texture_cube_map_array_warn);
}
+
+ if (state->ARB_texture_multisample_enable) {
+ glsl_type::generate_ARB_texture_multisample_types(state->symbols,
+ state->ARB_texture_multisample_warn);
+ }
}
return int_type;
case GLSL_TYPE_FLOAT:
return float_type;
+ case GLSL_TYPE_BOOL:
+ return bool_type;
default:
/* Handle everything else */
return type;