glsl_type::init_ralloc_type_ctx(void)
{
if (glsl_type::mem_ctx == NULL) {
- glsl_type::mem_ctx = ralloc_autofree_context();
+ glsl_type::mem_ctx = ralloc_context(NULL);
assert(glsl_type::mem_ctx != NULL);
}
}
memset(& fields, 0, sizeof(fields));
- if (base_type == GLSL_TYPE_SAMPLER) {
+ if (is_sampler()) {
/* Samplers take no storage whatsoever. */
matrix_columns = vector_elements = 0;
} else {
glsl_struct_field, length);
for (i = 0; i < length; i++) {
- this->fields.structure[i].type = fields[i].type;
+ this->fields.structure[i] = fields[i];
this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
fields[i].name);
- this->fields.structure[i].location = fields[i].location;
- this->fields.structure[i].offset = fields[i].offset;
- this->fields.structure[i].interpolation = fields[i].interpolation;
- this->fields.structure[i].centroid = fields[i].centroid;
- this->fields.structure[i].sample = fields[i].sample;
- this->fields.structure[i].matrix_layout = fields[i].matrix_layout;
- this->fields.structure[i].patch = fields[i].patch;
- this->fields.structure[i].image_read_only = fields[i].image_read_only;
- this->fields.structure[i].image_write_only = fields[i].image_write_only;
- this->fields.structure[i].image_coherent = fields[i].image_coherent;
- this->fields.structure[i].image_volatile = fields[i].image_volatile;
- this->fields.structure[i].image_restrict = fields[i].image_restrict;
- this->fields.structure[i].precision = fields[i].precision;
- this->fields.structure[i].explicit_xfb_buffer =
- fields[i].explicit_xfb_buffer;
- this->fields.structure[i].xfb_buffer = fields[i].xfb_buffer;
- this->fields.structure[i].xfb_stride = fields[i].xfb_stride;
}
mtx_unlock(&glsl_type::mutex);
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);
+ this->fields.structure = rzalloc_array(this->mem_ctx,
+ glsl_struct_field, length);
for (i = 0; i < length; i++) {
- this->fields.structure[i].type = fields[i].type;
+ this->fields.structure[i] = fields[i];
this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
fields[i].name);
- this->fields.structure[i].location = fields[i].location;
- this->fields.structure[i].offset = fields[i].offset;
- this->fields.structure[i].interpolation = fields[i].interpolation;
- this->fields.structure[i].centroid = fields[i].centroid;
- this->fields.structure[i].sample = fields[i].sample;
- this->fields.structure[i].matrix_layout = fields[i].matrix_layout;
- this->fields.structure[i].patch = fields[i].patch;
- this->fields.structure[i].image_read_only = fields[i].image_read_only;
- this->fields.structure[i].image_write_only = fields[i].image_write_only;
- this->fields.structure[i].image_coherent = fields[i].image_coherent;
- this->fields.structure[i].image_volatile = fields[i].image_volatile;
- this->fields.structure[i].image_restrict = fields[i].image_restrict;
- this->fields.structure[i].precision = fields[i].precision;
- this->fields.structure[i].explicit_xfb_buffer =
- fields[i].explicit_xfb_buffer;
- this->fields.structure[i].xfb_buffer = fields[i].xfb_buffer;
- this->fields.structure[i].xfb_stride = fields[i].xfb_stride;
}
mtx_unlock(&glsl_type::mutex);
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:
return error_type;
}
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 */
return type;
_mesa_hash_table_destroy(glsl_type::interface_types, NULL);
glsl_type::interface_types = NULL;
}
+
+ ralloc_free(glsl_type::mem_ctx);
+ glsl_type::mem_ctx = NULL;
}
}
+const glsl_type *
+glsl_type::i64vec(unsigned components)
+{
+ if (components == 0 || components > 4)
+ return error_type;
+
+ static const glsl_type *const ts[] = {
+ int64_t_type, i64vec2_type, i64vec3_type, i64vec4_type
+ };
+ return ts[components - 1];
+}
+
+
+const glsl_type *
+glsl_type::u64vec(unsigned components)
+{
+ if (components == 0 || components > 4)
+ return error_type;
+
+ static const glsl_type *const ts[] = {
+ uint64_t_type, u64vec2_type, u64vec3_type, u64vec4_type
+ };
+ return ts[components - 1];
+}
+
const glsl_type *
glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns)
{
return dvec(rows);
case GLSL_TYPE_BOOL:
return bvec(rows);
+ case GLSL_TYPE_UINT64:
+ return u64vec(rows);
+ case GLSL_TYPE_INT64:
+ return i64vec(rows);
default:
return error_type;
}
else
return samplerExternalOES_type;
case GLSL_SAMPLER_DIM_SUBPASS:
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
return error_type;
}
case GLSL_TYPE_INT:
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
case GLSL_SAMPLER_DIM_SUBPASS:
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
return error_type;
}
case GLSL_TYPE_UINT:
case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
case GLSL_SAMPLER_DIM_SUBPASS:
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
return error_type;
}
default:
glsl_type::get_image_instance(enum glsl_sampler_dim dim,
bool array, glsl_base_type type)
{
- if (dim == GLSL_SAMPLER_DIM_SUBPASS)
- return subpassInput_type;
switch (type) {
case GLSL_TYPE_FLOAT:
switch (dim) {
return imageBuffer_type;
case GLSL_SAMPLER_DIM_MS:
return (array ? image2DMSArray_type : image2DMS_type);
- case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS:
+ return subpassInput_type;
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
+ return subpassInputMS_type;
+ case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
}
case GLSL_TYPE_INT:
return iimageBuffer_type;
case GLSL_SAMPLER_DIM_MS:
return (array ? iimage2DMSArray_type : iimage2DMS_type);
- case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS:
+ return isubpassInput_type;
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
+ return isubpassInputMS_type;
+ case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
}
case GLSL_TYPE_UINT:
return uimageBuffer_type;
case GLSL_SAMPLER_DIM_MS:
return (array ? uimage2DMSArray_type : uimage2DMS_type);
- case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS:
+ return usubpassInput_type;
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
+ return usubpassInputMS_type;
+ case GLSL_SAMPLER_DIM_EXTERNAL:
return error_type;
}
default:
return this->components();
case GLSL_TYPE_DOUBLE:
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
return 2 * this->components();
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_INT:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_DOUBLE:
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
case GLSL_TYPE_BOOL:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_BOOL:
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
return 1;
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_BOOL:
return this->matrix_columns;
case GLSL_TYPE_DOUBLE:
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
if (this->vector_elements > 2 && !is_vertex_input)
return this->matrix_columns * 2;
else
* cubemap faces.
*/
if (sampler_array &&
- !(base_type == GLSL_TYPE_IMAGE &&
- sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE))
+ !(is_image() && sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE))
size += 1;
return size;