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));
+ _mesa_copy_instructions (&fpi[i], prog->Instructions, prog->NumInstructions);
free(prog->Instructions);
#endif
}
- _mesa_memcpy(&vpi[i], prog->Instructions, prog->NumInstructions * sizeof(struct prog_instruction));
+ _mesa_copy_instructions (&vpi[i], prog->Instructions, prog->NumInstructions);
free(prog->Instructions);
vpi = _mesa_alloc_instructions (prog->NumInstructions + 2);
_mesa_init_instructions (vpi, prog->NumInstructions + 2);
/* all but END */
- _mesa_memcpy(vpi, prog->Instructions, (prog->NumInstructions - 1) * sizeof(struct prog_instruction));
+ _mesa_copy_instructions (vpi, prog->Instructions, prog->NumInstructions - 1);
/* END */
- _mesa_memcpy(&vpi[prog->NumInstructions + 1], &prog->Instructions[prog->NumInstructions - 1],
- sizeof(struct prog_instruction));
+ _mesa_copy_instructions (&vpi[prog->NumInstructions + 1],
+ &prog->Instructions[prog->NumInstructions - 1],
+ 1);
vpi_insert = &vpi[prog->NumInstructions - 1];
vpi_insert[i].Opcode = OPCODE_MOV;
return newInst;
}
+/**
+ * Copy an narray of program instructions.
+ * \param dest pointer to destination.
+ * \param src pointer to source.
+ * \param n number of instructions to copy.
+ * \return pointer to destination.
+ */
+struct prog_instruction *
+_mesa_copy_instructions(struct prog_instruction *dest,
+ const struct prog_instruction *src, GLuint n)
+{
+ return _mesa_memcpy (dest, src, n * sizeof (struct prog_instruction));
+}
+
/**
* Basic info about each instruction
_mesa_realloc_instructions(struct prog_instruction *oldInst,
GLuint numOldInst, GLuint numNewInst);
+extern struct prog_instruction *
+_mesa_copy_instructions(struct prog_instruction *dest,
+ const struct prog_instruction *src, GLuint n);
/**
* Used for describing GL state referenced from inside ARB vertex and