ir_instruction *
assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
ir_rvalue *src, unsigned src_base, unsigned count,
- TALLOC_CTX *ctx)
+ void *mem_ctx)
{
const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 };
- ir_constant *col_idx = new(ctx) ir_constant(column);
- ir_rvalue *column_ref = new(ctx) ir_dereference_array(var, col_idx);
+ ir_constant *col_idx = new(mem_ctx) ir_constant(column);
+ ir_rvalue *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
assert(column_ref->type->components() >= (row_base + count));
- ir_rvalue *lhs = new(ctx) ir_swizzle(column_ref, &mask[row_base], count);
+ ir_rvalue *lhs = new(mem_ctx) ir_swizzle(column_ref, &mask[row_base], count);
assert(src->type->components() >= (src_base + count));
- ir_rvalue *rhs = new(ctx) ir_swizzle(src, &mask[src_base], count);
+ ir_rvalue *rhs = new(mem_ctx) ir_swizzle(src, &mask[src_base], count);
- return new(ctx) ir_assignment(lhs, rhs, NULL);
+ return new(mem_ctx) ir_assignment(lhs, rhs, NULL);
}
hash_table *glsl_type::array_types = NULL;
hash_table *glsl_type::record_types = NULL;
-void *glsl_type::ctx = NULL;
+void *glsl_type::mem_ctx = NULL;
void
glsl_type::init_talloc_type_ctx(void)
{
- if (glsl_type::ctx == NULL) {
- glsl_type::ctx = talloc_init("glsl_type");
- assert(glsl_type::ctx != NULL);
+ if (glsl_type::mem_ctx == NULL) {
+ glsl_type::mem_ctx = talloc_init("glsl_type");
+ assert(glsl_type::mem_ctx != NULL);
}
}
length(0)
{
init_talloc_type_ctx();
- this->name = talloc_strdup(this->ctx, name);
+ this->name = talloc_strdup(this->mem_ctx, name);
/* Neither dimension is zero or both dimensions are zero.
*/
assert((vector_elements == 0) == (matrix_columns == 0));
length(0)
{
init_talloc_type_ctx();
- this->name = talloc_strdup(this->ctx, name);
+ this->name = talloc_strdup(this->mem_ctx, name);
memset(& fields, 0, sizeof(fields));
}
unsigned int i;
init_talloc_type_ctx();
- this->name = talloc_strdup(this->ctx, name);
- this->fields.structure = talloc_array(this->ctx,
+ this->name = talloc_strdup(this->mem_ctx, name);
+ this->fields.structure = talloc_array(this->mem_ctx,
glsl_struct_field, length);
for (i = 0; i < length; i++) {
this->fields.structure[i].type = fields[i].type;
glsl_type::record_types = NULL;
}
- if (glsl_type::ctx != NULL) {
- talloc_free(glsl_type::ctx);
- glsl_type::ctx = NULL;
+ if (glsl_type::mem_ctx != NULL) {
+ talloc_free(glsl_type::mem_ctx);
+ glsl_type::mem_ctx = NULL;
}
}
* NUL.
*/
const unsigned name_length = strlen(array->name) + 10 + 3;
- char *const n = (char *) talloc_size(this->ctx, name_length);
+ char *const n = (char *) talloc_size(this->mem_ctx, name_length);
if (length == 0)
snprintf(n, name_length, "%s[]", array->name);
if (t == NULL) {
t = new glsl_type(base, array_size);
- hash_table_insert(array_types, (void *) t, talloc_strdup(ctx, key));
+ hash_table_insert(array_types, (void *) t, talloc_strdup(mem_ctx, key));
}
assert(t->base_type == GLSL_TYPE_ARRAY);
*/
/* Callers of this talloc-based new need not call delete. It's
- * easier to just talloc_free 'ctx' (or any of its ancestors). */
+ * easier to just talloc_free 'mem_ctx' (or any of its ancestors). */
static void* operator new(size_t size)
{
- if (glsl_type::ctx == NULL) {
- glsl_type::ctx = talloc_init("glsl_type");
- assert(glsl_type::ctx != NULL);
+ if (glsl_type::mem_ctx == NULL) {
+ glsl_type::mem_ctx = talloc_init("glsl_type");
+ assert(glsl_type::mem_ctx != NULL);
}
void *type;
- type = talloc_size(glsl_type::ctx, size);
+ type = talloc_size(glsl_type::mem_ctx, size);
assert(type != NULL);
return type;
*
* Set on the first call to \c glsl_type::new.
*/
- static TALLOC_CTX *ctx;
+ static void *mem_ctx;
void init_talloc_type_ctx(void);