aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/shader/prog_parameter_layout.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
committermarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
commit29b86f9852b2b7ecc31cdfee56679537e40bc6e2 (patch)
tree1e6ec8ccf2dbf773260a1953b8e13c49f9b7c5f5 /mesalib/src/mesa/shader/prog_parameter_layout.c
parent529236591df7366479a6fac30b387667678fd1ba (diff)
downloadvcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.gz
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.bz2
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.zip
svn merge -r524:HEAD "^/branches/released" .
Diffstat (limited to 'mesalib/src/mesa/shader/prog_parameter_layout.c')
-rw-r--r--mesalib/src/mesa/shader/prog_parameter_layout.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/mesalib/src/mesa/shader/prog_parameter_layout.c b/mesalib/src/mesa/shader/prog_parameter_layout.c
index 1c37b3a7a..a88857383 100644
--- a/mesalib/src/mesa/shader/prog_parameter_layout.c
+++ b/mesalib/src/mesa/shader/prog_parameter_layout.c
@@ -72,14 +72,11 @@ copy_indirect_accessed_array(struct gl_program_parameter_list *src,
unsigned first, unsigned count)
{
const int base = dst->NumParameters;
- unsigned i;
- unsigned j;
-
+ unsigned i, j;
for (i = first; i < (first + count); i++) {
struct gl_program_parameter *curr = & src->Parameters[i];
-
if (curr->Type == PROGRAM_CONSTANT) {
j = dst->NumParameters;
} else {
@@ -93,10 +90,15 @@ copy_indirect_accessed_array(struct gl_program_parameter_list *src,
assert(j == dst->NumParameters);
+ /* copy src parameter [i] to dest parameter [j] */
memcpy(& dst->Parameters[j], curr,
sizeof(dst->Parameters[j]));
memcpy(dst->ParameterValues[j], src->ParameterValues[i],
sizeof(GLfloat) * 4);
+
+ /* Pointer to the string name was copied. Null-out src param name
+ * to prevent double free later.
+ */
curr->Name = NULL;
dst->NumParameters++;
@@ -117,11 +119,9 @@ _mesa_layout_parameters(struct asm_parser_state *state)
struct asm_instruction *inst;
unsigned i;
-
layout =
_mesa_new_parameter_list_sized(state->prog->Parameters->NumParameters);
-
/* PASS 1: Move any parameters that are accessed indirectly from the
* original parameter list to the new parameter list.
*/
@@ -155,7 +155,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
}
}
-
/* PASS 2: Move any parameters that are not accessed indirectly from the
* original parameter list to the new parameter list.
*/
@@ -165,7 +164,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
const int idx = inst->SrcReg[i].Base.Index;
unsigned swizzle = SWIZZLE_NOOP;
-
/* All relative addressed operands were processed on the first
* pass. Just skip them here.
*/
@@ -173,7 +171,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
continue;
}
-
if ((inst->SrcReg[i].Base.File <= PROGRAM_VARYING )
|| (inst->SrcReg[i].Base.File >= PROGRAM_WRITE_ONLY)) {
continue;
@@ -209,7 +206,6 @@ _mesa_layout_parameters(struct asm_parser_state *state)
}
}
-
_mesa_free_parameter_list(state->prog->Parameters);
state->prog->Parameters = layout;