glsl_to_tgsi: Delete unused function set_uniform_initializer

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2014-08-01 18:50:07 -07:00
parent 8f81f4e185
commit e0c867372a
@@ -3229,78 +3229,6 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
_mesa_update_shader_textures_used(v->shader_program, prog);
}
static void
set_uniform_initializer(struct gl_context *ctx, void *mem_ctx,
struct gl_shader_program *shader_program,
const char *name, const glsl_type *type,
ir_constant *val)
{
if (type->is_record()) {
ir_constant *field_constant;
field_constant = (ir_constant *)val->components.get_head();
for (unsigned int i = 0; i < type->length; i++) {
const glsl_type *field_type = type->fields.structure[i].type;
const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name,
type->fields.structure[i].name);
set_uniform_initializer(ctx, mem_ctx, shader_program, field_name,
field_type, field_constant);
field_constant = (ir_constant *)field_constant->next;
}
return;
}
unsigned offset;
unsigned index = _mesa_get_uniform_location(ctx, shader_program, name,
&offset);
if (offset == GL_INVALID_INDEX) {
fail_link(shader_program,
"Couldn't find uniform for initializer %s\n", name);
return;
}
int loc = _mesa_uniform_merge_location_offset(shader_program, index, offset);
for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) {
ir_constant *element;
const glsl_type *element_type;
if (type->is_array()) {
element = val->array_elements[i];
element_type = type->fields.array;
} else {
element = val;
element_type = type;
}
void *values;
if (element_type->base_type == GLSL_TYPE_BOOL) {
int *conv = ralloc_array(mem_ctx, int, element_type->components());
for (unsigned int j = 0; j < element_type->components(); j++) {
conv[j] = element->value.b[j];
}
values = (void *)conv;
element_type = glsl_type::get_instance(GLSL_TYPE_INT,
element_type->vector_elements,
1);
} else {
values = &element->value;
}
if (element_type->is_matrix()) {
_mesa_uniform_matrix(ctx, shader_program,
element_type->matrix_columns,
element_type->vector_elements,
loc, 1, GL_FALSE, (GLfloat *)values);
} else {
_mesa_uniform(ctx, shader_program, loc, element_type->matrix_columns,
values, element_type->gl_type);
}
loc++;
}
}
/**
* Returns the mask of channels (bitmask of WRITEMASK_X,Y,Z,W) which
* are read from the given src in this instruction