From 32bf36106ea433038b524311fc10cc5b835862f1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 19 Feb 2012 20:08:52 -0700 Subject: swrast: remove MAX_WIDTH arrays in stencil code Use some per-context temporary arrays instead. --- src/mesa/swrast/s_context.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mesa/swrast/s_context.c') diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 2ebb649..49aa1d7 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -798,6 +798,19 @@ _swrast_CreateContext( struct gl_context *ctx ) ctx->swrast_context = swrast; + swrast->stencil_temp.buf1 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte)); + swrast->stencil_temp.buf2 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte)); + swrast->stencil_temp.buf3 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte)); + swrast->stencil_temp.buf4 = (GLubyte *) malloc(MAX_WIDTH * sizeof(GLubyte)); + + if (!swrast->stencil_temp.buf1 || + !swrast->stencil_temp.buf2 || + !swrast->stencil_temp.buf3 || + !swrast->stencil_temp.buf4) { + _swrast_DestroyContext(ctx); + return GL_FALSE; + } + return GL_TRUE; } @@ -814,6 +827,12 @@ _swrast_DestroyContext( struct gl_context *ctx ) if (swrast->ZoomedArrays) FREE( swrast->ZoomedArrays ); FREE( swrast->TexelBuffer ); + + free(swrast->stencil_temp.buf1); + free(swrast->stencil_temp.buf2); + free(swrast->stencil_temp.buf3); + free(swrast->stencil_temp.buf4); + FREE( swrast ); ctx->swrast_context = 0; -- cgit v1.1