summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-21 11:57:30 -0600
committerBrian <brian@yutani.localnet.net>2007-03-21 11:57:30 -0600
commit23d31efc167f09d47635352f697ffcb087d3ebbd (patch)
tree782f5bdcda8a4374501cae05a94a024fe1c26777 /src/mesa/shader
parent180cc2f8458c13ce415f7cdf9a425ae59cb6ad8b (diff)
parent88db19a48412cbe89196b1cc06e8ecf8ccae78b0 (diff)
merge from master
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/nvvertparse.c8
-rw-r--r--src/mesa/shader/prog_instruction.c14
-rw-r--r--src/mesa/shader/prog_instruction.h4
-rw-r--r--src/mesa/shader/programopt.c3
4 files changed, 23 insertions, 6 deletions
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index fb546a0217..0bc0c055da 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -684,13 +684,13 @@ Parse_SwizzleSrcReg(struct parse_state *parseState, struct prog_src_register *sr
if (token[1] == 0) {
/* single letter swizzle */
if (token[0] == 'x')
- srcReg->Swizzle = MAKE_SWIZZLE4(0, 0, 0, 0);
+ srcReg->Swizzle = SWIZZLE_XXXX;
else if (token[0] == 'y')
- srcReg->Swizzle = MAKE_SWIZZLE4(1, 1, 1, 1);
+ srcReg->Swizzle = SWIZZLE_YYYY;
else if (token[0] == 'z')
- srcReg->Swizzle = MAKE_SWIZZLE4(2, 2, 2, 2);
+ srcReg->Swizzle = SWIZZLE_ZZZZ;
else if (token[0] == 'w')
- srcReg->Swizzle = MAKE_SWIZZLE4(3, 3, 3, 3);
+ srcReg->Swizzle = SWIZZLE_WWWW;
else
RETURN_ERROR1("Expected x, y, z, or w");
}
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index c67831385f..ed479a7f61 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -97,6 +97,20 @@ _mesa_realloc_instructions(struct prog_instruction *oldInst,
}
+/**
+ * Copy an array 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/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index 14305f17d3..66abb10cdb 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -432,6 +432,10 @@ 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);
+
extern GLuint
_mesa_num_inst_src_regs(gl_inst_opcode opcode);
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index 2d14cd3855..d427ee38f8 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -99,8 +99,7 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
}
/* Append original instructions after new instructions */
- _mesa_memcpy(newInst + 4, vprog->Base.Instructions,
- origLen * sizeof(struct prog_instruction));
+ _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
/* free old instructions */
_mesa_free(vprog->Base.Instructions);