summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-06-08 21:57:45 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-06-08 21:57:45 +0000
commit9899f58c76d3eaab940b4e2e33d722ac4721ea13 (patch)
treedc458a3c756f3bbbb6d6b7ecd2f485407e6b7736 /src/mesa
parentdce3a91a8d755e394d80b6d594fb3114eed67e49 (diff)
Use ALIGN_MALLOC for parameter lists.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/program.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 1e2d34a307..0ccc741dd0 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -353,7 +353,8 @@ _mesa_free_parameter_list(struct program_parameter_list *paramList)
{
_mesa_free_parameters(paramList);
_mesa_free(paramList->Parameters);
- _mesa_free(paramList->ParameterValues);
+ if (paramList->ParameterValues)
+ ALIGN_FREE(paramList->ParameterValues);
_mesa_free(paramList);
}
@@ -385,18 +386,24 @@ add_parameter(struct program_parameter_list *paramList,
const GLuint n = paramList->NumParameters;
if (n == paramList->Size) {
+ GLfloat (*tmp)[4];
+
paramList->Size *= 2;
if (!paramList->Size)
- paramList->Size = 4;
+ paramList->Size = 8;
paramList->Parameters = (struct program_parameter *)
_mesa_realloc(paramList->Parameters,
n * sizeof(struct program_parameter),
paramList->Size * sizeof(struct program_parameter));
- paramList->ParameterValues = (GLfloat (*)[4])
- _mesa_realloc(paramList->ParameterValues,
- n * 4 * sizeof(GLfloat),
- paramList->Size * 4 * sizeof(GLfloat));
+
+ tmp = paramList->ParameterValues;
+ paramList->ParameterValues = ALIGN_MALLOC(paramList->Size * 4 * sizeof(GLfloat), 16);
+ if (tmp) {
+ _mesa_memcpy(paramList->ParameterValues, tmp,
+ n * 4 * sizeof(GLfloat));
+ ALIGN_FREE(tmp);
+ }
}
if (!paramList->Parameters ||