aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_texcombine.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-05 17:44:57 +0200
committermarha <marha@users.sourceforge.net>2011-10-05 17:44:57 +0200
commit8af87a5b60e37ae84fdd759e2c1602be38be4905 (patch)
tree2e621c7fbdc4dfe9eb8d733af4cc232bc03643d4 /mesalib/src/mesa/swrast/s_texcombine.c
parent8238de0fe0c28bd54b3e6cdd1fc94513cf21d3cc (diff)
parentf7025b4baa1ba35ee796785641f04eac5bedb0a6 (diff)
downloadvcxsrv-8af87a5b60e37ae84fdd759e2c1602be38be4905.tar.gz
vcxsrv-8af87a5b60e37ae84fdd759e2c1602be38be4905.tar.bz2
vcxsrv-8af87a5b60e37ae84fdd759e2c1602be38be4905.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/glapi.h mesalib/src/mesa/main/syncobj.h xorg-server/dix/events.c xorg-server/dix/getevents.c xorg-server/include/misc.h
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) {