From f7025b4baa1ba35ee796785641f04eac5bedb0a6 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 5 Oct 2011 17:37:34 +0200 Subject: mkfontscale pixman xserver xtrans libX11 libXdmcp libxcb libXmu mesa git update 5 oct 2011 --- mesalib/src/mesa/swrast/s_texcombine.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'mesalib/src/mesa/swrast/s_texcombine.c') diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c index 80b9dff3c..c67c356c1 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.c +++ b/mesalib/src/mesa/swrast/s_texcombine.c @@ -45,7 +45,7 @@ typedef float (*float4_array)[4]; /** * Return array of texels for given unit. */ -static INLINE float4_array +static inline float4_array get_texel_array(SWcontext *swrast, GLuint unit) { #ifdef _OPENMP @@ -590,6 +590,26 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) float4_array primary_rgba; GLuint unit; + if (!swrast->TexelBuffer) { +#ifdef _OPENMP + const GLint maxThreads = omp_get_max_threads(); +#else + const GLint maxThreads = 1; +#endif + + /* TexelBuffer is also global and normally shared by all SWspan + * instances; when running with multiple threads, create one per + * thread. + */ + swrast->TexelBuffer = + (GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits * maxThreads * + MAX_WIDTH * 4 * sizeof(GLfloat)); + if (!swrast->TexelBuffer) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine"); + return; + } + } + primary_rgba = (float4_array) malloc(span->end * 4 * sizeof(GLfloat)); if (!primary_rgba) { -- cgit v1.2.3