/* should do something else if no temps left... */
prog->NumTemporaries++;
-
- fpi = malloc((prog->NumInstructions + 3) * sizeof(struct prog_instruction));
- /* all including END */
- memcpy(&fpi[3], prog->Instructions, prog->NumInstructions * sizeof(struct prog_instruction));
-
- memset(fpi, 0, 3 * sizeof(struct prog_instruction));
+ fpi = _mesa_alloc_instructions (prog->NumInstructions + 3);
+ _mesa_init_instructions (fpi, prog->NumInstructions + 3);
/* perspective divide */
fpi[i].Opcode = OPCODE_RCP;
fpi[i].SrcReg[2].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO);
i++;
+ _mesa_memcpy(&fpi[i], prog->Instructions, prog->NumInstructions * sizeof(struct prog_instruction));
+
free(prog->Instructions);
prog->Instructions = fpi;
#endif
paramList = prog->Parameters;
- vpi = malloc((prog->NumInstructions + 4) * sizeof(struct prog_instruction));
- memset(vpi, 0, 4 * sizeof(struct prog_instruction));
+ vpi = _mesa_alloc_instructions (prog->NumInstructions + 4);
+ _mesa_init_instructions (vpi, prog->NumInstructions + 4);
for (i=0; i < 4; i++) {
GLint idx;
#endif
}
- memcpy(&vpi[i], prog->Instructions, prog->NumInstructions * sizeof(struct prog_instruction));
+ _mesa_memcpy(&vpi[i], prog->Instructions, prog->NumInstructions * sizeof(struct prog_instruction));
free(prog->Instructions);
struct prog_instruction *vpi_insert;
int i = 0;
- vpi = malloc((prog->NumInstructions + 2) * sizeof(struct prog_instruction));
+ vpi = _mesa_alloc_instructions (prog->NumInstructions + 2);
+ _mesa_init_instructions (vpi, prog->NumInstructions + 2);
/* all but END */
- memcpy(vpi, prog->Instructions, (prog->NumInstructions - 1) * sizeof(struct prog_instruction));
+ _mesa_memcpy(vpi, prog->Instructions, (prog->NumInstructions - 1) * sizeof(struct prog_instruction));
/* END */
- memcpy(&vpi[prog->NumInstructions + 1], &prog->Instructions[prog->NumInstructions - 1],
+ _mesa_memcpy(&vpi[prog->NumInstructions + 1], &prog->Instructions[prog->NumInstructions - 1],
sizeof(struct prog_instruction));
-
vpi_insert = &vpi[prog->NumInstructions - 1];
- memset(vpi_insert, 0, 2 * sizeof(struct prog_instruction));
vpi_insert[i].Opcode = OPCODE_MOV;