int swizzle[4];
int i;
- src.type = type->base_type;
+ src.type = glsl_version >= 130 ? type->base_type : GLSL_TYPE_FLOAT;
src.file = PROGRAM_TEMPORARY;
src.index = next_temp;
src.reladdr = NULL;
}
this->result = st_src_reg(entry->file, entry->index, var->type);
+ if (glsl_version <= 120)
+ this->result.type = GLSL_TYPE_FLOAT;
}
void
values = (gl_constant_value *) &ir->value.f[i * ir->type->vector_elements];
src = st_src_reg(PROGRAM_CONSTANT, -1, ir->type->base_type);
- src.index = _mesa_add_unnamed_constant(this->prog->Parameters,
- values,
- ir->type->vector_elements,
- &src.swizzle);
+ src.index = _mesa_add_typed_unnamed_constant(this->prog->Parameters,
+ values,
+ ir->type->vector_elements,
+ GL_FLOAT,
+ &src.swizzle);
emit(ir, TGSI_OPCODE_MOV, mat_column, src);
mat_column.index++;
if (target == GL_VERTEX_PROGRAM_ARB)
v->remove_output_reads(PROGRAM_VARYING);
- /* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
- v->copy_propagate();
-
- /* FIXME: These passes to optimize temporary registers don't work when there
+ /* Perform optimizations on the instructions in the glsl_to_tgsi_visitor.
+ * FIXME: These passes to optimize temporary registers don't work when there
* is indirect addressing of the temporary register space. We need proper
* array support so that we don't have to give up these passes in every
* shader that uses arrays.
*/
if (!v->indirect_addr_temps) {
+ v->copy_propagate();
v->merge_registers();
v->eliminate_dead_code();
v->renumber_registers();