]> git.pld-linux.org Git - packages/Mesa.git/blob - Mesa-git.patch
- up to 7.4.2
[packages/Mesa.git] / Mesa-git.patch
1 diff --git a/configs/darwin b/configs/darwin
2 index 77edf1a..f061500 100644
3 --- a/configs/darwin
4 +++ b/configs/darwin
5 @@ -6,6 +6,8 @@ CONFIG_NAME = darwin
6  
7  INSTALL_DIR = /usr/X11
8  
9 +X11_DIR = $(INSTALL_DIR)
10 +
11  # Compiler and flags
12  CC = gcc
13  CXX = gcc
14 @@ -21,9 +23,9 @@ DEFINES =  -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \
15  ARCH_FLAGS += $(RC_CFLAGS)
16  
17  CFLAGS =  -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing \
18 -       -I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
19 +       -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
20  CXXFLAGS =  -ggdb3 -Os -Wall -fno-strict-aliasing \
21 -       -I$(INSTALL_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
22 +       -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
23  
24  # Library names (actual file names)
25  GL_LIB_NAME = libGL.dylib
26 @@ -39,12 +41,12 @@ GLUT_LIB_GLOB = libglut.*dylib
27  GLW_LIB_GLOB = libGLw.*dylib
28  OSMESA_LIB_GLOB = libOSMesa.*dylib
29  
30 -GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
31 +GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
32  OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
33  GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
34 -GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB)  -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
35 -GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXt
36 -APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
37 +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB)  -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
38 +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
39 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
40  
41  # omit glw lib for now:
42  SRC_DIRS = glx/x11 mesa glu glut/glx
43 diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
44 index 08d52ae..aea117e 100644
45 --- a/src/glx/x11/indirect.c
46 +++ b/src/glx/x11/indirect.c
47 @@ -5198,9 +5198,13 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
48  {
49      __GLXcontext *const gc = __glXGetCurrentContext();
50  
51 +#ifdef GLX_DIRECT_RENDERING
52      if (gc->driContext) {
53          CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
54      } else {
55 +#else
56 +    {
57 +#endif
58          __GLXcontext *const gc = __glXGetCurrentContext();
59          Display *const dpy = gc->currentDpy;
60          const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
61 @@ -5266,9 +5270,13 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)
62  {
63      __GLXcontext *const gc = __glXGetCurrentContext();
64  
65 +#ifdef GLX_DIRECT_RENDERING    
66      if (gc->driContext) {
67          CALL_GenTextures(GET_DISPATCH(), (n, textures));
68      } else {
69 +#else 
70 +    {
71 +#endif
72          __GLXcontext *const gc = __glXGetCurrentContext();
73          Display *const dpy = gc->currentDpy;
74          const GLuint cmdlen = 4;
75 @@ -5328,9 +5336,13 @@ glIsTextureEXT(GLuint texture)
76  {
77      __GLXcontext *const gc = __glXGetCurrentContext();
78  
79 +#ifdef GLX_DIRECT_RENDERING    
80      if (gc->driContext) {
81          return CALL_IsTexture(GET_DISPATCH(), (texture));
82      } else {
83 +#else 
84 +    {
85 +#endif
86          __GLXcontext *const gc = __glXGetCurrentContext();
87          Display *const dpy = gc->currentDpy;
88          GLboolean retval = (GLboolean) 0;
89 @@ -5641,9 +5653,13 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
90  {
91      __GLXcontext *const gc = __glXGetCurrentContext();
92  
93 +#ifdef GLX_DIRECT_RENDERING    
94      if (gc->driContext) {
95          CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
96      } else {
97 +#else 
98 +    {
99 +#endif
100          __GLXcontext *const gc = __glXGetCurrentContext();
101          const __GLXattribute *const state = gc->client_state_private;
102          Display *const dpy = gc->currentDpy;
103 @@ -5714,10 +5730,14 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
104  {
105      __GLXcontext *const gc = __glXGetCurrentContext();
106  
107 +#ifdef GLX_DIRECT_RENDERING    
108      if (gc->driContext) {
109          CALL_GetColorTableParameterfv(GET_DISPATCH(),
110                                        (target, pname, params));
111      } else {
112 +#else 
113 +    {
114 +#endif
115          __GLXcontext *const gc = __glXGetCurrentContext();
116          Display *const dpy = gc->currentDpy;
117          const GLuint cmdlen = 8;
118 @@ -5784,10 +5804,14 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
119  {
120      __GLXcontext *const gc = __glXGetCurrentContext();
121  
122 +#ifdef GLX_DIRECT_RENDERING    
123      if (gc->driContext) {
124          CALL_GetColorTableParameteriv(GET_DISPATCH(),
125                                        (target, pname, params));
126      } else {
127 +#else 
128 +    {
129 +#endif
130          __GLXcontext *const gc = __glXGetCurrentContext();
131          Display *const dpy = gc->currentDpy;
132          const GLuint cmdlen = 8;
133 @@ -6107,10 +6131,14 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
134  {
135      __GLXcontext *const gc = __glXGetCurrentContext();
136  
137 +#ifdef GLX_DIRECT_RENDERING    
138      if (gc->driContext) {
139          CALL_GetConvolutionFilter(GET_DISPATCH(),
140                                    (target, format, type, image));
141      } else {
142 +#else 
143 +    {
144 +#endif
145          __GLXcontext *const gc = __glXGetCurrentContext();
146          const __GLXattribute *const state = gc->client_state_private;
147          Display *const dpy = gc->currentDpy;
148 @@ -6182,10 +6210,14 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
149  {
150      __GLXcontext *const gc = __glXGetCurrentContext();
151  
152 +#ifdef GLX_DIRECT_RENDERING    
153      if (gc->driContext) {
154          CALL_GetConvolutionParameterfv(GET_DISPATCH(),
155                                         (target, pname, params));
156      } else {
157 +#else 
158 +    {
159 +#endif
160          __GLXcontext *const gc = __glXGetCurrentContext();
161          Display *const dpy = gc->currentDpy;
162          const GLuint cmdlen = 8;
163 @@ -6252,10 +6284,14 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
164  {
165      __GLXcontext *const gc = __glXGetCurrentContext();
166  
167 +#ifdef GLX_DIRECT_RENDERING    
168      if (gc->driContext) {
169          CALL_GetConvolutionParameteriv(GET_DISPATCH(),
170                                         (target, pname, params));
171      } else {
172 +#else 
173 +    {
174 +#endif
175          __GLXcontext *const gc = __glXGetCurrentContext();
176          Display *const dpy = gc->currentDpy;
177          const GLuint cmdlen = 8;
178 @@ -6329,10 +6365,14 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
179  {
180      __GLXcontext *const gc = __glXGetCurrentContext();
181  
182 +#ifdef GLX_DIRECT_RENDERING    
183      if (gc->driContext) {
184          CALL_GetHistogram(GET_DISPATCH(),
185                            (target, reset, format, type, values));
186      } else {
187 +#else 
188 +    {
189 +#endif
190          __GLXcontext *const gc = __glXGetCurrentContext();
191          const __GLXattribute *const state = gc->client_state_private;
192          Display *const dpy = gc->currentDpy;
193 @@ -6403,9 +6443,13 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
194  {
195      __GLXcontext *const gc = __glXGetCurrentContext();
196  
197 +#ifdef GLX_DIRECT_RENDERING    
198      if (gc->driContext) {
199          CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
200      } else {
201 +#else 
202 +    {
203 +#endif
204          __GLXcontext *const gc = __glXGetCurrentContext();
205          Display *const dpy = gc->currentDpy;
206          const GLuint cmdlen = 8;
207 @@ -6471,9 +6515,13 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
208  {
209      __GLXcontext *const gc = __glXGetCurrentContext();
210  
211 +#ifdef GLX_DIRECT_RENDERING    
212      if (gc->driContext) {
213          CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
214      } else {
215 +#else 
216 +    {
217 +#endif
218          __GLXcontext *const gc = __glXGetCurrentContext();
219          Display *const dpy = gc->currentDpy;
220          const GLuint cmdlen = 8;
221 @@ -6543,9 +6591,13 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
222  {
223      __GLXcontext *const gc = __glXGetCurrentContext();
224  
225 +#ifdef GLX_DIRECT_RENDERING    
226      if (gc->driContext) {
227          CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
228      } else {
229 +#else 
230 +    {
231 +#endif
232          __GLXcontext *const gc = __glXGetCurrentContext();
233          const __GLXattribute *const state = gc->client_state_private;
234          Display *const dpy = gc->currentDpy;
235 @@ -6614,9 +6666,13 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
236  {
237      __GLXcontext *const gc = __glXGetCurrentContext();
238  
239 +#ifdef GLX_DIRECT_RENDERING    
240      if (gc->driContext) {
241          CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
242      } else {
243 +#else 
244 +    {
245 +#endif
246          __GLXcontext *const gc = __glXGetCurrentContext();
247          Display *const dpy = gc->currentDpy;
248          const GLuint cmdlen = 8;
249 @@ -6679,9 +6735,13 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
250  {
251      __GLXcontext *const gc = __glXGetCurrentContext();
252  
253 +#ifdef GLX_DIRECT_RENDERING    
254      if (gc->driContext) {
255          CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
256      } else {
257 +#else 
258 +    {
259 +#endif
260          __GLXcontext *const gc = __glXGetCurrentContext();
261          Display *const dpy = gc->currentDpy;
262          const GLuint cmdlen = 8;
263 diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
264 index ac97bc1..cb837de 100644
265 --- a/src/mesa/main/drawpix.c
266 +++ b/src/mesa/main/drawpix.c
267 @@ -77,28 +77,30 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
268     }
269  
270     if (ctx->RenderMode == GL_RENDER) {
271 -      /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
272 -      GLint x = IROUND(ctx->Current.RasterPos[0]);
273 -      GLint y = IROUND(ctx->Current.RasterPos[1]);
274 -
275 -      if (ctx->Unpack.BufferObj->Name) {
276 -         /* unpack from PBO */
277 -         if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
278 -                                        format, type, pixels)) {
279 -            _mesa_error(ctx, GL_INVALID_OPERATION,
280 -                        "glDrawPixels(invalid PBO access)");
281 -            return;
282 +      if (width > 0 && height > 0) {
283 +         /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
284 +         GLint x = IROUND(ctx->Current.RasterPos[0]);
285 +         GLint y = IROUND(ctx->Current.RasterPos[1]);
286 +
287 +         if (ctx->Unpack.BufferObj->Name) {
288 +            /* unpack from PBO */
289 +            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
290 +                                           format, type, pixels)) {
291 +               _mesa_error(ctx, GL_INVALID_OPERATION,
292 +                           "glDrawPixels(invalid PBO access)");
293 +               return;
294 +            }
295 +            if (ctx->Unpack.BufferObj->Pointer) {
296 +               /* buffer is mapped - that's an error */
297 +               _mesa_error(ctx, GL_INVALID_OPERATION,
298 +                           "glDrawPixels(PBO is mapped)");
299 +               return;
300 +            }
301           }
302 -         if (ctx->Unpack.BufferObj->Pointer) {
303 -            /* buffer is mapped - that's an error */
304 -            _mesa_error(ctx, GL_INVALID_OPERATION,
305 -                        "glDrawPixels(PBO is mapped)");
306 -            return;
307 -         }
308 -      }
309  
310 -      ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
311 -                            &ctx->Unpack, pixels);
312 +         ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
313 +                                &ctx->Unpack, pixels);
314 +      }
315     }
316     else if (ctx->RenderMode == GL_FEEDBACK) {
317        /* Feedback the current raster pos info */
318 @@ -159,10 +161,12 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
319  
320     if (ctx->RenderMode == GL_RENDER) {
321        /* Round to satisfy conformance tests (matches SGI's OpenGL) */
322 -      GLint destx = IROUND(ctx->Current.RasterPos[0]);
323 -      GLint desty = IROUND(ctx->Current.RasterPos[1]);
324 -      ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
325 -                             type );
326 +      if (width > 0 && height > 0) {
327 +         GLint destx = IROUND(ctx->Current.RasterPos[0]);
328 +         GLint desty = IROUND(ctx->Current.RasterPos[1]);
329 +         ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
330 +                                 type );
331 +      }
332     }
333     else if (ctx->RenderMode == GL_FEEDBACK) {
334        FLUSH_CURRENT( ctx, 0 );
335 diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
336 index cc1b44d..4321b4c 100644
337 --- a/src/mesa/main/ffvertex_prog.c
338 +++ b/src/mesa/main/ffvertex_prog.c
339 @@ -1104,6 +1104,9 @@ static void build_lighting( struct tnl_program *p )
340  
341     if (twoside) {
342        if (!p->state->material_shininess_is_zero) {
343 +         /* Note that we negate the back-face specular exponent here.
344 +          * The negation will be un-done later in the back-face code below.
345 +          */
346           struct ureg shininess = get_material(p, 1, STATE_SHININESS);
347           emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, 
348                    negate(swizzle1(shininess,X)));
349 @@ -1309,6 +1312,11 @@ static void build_lighting( struct tnl_program *p )
350                mask1 = 0;
351             }
352  
353 +            /* For the back face we need to negate the X and Y component
354 +             * dot products.  dots.Z has the negated back-face specular
355 +             * exponent.  We swizzle that into the W position.  This
356 +             * negation makes the back-face specular term positive again.
357 +             */
358              dots = negate(swizzle(dots,X,Y,W,Z));
359  
360             if (!is_undef(att)) {
361 @@ -1327,8 +1335,10 @@ static void build_lighting( struct tnl_program *p )
362  
363             emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
364             emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
365 -            /* restore negate flag for next lighting */
366 -            dots = negate(dots);
367 +            /* restore dots to its original state for subsequent lights
368 +             * by negating and swizzling again.
369 +             */
370 +            dots = negate(swizzle(dots,X,Y,W,Z));
371  
372             release_temp(p, ambient);
373             release_temp(p, diffuse);
374 diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
375 index 626806d..d17be37 100644
376 --- a/src/mesa/main/glheader.h
377 +++ b/src/mesa/main/glheader.h
378 @@ -145,7 +145,10 @@
379  #if defined(__linux__)
380  #include <byteswap.h>
381  #define CPU_TO_LE32( x )       bswap_32( x )
382 -#else /*__linux__*/
383 +#elif defined(__APPLE__)
384 +#include <CoreFoundation/CFByteOrder.h>
385 +#define CPU_TO_LE32( x )       CFSwapInt32HostToLittle( x )
386 +#else /*__linux__ __APPLE__*/
387  #include <sys/endian.h>
388  #define CPU_TO_LE32( x )       bswap32( x )
389  #endif /*__linux__*/
390 diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
391 index ce50224..4372f7b 100644
392 --- a/src/mesa/main/light.c
393 +++ b/src/mesa/main/light.c
394 @@ -209,7 +209,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
395          _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
396        }
397        TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m);
398 -      NORMALIZE_3FV(temp);
399        params = temp;
400        break;
401     case GL_SPOT_EXPONENT:
402 @@ -1137,12 +1136,18 @@ compute_light_positions( GLcontext *ctx )
403        }
404  
405        if (light->_Flags & LIGHT_SPOT) {
406 +         /* Note: we normalize the spot direction now */
407 +
408          if (ctx->_NeedEyeCoords) {
409             COPY_3V( light->_NormDirection, light->EyeDirection );
410 +            NORMALIZE_3FV( light->_NormDirection );
411          }
412           else {
413 +            GLfloat spotDir[3];
414 +            COPY_3V(spotDir, light->EyeDirection);
415 +            NORMALIZE_3FV(spotDir);
416             TRANSFORM_NORMAL( light->_NormDirection,
417 -                             light->EyeDirection,
418 +                             spotDir,
419                               ctx->ModelviewMatrixStack.Top->m);
420          }
421  
422 diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
423 index dfdd297..2326776 100644
424 --- a/src/mesa/main/readpix.c
425 +++ b/src/mesa/main/readpix.c
426 @@ -170,6 +170,9 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
427        return;
428     }
429  
430 +   if (width == 0 || height == 0)
431 +      return; /* nothing to do */
432 +
433     if (ctx->Pack.BufferObj->Name) {
434        if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
435                                       format, type, pixels)) {
436 diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
437 index be4fc1d..e89bc5f 100644
438 --- a/src/mesa/main/texparam.c
439 +++ b/src/mesa/main/texparam.c
440 @@ -139,8 +139,11 @@ flush(GLcontext *ctx, struct gl_texture_object *texObj)
441  }
442  
443  
444 -/** Set an integer-valued texture parameter */
445 -static void
446 +/**
447 + * Set an integer-valued texture parameter
448 + * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
449 + */
450 +static GLboolean
451  set_tex_parameteri(GLcontext *ctx,
452                     struct gl_texture_object *texObj,
453                     GLenum pname, const GLint *params)
454 @@ -148,13 +151,13 @@ set_tex_parameteri(GLcontext *ctx,
455     switch (pname) {
456     case GL_TEXTURE_MIN_FILTER:
457        if (texObj->MinFilter == params[0])
458 -         return;
459 +         return GL_FALSE;
460        switch (params[0]) {
461        case GL_NEAREST:
462        case GL_LINEAR:
463           flush(ctx, texObj);
464           texObj->MinFilter = params[0];
465 -         return;
466 +         return GL_TRUE;
467        case GL_NEAREST_MIPMAP_NEAREST:
468        case GL_LINEAR_MIPMAP_NEAREST:
469        case GL_NEAREST_MIPMAP_LINEAR:
470 @@ -162,77 +165,80 @@ set_tex_parameteri(GLcontext *ctx,
471           if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
472              flush(ctx, texObj);
473              texObj->MinFilter = params[0];
474 -            return;
475 +            return GL_TRUE;
476           }
477           /* fall-through */
478        default:
479           _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
480        }
481 -      return;
482 +      return GL_FALSE;
483  
484     case GL_TEXTURE_MAG_FILTER:
485        if (texObj->MagFilter == params[0])
486 -         return;
487 +         return GL_FALSE;
488        switch (params[0]) {
489        case GL_NEAREST:
490        case GL_LINEAR:
491           flush(ctx, texObj);
492           texObj->MagFilter = params[0];
493 -         return;
494 +         return GL_TRUE;
495        default:
496           _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
497        }
498 -      return;
499 +      return GL_FALSE;
500  
501     case GL_TEXTURE_WRAP_S:
502        if (texObj->WrapS == params[0])
503 -         return;
504 +         return GL_FALSE;
505        if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
506           flush(ctx, texObj);
507           texObj->WrapS = params[0];
508 +         return GL_TRUE;
509        }
510 -      return;
511 +      return GL_FALSE;
512  
513     case GL_TEXTURE_WRAP_T:
514        if (texObj->WrapT == params[0])
515 -         return;
516 +         return GL_FALSE;
517        if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
518           flush(ctx, texObj);
519           texObj->WrapT = params[0];
520 +         return GL_TRUE;
521        }
522 -      return;
523 +      return GL_FALSE;
524  
525     case GL_TEXTURE_WRAP_R:
526        if (texObj->WrapR == params[0])
527 -         return;
528 +         return GL_FALSE;
529        if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
530           flush(ctx, texObj);
531           texObj->WrapR = params[0];
532 +         return GL_TRUE;
533        }
534 -      return;
535 +      return GL_FALSE;
536  
537     case GL_TEXTURE_BASE_LEVEL:
538        if (texObj->BaseLevel == params[0])
539 -         return;
540 +         return GL_FALSE;
541        if (params[0] < 0 ||
542            (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
543           _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
544 -         return;
545 +         return GL_FALSE;
546        }
547        flush(ctx, texObj);
548        texObj->BaseLevel = params[0];
549 -      return;
550 +      return GL_TRUE;
551  
552     case GL_TEXTURE_MAX_LEVEL:
553        if (texObj->MaxLevel == params[0])
554 -         return;
555 +         return GL_FALSE;
556        if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
557           _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
558 -         return;
559 +         return GL_FALSE;
560        }
561        flush(ctx, texObj);
562        texObj->MaxLevel = params[0];
563 -      return;
564 +      return GL_TRUE;
565  
566     case GL_TEXTURE_COMPARE_SGIX:
567        if (ctx->Extensions.SGIX_shadow) {
568 @@ -243,7 +249,7 @@ set_tex_parameteri(GLcontext *ctx,
569           _mesa_error(ctx, GL_INVALID_ENUM,
570                       "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)");
571        }
572 -      return;
573 +      return GL_TRUE;
574  
575     case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
576        if (ctx->Extensions.SGIX_shadow &&
577 @@ -256,20 +262,22 @@ set_tex_parameteri(GLcontext *ctx,
578           _mesa_error(ctx, GL_INVALID_ENUM,
579                       "glTexParameter(GL_TEXTURE_COMPARE_OPERATOR_SGIX)");
580        }
581 -      return;
582 +      return GL_TRUE;
583  
584     case GL_GENERATE_MIPMAP_SGIS:
585        if (ctx->Extensions.SGIS_generate_mipmap) {
586           if (texObj->GenerateMipmap != params[0]) {
587              flush(ctx, texObj);
588              texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
589 +            return GL_TRUE;
590           }
591 +         return GL_FALSE;
592        }
593        else {
594           _mesa_error(ctx, GL_INVALID_ENUM,
595                       "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
596        }
597 -      return;
598 +      return GL_FALSE;
599  
600     case GL_TEXTURE_COMPARE_MODE_ARB:
601        if (ctx->Extensions.ARB_shadow &&
602 @@ -278,24 +286,26 @@ set_tex_parameteri(GLcontext *ctx,
603           if (texObj->CompareMode != params[0]) {
604              flush(ctx, texObj);
605              texObj->CompareMode = params[0];
606 +            return GL_TRUE;
607           }
608 +         return GL_FALSE;
609        }
610        else {
611           _mesa_error(ctx, GL_INVALID_ENUM,
612                       "glTexParameter(GL_TEXTURE_COMPARE_MODE_ARB)");
613        }
614 -      return;
615 +      return GL_FALSE;
616  
617     case GL_TEXTURE_COMPARE_FUNC_ARB:
618        if (ctx->Extensions.ARB_shadow) {
619           if (texObj->CompareFunc == params[0])
620 -            return;
621 +            return GL_FALSE;
622           switch (params[0]) {
623           case GL_LEQUAL:
624           case GL_GEQUAL:
625              flush(ctx, texObj);
626              texObj->CompareFunc = params[0];
627 -            return;
628 +            return GL_TRUE;
629           case GL_EQUAL:
630           case GL_NOTEQUAL:
631           case GL_LESS:
632 @@ -305,7 +315,7 @@ set_tex_parameteri(GLcontext *ctx,
633              if (ctx->Extensions.EXT_shadow_funcs) {
634                 flush(ctx, texObj);
635                 texObj->CompareFunc = params[0];
636 -               return;
637 +               return GL_TRUE;
638              }
639              /* fall-through */
640           default:
641 @@ -316,7 +326,7 @@ set_tex_parameteri(GLcontext *ctx,
642        else {
643           _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
644        }
645 -      return;
646 +      return GL_FALSE;
647  
648     case GL_DEPTH_TEXTURE_MODE_ARB:
649        if (ctx->Extensions.ARB_depth_texture &&
650 @@ -326,13 +336,14 @@ set_tex_parameteri(GLcontext *ctx,
651           if (texObj->DepthMode != params[0]) {
652              flush(ctx, texObj);
653              texObj->DepthMode = params[0];
654 +            return GL_TRUE;
655           }
656        }
657        else {
658           _mesa_error(ctx, GL_INVALID_ENUM,
659                       "glTexParameter(GL_DEPTH_TEXTURE_MODE_ARB)");
660        }
661 -      return;
662 +      return GL_FALSE;
663  
664  #ifdef FEATURE_OES_draw_texture
665     case GL_TEXTURE_CROP_RECT_OES:
666 @@ -340,17 +351,21 @@ set_tex_parameteri(GLcontext *ctx,
667        texObj->CropRect[1] = params[1];
668        texObj->CropRect[2] = params[2];
669        texObj->CropRect[3] = params[3];
670 -      break;
671 +      return GL_TRUE;
672  #endif
673  
674     default:
675        _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
676     }
677 +   return GL_FALSE;
678  }
679  
680  
681 -/** Set a float-valued texture parameter */
682 -static void
683 +/**
684 + * Set a float-valued texture parameter
685 + * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
686 + */
687 +static GLboolean
688  set_tex_parameterf(GLcontext *ctx,
689                     struct gl_texture_object *texObj,
690                     GLenum pname, const GLfloat *params)
691 @@ -358,54 +373,56 @@ set_tex_parameterf(GLcontext *ctx,
692     switch (pname) {
693     case GL_TEXTURE_MIN_LOD:
694        if (texObj->MinLod == params[0])
695 -         return;
696 +         return GL_FALSE;
697        flush(ctx, texObj);
698        texObj->MinLod = params[0];
699 -      return;
700 +      return GL_TRUE;
701  
702     case GL_TEXTURE_MAX_LOD:
703        if (texObj->MaxLod == params[0])
704 -         return;
705 +         return GL_FALSE;
706        flush(ctx, texObj);
707        texObj->MaxLod = params[0];
708 -      return;
709 +      return GL_TRUE;
710  
711     case GL_TEXTURE_PRIORITY:
712        flush(ctx, texObj);
713        texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
714 -      return;
715 +      return GL_TRUE;
716  
717     case GL_TEXTURE_MAX_ANISOTROPY_EXT:
718        if (ctx->Extensions.EXT_texture_filter_anisotropic) {
719           if (texObj->MaxAnisotropy == params[0])
720 -            return;
721 +            return GL_FALSE;
722           if (params[0] < 1.0) {
723              _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
724 -            return;
725 +            return GL_FALSE;
726           }
727           flush(ctx, texObj);
728           /* clamp to max, that's what NVIDIA does */
729           texObj->MaxAnisotropy = MIN2(params[0],
730                                        ctx->Const.MaxTextureMaxAnisotropy);
731 +         return GL_TRUE;
732        }
733        else {
734           _mesa_error(ctx, GL_INVALID_ENUM,
735                       "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
736        }
737 -      return;
738 +      return GL_FALSE;
739  
740     case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
741        if (ctx->Extensions.SGIX_shadow_ambient) {
742           if (texObj->ShadowAmbient != params[0]) {
743              flush(ctx, texObj);
744              texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F);
745 +            return GL_TRUE;
746           }
747        }
748        else {
749           _mesa_error(ctx, GL_INVALID_ENUM,
750                       "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)");
751        }
752 -      return;
753 +      return GL_FALSE;
754  
755     case GL_TEXTURE_LOD_BIAS:
756        /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
757 @@ -413,7 +430,9 @@ set_tex_parameterf(GLcontext *ctx,
758           if (texObj->LodBias != params[0]) {
759              flush(ctx, texObj);
760              texObj->LodBias = params[0];
761 +            return GL_TRUE;
762           }
763 +         return GL_FALSE;
764        }
765        break;
766  
767 @@ -427,17 +446,19 @@ set_tex_parameterf(GLcontext *ctx,
768        UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
769        UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
770        UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
771 -      return;
772 +      return GL_TRUE;
773  
774     default:
775        _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
776     }
777 +   return GL_FALSE;
778  }
779  
780  
781  void GLAPIENTRY
782  _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
783  {
784 +   GLboolean need_update;
785     struct gl_texture_object *texObj;
786     GET_CURRENT_CONTEXT(ctx);
787     ASSERT_OUTSIDE_BEGIN_END(ctx);
788 @@ -463,15 +484,15 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
789        {
790           /* convert float param to int */
791           GLint p = (GLint) param;
792 -         set_tex_parameteri(ctx, texObj, pname, &p);
793 +         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
794        }
795 -      return;
796 +      break;
797     default:
798        /* this will generate an error if pname is illegal */
799 -      set_tex_parameterf(ctx, texObj, pname, &param);
800 +      need_update = set_tex_parameterf(ctx, texObj, pname, &param);
801     }
802  
803 -   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
804 +   if (ctx->Driver.TexParameter && need_update) {
805        ctx->Driver.TexParameter(ctx, target, texObj, pname, &param);
806     }
807  }
808 @@ -480,6 +501,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
809  void GLAPIENTRY
810  _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
811  {
812 +   GLboolean need_update;
813     struct gl_texture_object *texObj;
814     GET_CURRENT_CONTEXT(ctx);
815     ASSERT_OUTSIDE_BEGIN_END(ctx);
816 @@ -505,7 +527,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
817        {
818           /* convert float param to int */
819           GLint p = (GLint) params[0];
820 -         set_tex_parameteri(ctx, texObj, pname, &p);
821 +         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
822        }
823        break;
824  
825 @@ -518,17 +540,17 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
826           iparams[1] = (GLint) params[1];
827           iparams[2] = (GLint) params[2];
828           iparams[3] = (GLint) params[3];
829 -         set_tex_parameteri(ctx, target, iparams);
830 +         need_update = set_tex_parameteri(ctx, target, iparams);
831        }
832        break;
833  #endif
834  
835     default:
836        /* this will generate an error if pname is illegal */
837 -      set_tex_parameterf(ctx, texObj, pname, params);
838 +      need_update = set_tex_parameterf(ctx, texObj, pname, params);
839     }
840  
841 -   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
842 +   if (ctx->Driver.TexParameter && need_update) {
843        ctx->Driver.TexParameter(ctx, target, texObj, pname, params);
844     }
845  }
846 @@ -537,6 +559,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
847  void GLAPIENTRY
848  _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
849  {
850 +   GLboolean need_update;
851     struct gl_texture_object *texObj;
852     GET_CURRENT_CONTEXT(ctx);
853     ASSERT_OUTSIDE_BEGIN_END(ctx);
854 @@ -555,15 +578,15 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
855        {
856           GLfloat fparam = (GLfloat) param;
857           /* convert int param to float */
858 -         set_tex_parameterf(ctx, texObj, pname, &fparam);
859 +         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
860        }
861        break;
862     default:
863        /* this will generate an error if pname is illegal */
864 -      set_tex_parameteri(ctx, texObj, pname, &param);
865 +      need_update = set_tex_parameteri(ctx, texObj, pname, &param);
866     }
867  
868 -   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
869 +   if (ctx->Driver.TexParameter && need_update) {
870        GLfloat fparam = (GLfloat) param;
871        ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam);
872     }
873 @@ -573,6 +596,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
874  void GLAPIENTRY
875  _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
876  {
877 +   GLboolean need_update;
878     struct gl_texture_object *texObj;
879     GET_CURRENT_CONTEXT(ctx);
880     ASSERT_OUTSIDE_BEGIN_END(ctx);
881 @@ -590,7 +614,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
882           fparams[1] = INT_TO_FLOAT(params[1]);
883           fparams[2] = INT_TO_FLOAT(params[2]);
884           fparams[3] = INT_TO_FLOAT(params[3]);
885 -         set_tex_parameterf(ctx, texObj, pname, fparams);
886 +         need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
887        }
888        break;
889     case GL_TEXTURE_MIN_LOD:
890 @@ -602,15 +626,15 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
891        {
892           /* convert int param to float */
893           GLfloat fparam = (GLfloat) params[0];
894 -         set_tex_parameterf(ctx, texObj, pname, &fparam);
895 +         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
896        }
897        break;
898     default:
899        /* this will generate an error if pname is illegal */
900 -      set_tex_parameteri(ctx, texObj, pname, params);
901 +      need_update = set_tex_parameteri(ctx, texObj, pname, params);
902     }
903  
904 -   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
905 +   if (ctx->Driver.TexParameter && need_update) {
906        GLfloat fparams[4];
907        fparams[0] = INT_TO_FLOAT(params[0]);
908        if (pname == GL_TEXTURE_BORDER_COLOR ||
909 diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
910 index a93733c..6a79cf4 100644
911 --- a/src/mesa/shader/prog_execute.c
912 +++ b/src/mesa/shader/prog_execute.c
913 @@ -1577,8 +1577,8 @@ _mesa_execute_program(GLcontext * ctx,
914        case OPCODE_TXB:         /* GL_ARB_fragment_program only */
915           /* Texel lookup with LOD bias */
916           {
917 -            const struct gl_texture_unit *texUnit
918 -               = &ctx->Texture.Unit[inst->TexSrcUnit];
919 +            const GLuint unit = machine->Samplers[inst->TexSrcUnit];
920 +            const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
921              GLfloat texcoord[4], color[4], lodBias;
922  
923              fetch_vector4(&inst->SrcReg[0], machine, texcoord);
924 diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
925 index c0f4c79..5a67394 100644
926 --- a/src/mesa/shader/slang/slang_builtin.c
927 +++ b/src/mesa/shader/slang/slang_builtin.c
928 @@ -457,28 +457,36 @@ emit_statevars(const char *name, int array_len,
929           tokens[0] = STATE_TEXENV_COLOR;
930        }
931        else if (strcmp(name, "gl_EyePlaneS") == 0) {
932 -         tokens[0] = STATE_TEXGEN_EYE_S;
933 +         tokens[0] = STATE_TEXGEN;
934 +         tokens[2] = STATE_TEXGEN_EYE_S;
935        }
936        else if (strcmp(name, "gl_EyePlaneT") == 0) {
937 -         tokens[0] = STATE_TEXGEN_EYE_T;
938 +         tokens[0] = STATE_TEXGEN;
939 +         tokens[2] = STATE_TEXGEN_EYE_T;
940        }
941        else if (strcmp(name, "gl_EyePlaneR") == 0) {
942 -         tokens[0] = STATE_TEXGEN_EYE_R;
943 +         tokens[0] = STATE_TEXGEN;
944 +         tokens[2] = STATE_TEXGEN_EYE_R;
945        }
946        else if (strcmp(name, "gl_EyePlaneQ") == 0) {
947 -         tokens[0] = STATE_TEXGEN_EYE_Q;
948 +         tokens[0] = STATE_TEXGEN;
949 +         tokens[2] = STATE_TEXGEN_EYE_Q;
950        }
951        else if (strcmp(name, "gl_ObjectPlaneS") == 0) {
952 -         tokens[0] = STATE_TEXGEN_OBJECT_S;
953 +         tokens[0] = STATE_TEXGEN;
954 +         tokens[2] = STATE_TEXGEN_OBJECT_S;
955        }
956        else if (strcmp(name, "gl_ObjectPlaneT") == 0) {
957 -         tokens[0] = STATE_TEXGEN_OBJECT_T;
958 +         tokens[0] = STATE_TEXGEN;
959 +         tokens[2] = STATE_TEXGEN_OBJECT_T;
960        }
961        else if (strcmp(name, "gl_ObjectPlaneR") == 0) {
962 -         tokens[0] = STATE_TEXGEN_OBJECT_R;
963 +         tokens[0] = STATE_TEXGEN;
964 +         tokens[2] = STATE_TEXGEN_OBJECT_R;
965        }
966        else if (strcmp(name, "gl_ObjectPlaneQ") == 0) {
967 -         tokens[0] = STATE_TEXGEN_OBJECT_Q;
968 +         tokens[0] = STATE_TEXGEN;
969 +         tokens[2] = STATE_TEXGEN_OBJECT_Q;
970        }
971        else {
972           return -1; /* invalid array name */
973 diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
974 index e36c1a4..f07014f 100644
975 --- a/src/mesa/swrast/s_span.c
976 +++ b/src/mesa/swrast/s_span.c
977 @@ -1399,11 +1399,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
978     }
979  
980     /*
981 -    * Write to renderbuffers
982 +    * Write to renderbuffers.
983 +    * Depending on glDrawBuffer() state and the which color outputs are
984 +    * written by the fragment shader, we may either replicate one color to
985 +    * all renderbuffers or write a different color to each renderbuffer.
986 +    * multiFragOutputs=TRUE for the later case.
987      */
988     {
989        const GLuint numBuffers = fb->_NumColorDrawBuffers;
990 -      const GLboolean multiFragOutputs = numBuffers > 1;
991 +      const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
992 +      const GLboolean multiFragOutputs = 
993 +         (fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0));
994        GLuint buf;
995  
996        for (buf = 0; buf < numBuffers; buf++) {
This page took 0.0950299999999999 seconds and 3 git commands to generate.