diff options
author | Brian <brian@yutani.localnet.net> | 2007-03-21 11:57:30 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-03-21 11:57:30 -0600 |
commit | 23d31efc167f09d47635352f697ffcb087d3ebbd (patch) | |
tree | 782f5bdcda8a4374501cae05a94a024fe1c26777 /src/mesa/shader | |
parent | 180cc2f8458c13ce415f7cdf9a425ae59cb6ad8b (diff) | |
parent | 88db19a48412cbe89196b1cc06e8ecf8ccae78b0 (diff) | |
download | external_mesa3d-23d31efc167f09d47635352f697ffcb087d3ebbd.zip external_mesa3d-23d31efc167f09d47635352f697ffcb087d3ebbd.tar.gz external_mesa3d-23d31efc167f09d47635352f697ffcb087d3ebbd.tar.bz2 |
merge from master
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/nvvertparse.c | 8 | ||||
-rw-r--r-- | src/mesa/shader/prog_instruction.c | 14 | ||||
-rw-r--r-- | src/mesa/shader/prog_instruction.h | 4 | ||||
-rw-r--r-- | src/mesa/shader/programopt.c | 3 |
4 files changed, 23 insertions, 6 deletions
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index fb546a0..0bc0c05 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 c678313..ed479a7 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 14305f1..66abb10 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 2d14cd3..d427ee3 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); |