aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_texcombine.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
committermarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
commitf7025b4baa1ba35ee796785641f04eac5bedb0a6 (patch)
tree3df62b7b501a478e212397883657a8a8be4db7a3 /mesalib/src/mesa/swrast/s_texcombine.c
parent60adbfdea1ee754341d64454274e7aa83bae8971 (diff)
downloadvcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.gz
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.bz2
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.zip
mkfontscale pixman xserver xtrans libX11 libXdmcp libxcb libXmu mesa git update 5 oct 2011
Diffstat (limited to 'mesalib/src/mesa/swrast/s_texcombine.c')
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c22
1 files changed, 21 insertions, 1 deletions
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) {