From d8c4763fb0d7d880342fcb2cfa619b17cbaabf6a Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 9 Apr 2014 04:42:26 +0300 Subject: More stack cleanup on GPU_buffers --- source/blender/gpu/intern/gpu_buffers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index dc986badb16..1eddd90a902 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -71,9 +71,6 @@ typedef enum { #define MAX_GPU_ATTRIB_DATA 32 -/* material number is an 16-bit signed short and the range (assume material number is non-negative) */ -#define MAX_MATERIALS MAXMAT - /* -1 - undefined, 0 - vertex arrays, 1 - VBOs */ static int useVBOs = -1; static GPUBufferState GLStates = 0; @@ -565,7 +562,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, GPUBufferPool *pool; GPUBuffer *buffer; float *varray; - int mat_orig_to_new[MAX_MATERIALS]; + int *mat_orig_to_new; int *cur_index_per_mat; int i; int success; @@ -585,6 +582,8 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, return NULL; } + mat_orig_to_new = MEM_mallocN(sizeof(*mat_orig_to_new) * dm->totmat, + "GPU_buffer_setup.mat_orig_to_new"); cur_index_per_mat = MEM_mallocN(sizeof(int) * object->totmaterial, "GPU_buffer_setup.cur_index_per_mat"); for (i = 0; i < object->totmaterial; i++) { @@ -657,6 +656,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, } MEM_freeN(cur_index_per_mat); + MEM_freeN(mat_orig_to_new); BLI_mutex_unlock(&buffer_mutex); -- cgit v1.2.3