mesa: Branch 'master'

Oliver McFadden z3ro at kemper.freedesktop.org
Thu Mar 15 20:56:27 UTC 2007


 src/mesa/drivers/dri/r300/r300_fragprog.c |    2 +-
 src/mesa/drivers/dri/r300/r300_vertprog.c |    9 +++++----
 src/mesa/shader/program.c                 |   14 ++++++++++++++
 src/mesa/shader/program.h                 |    3 +++
 4 files changed, 23 insertions(+), 5 deletions(-)

New commits:
diff-tree 0c25d9ab198f79afee23ec1bf8ac61c4cd801d3a (from 1195caa2745de4d16ddbd46eeb4f527a78c5eb63)
Author: Oliver McFadden <z3ro.geek at gmail.com>
Date:   Thu Mar 15 20:55:30 2007 +0000

    r300: Added _mesa_copy_instructions.

diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index e05abdb..251fd26 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -1853,7 +1853,7 @@ static void insert_wpos(struct gl_progra
 	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);
 
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 0c43270..092ebb1 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -946,7 +946,7 @@ static void position_invariant(struct gl
 #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);
 
@@ -969,10 +969,11 @@ static void insert_wpos(struct r300_vert
 	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;
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 490f919..3d5f648 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -1480,6 +1480,20 @@ _mesa_realloc_instructions(struct prog_i
    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
diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h
index 5b5d134..6f5013d 100644
--- a/src/mesa/shader/program.h
+++ b/src/mesa/shader/program.h
@@ -128,6 +128,9 @@ extern struct prog_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



More information about the mesa-commit mailing list