[mesa/f17] mesa-8.0.3-git.patch: Sync with 8.0 branch.

Adam Jackson ajax at fedoraproject.org
Mon Jun 25 17:03:34 UTC 2012


commit 2aab46f3c93a36b1f8b4d2a869d6242262f910d5
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 25 13:03:32 2012 -0400

    mesa-8.0.3-git.patch: Sync with 8.0 branch.

 mesa-8.0.3-git.patch |  901 ++++++++++++++++++++++++++++++++++++++++++++++++++
 mesa.spec            |    7 +-
 2 files changed, 907 insertions(+), 1 deletions(-)
---
diff --git a/mesa-8.0.3-git.patch b/mesa-8.0.3-git.patch
new file mode 100644
index 0000000..3a6ae23
--- /dev/null
+++ b/mesa-8.0.3-git.patch
@@ -0,0 +1,901 @@
+git diff-tree -p mesa-8.0.3..d715d3f4a82463a00a64d534747d80792508b97f
+
+diff --git a/docs/relnotes-8.0.3.html b/docs/relnotes-8.0.3.html
+index 4e81da4..dd27bef 100644
+--- a/docs/relnotes-8.0.3.html
++++ b/docs/relnotes-8.0.3.html
+@@ -28,7 +28,9 @@ for DRI hardware acceleration.
+ 
+ <h2>MD5 checksums</h2>
+ <pre>
+-TBD.
++b7210a6d6e4584bd852ab29294ce717e  MesaLib-8.0.3.tar.gz
++cc5ee15e306b8c15da6a478923797171  MesaLib-8.0.3.tar.bz2
++32773634a0f7e70a680505a81426eccf  MesaLib-8.0.3.zip
+ </pre>
+ 
+ <h2>New features</h2>
+diff --git a/docs/relnotes.html b/docs/relnotes.html
+index 23337cf..1bc889a 100644
+--- a/docs/relnotes.html
++++ b/docs/relnotes.html
+@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
+ </p>
+ 
+ <UL>
++<LI><A HREF="relnotes-8.0.3.html">8.0.3 release notes</A>
+ <LI><A HREF="relnotes-8.0.2.html">8.0.2 release notes</A>
+ <LI><A HREF="relnotes-8.0.1.html">8.0.1 release notes</A>
+ <LI><A HREF="relnotes-8.0.html">8.0 release notes</A>
+diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
+index 080e03d..c098c05 100644
+--- a/src/gallium/auxiliary/draw/draw_pt.c
++++ b/src/gallium/auxiliary/draw/draw_pt.c
+@@ -329,25 +329,28 @@ draw_pt_arrays_restart(struct draw_context *draw,
+ 
+    if (draw->pt.user.elts) {
+       /* indexed prims (draw_elements) */
++      const char *elts =
++         (const char *) draw->pt.user.elts + draw->pt.index_buffer.offset;
++
+       cur_start = start;
+       cur_count = 0;
+ 
+       switch (draw->pt.user.eltSize) {
+       case 1:
+          {
+-            const ubyte *elt_ub = (const ubyte *) draw->pt.user.elts;
++            const ubyte *elt_ub = (const ubyte *) elts;
+             PRIM_RESTART_LOOP(elt_ub);
+          }
+          break;
+       case 2:
+          {
+-            const ushort *elt_us = (const ushort *) draw->pt.user.elts;
++            const ushort *elt_us = (const ushort *) elts;
+             PRIM_RESTART_LOOP(elt_us);
+          }
+          break;
+       case 4:
+          {
+-            const uint *elt_ui = (const uint *) draw->pt.user.elts;
++            const uint *elt_ui = (const uint *) elts;
+             PRIM_RESTART_LOOP(elt_ui);
+          }
+          break;
+diff --git a/src/gallium/drivers/nv50/nv50_pc_emit.c b/src/gallium/drivers/nv50/nv50_pc_emit.c
+index 2b177c6..30079ba 100644
+--- a/src/gallium/drivers/nv50/nv50_pc_emit.c
++++ b/src/gallium/drivers/nv50/nv50_pc_emit.c
+@@ -865,8 +865,10 @@ emit_flop(struct nv_pc *pc, struct nv_instruction *i)
+    assert(SFILE(i, 0) == NV_FILE_GPR);
+ 
+    if (!i->is_long) {
++      assert(i->opcode == NV_OP_RCP);
+       emit_form_MUL(pc, i);
+-      assert(i->opcode == NV_OP_RCP && !src0->mod);
++      if (src0->mod & NV_MOD_NEG) pc->emit[0] |= 0x00400000;
++      if (src0->mod & NV_MOD_ABS) pc->emit[0] |= 0x00008000;
+       return;
+    }
+ 
+diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
+index 2f9379b..942c0ee 100644
+--- a/src/gallium/drivers/svga/svga_surface.c
++++ b/src/gallium/drivers/svga/svga_surface.c
+@@ -320,6 +320,11 @@ svga_mark_surface_dirty(struct pipe_surface *surf)
+       else {
+          /* this will happen later in svga_propagate_surface */
+       }
++
++      /* Increment the view_age and texture age for this surface's slice
++       * so that any sampler views into the texture are re-validated too.
++       */
++      tex->view_age[surf->u.tex.first_layer] = ++(tex->age);
+    }
+ }
+ 
+diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c
+index 06cc003..7b3df27 100644
+--- a/src/gallium/state_trackers/vega/vg_translate.c
++++ b/src/gallium/state_trackers/vega/vg_translate.c
+@@ -526,8 +526,8 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
+       src += offset;
+       for (i = 0; i < n; ++i) {
+          VGfloat clr[4];
+-         clr[0] = ((*src >> 10) & 31)/31.;
+-         clr[1] = ((*src >>  5) & 95)/95.;
++         clr[0] = ((*src >> 11) & 31)/31.;
++         clr[1] = ((*src >>  5) & 63)/63.;
+          clr[2] = ((*src >>  0) & 31)/31.;
+          clr[3] = 1.f;
+ 
+diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
+index 2b0593a..75a4205 100644
+--- a/src/mesa/drivers/dri/i965/brw_eu.c
++++ b/src/mesa/drivers/dri/i965/brw_eu.c
+@@ -47,13 +47,13 @@ brw_swap_cmod(uint32_t cmod)
+    case BRW_CONDITIONAL_NZ:
+       return cmod;
+    case BRW_CONDITIONAL_G:
+-      return BRW_CONDITIONAL_LE;
+-   case BRW_CONDITIONAL_GE:
+       return BRW_CONDITIONAL_L;
++   case BRW_CONDITIONAL_GE:
++      return BRW_CONDITIONAL_LE;
+    case BRW_CONDITIONAL_L:
+-      return BRW_CONDITIONAL_GE;
+-   case BRW_CONDITIONAL_LE:
+       return BRW_CONDITIONAL_G;
++   case BRW_CONDITIONAL_LE:
++      return BRW_CONDITIONAL_GE;
+    default:
+       return ~0;
+    }
+diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
+index de4820b..32da289 100644
+--- a/src/mesa/main/bufferobj.c
++++ b/src/mesa/main/bufferobj.c
+@@ -524,7 +524,7 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
+                           GLintptr readOffset, GLintptr writeOffset,
+                           GLsizeiptr size)
+ {
+-   void *srcPtr, *dstPtr;
++   GLubyte *srcPtr, *dstPtr;
+ 
+    /* the buffers should not be mapped */
+    assert(!_mesa_bufferobj_mapped(src));
+@@ -1311,6 +1311,12 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
+       return;
+    }
+ 
++   if (size < 0) {
++      _mesa_error(ctx, GL_INVALID_VALUE,
++                  "glCopyBufferSubData(writeOffset = %d)", (int) size);
++      return;
++   }
++
+    if (readOffset + size > src->Size) {
+       _mesa_error(ctx, GL_INVALID_VALUE,
+                   "glCopyBuffserSubData(readOffset + size = %d)",
+diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
+index b5b10aa..64f592a 100644
+--- a/src/mesa/main/fbobject.c
++++ b/src/mesa/main/fbobject.c
+@@ -1245,7 +1245,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
+    case GL_RGBA8I_EXT:
+    case GL_RGBA16I_EXT:
+    case GL_RGBA32I_EXT:
+-      return ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
++      return ctx->VersionMajor >= 3 ||
++             ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
+ 
+    case GL_RGB8UI_EXT:
+    case GL_RGB16UI_EXT:
+@@ -1253,7 +1254,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
+    case GL_RGB8I_EXT:
+    case GL_RGB16I_EXT:
+    case GL_RGB32I_EXT:
+-      return ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
++      return ctx->VersionMajor >= 3 ||
++             ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
+ 
+    case GL_R8UI:
+    case GL_R8I:
+@@ -1261,8 +1263,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
+    case GL_R16I:
+    case GL_R32UI:
+    case GL_R32I:
+-      return ctx->Extensions.ARB_texture_rg &&
+-             ctx->Extensions.EXT_texture_integer ? GL_RED : 0;
++      return ctx->VersionMajor >= 3 ||
++             (ctx->Extensions.ARB_texture_rg &&
++              ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
+ 
+    case GL_RG8UI:
+    case GL_RG8I:
+@@ -1270,8 +1273,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
+    case GL_RG16I:
+    case GL_RG32UI:
+    case GL_RG32I:
+-      return ctx->Extensions.ARB_texture_rg &&
+-             ctx->Extensions.EXT_texture_integer ? GL_RG : 0;
++      return ctx->VersionMajor >= 3 ||
++             (ctx->Extensions.ARB_texture_rg &&
++              ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
+ 
+    case GL_INTENSITY8I_EXT:
+    case GL_INTENSITY8UI_EXT:
+diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
+index a484979..fece8d9 100644
+--- a/src/mesa/main/format_unpack.c
++++ b/src/mesa/main/format_unpack.c
+@@ -2922,7 +2922,7 @@ unpack_uint_z_Z32_FLOAT(const void *src, GLuint *dst, GLuint n)
+    const float *s = (const float *)src;
+    GLuint i;
+    for (i = 0; i < n; i++) {
+-      dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i]), 0.0F, 1.0F)));
++      dst[i] = FLOAT_TO_UINT(CLAMP(s[i], 0.0F, 1.0F));
+    }
+ }
+ 
+@@ -2938,7 +2938,7 @@ unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n)
+    GLuint i;
+ 
+    for (i = 0; i < n; i++) {
+-      dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i].z), 0.0F, 1.0F)));
++      dst[i] = FLOAT_TO_UINT(CLAMP(s[i].z, 0.0F, 1.0F));
+    }
+ }
+ 
+diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
+index 8b65cf0..b6c2645 100644
+--- a/src/mesa/main/image.c
++++ b/src/mesa/main/image.c
+@@ -356,18 +356,92 @@ _mesa_bytes_per_pixel( GLenum format, GLenum type )
+ 
+ 
+ /**
+- * Test for a legal pixel format and type.
++ * Do error checking of format/type combinations for glReadPixels,
++ * glDrawPixels and glTex[Sub]Image.  Note that depending on the format
++ * and type values, we may either generate GL_INVALID_OPERATION or
++ * GL_INVALID_ENUM.
+  *
+  * \param format pixel format.
+  * \param type pixel type.
+  *
+- * \return GL_TRUE if the given pixel format and type are legal, or GL_FALSE
+- * otherwise.
++ * \return GL_INVALID_ENUM, GL_INVALID_OPERATION or GL_NO_ERROR
+  */
+-GLboolean
+-_mesa_is_legal_format_and_type(const struct gl_context *ctx,
+-                               GLenum format, GLenum type)
++GLenum
++_mesa_error_check_format_and_type(const struct gl_context *ctx,
++                                  GLenum format, GLenum type)
+ {
++   /* special type-based checks (see glReadPixels, glDrawPixels error lists) */
++   switch (type) {
++   case GL_BITMAP:
++      if (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX) {
++         return GL_INVALID_ENUM;
++      }
++      break;
++
++   case GL_UNSIGNED_BYTE_3_3_2:
++   case GL_UNSIGNED_BYTE_2_3_3_REV:
++   case GL_UNSIGNED_SHORT_5_6_5:
++   case GL_UNSIGNED_SHORT_5_6_5_REV:
++      if (format == GL_RGB) {
++         break; /* OK */
++      }
++      if (format == GL_RGB_INTEGER_EXT &&
++          ctx->Extensions.ARB_texture_rgb10_a2ui) {
++         break; /* OK */
++      }
++      return GL_INVALID_OPERATION;
++
++   case GL_UNSIGNED_SHORT_4_4_4_4:
++   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
++   case GL_UNSIGNED_SHORT_5_5_5_1:
++   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
++   case GL_UNSIGNED_INT_8_8_8_8:
++   case GL_UNSIGNED_INT_8_8_8_8_REV:
++   case GL_UNSIGNED_INT_10_10_10_2:
++   case GL_UNSIGNED_INT_2_10_10_10_REV:
++      if (format == GL_RGBA ||
++          format == GL_BGRA ||
++          format == GL_ABGR_EXT) {
++         break; /* OK */
++      }
++      if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) &&
++          ctx->Extensions.ARB_texture_rgb10_a2ui) {
++         break; /* OK */
++      }
++      return GL_INVALID_OPERATION;
++
++   case GL_UNSIGNED_INT_24_8:
++      if (!ctx->Extensions.EXT_packed_depth_stencil) {
++         return GL_INVALID_ENUM;
++      }
++      if (format != GL_DEPTH_STENCIL) {
++         return GL_INVALID_OPERATION;
++      }
++      return GL_NO_ERROR;
++
++   case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
++      if (!ctx->Extensions.ARB_depth_buffer_float) {
++         return GL_INVALID_ENUM;
++      }
++      if (format != GL_DEPTH_STENCIL) {
++         return GL_INVALID_OPERATION;
++      }
++      return GL_NO_ERROR;
++
++   case GL_UNSIGNED_INT_10F_11F_11F_REV:
++      if (!ctx->Extensions.EXT_packed_float) {
++         return GL_INVALID_ENUM;
++      }
++      if (format != GL_RGB) {
++         return GL_INVALID_OPERATION;
++      }
++      return GL_NO_ERROR;
++
++   default:
++      ; /* fall-through */
++   }
++
++   /* now, for each format, check the type for compatibility */
+    switch (format) {
+       case GL_COLOR_INDEX:
+       case GL_STENCIL_INDEX:
+@@ -380,12 +454,14 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+             case GL_FLOAT:
+-               return GL_TRUE;
+-            case GL_HALF_FLOAT_ARB:
+-               return ctx->Extensions.ARB_half_float_pixel;
++               return GL_NO_ERROR;
++            case GL_HALF_FLOAT:
++               return ctx->Extensions.ARB_half_float_pixel
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
++
+       case GL_RED:
+       case GL_GREEN:
+       case GL_BLUE:
+@@ -404,16 +480,17 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+             case GL_FLOAT:
+-               return GL_TRUE;
+-            case GL_HALF_FLOAT_ARB:
+-               return ctx->Extensions.ARB_half_float_pixel;
++               return GL_NO_ERROR;
++            case GL_HALF_FLOAT:
++               return ctx->Extensions.ARB_half_float_pixel
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
++
+       case GL_RG:
+ 	 if (!ctx->Extensions.ARB_texture_rg)
+-	    return GL_FALSE;
+-
++	    return GL_INVALID_ENUM;
+          switch (type) {
+             case GL_BYTE:
+             case GL_UNSIGNED_BYTE:
+@@ -422,12 +499,14 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+             case GL_FLOAT:
+-               return GL_TRUE;
+-            case GL_HALF_FLOAT_ARB:
+-               return ctx->Extensions.ARB_half_float_pixel;
++               return GL_NO_ERROR;
++            case GL_HALF_FLOAT:
++               return ctx->Extensions.ARB_half_float_pixel
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
++
+       case GL_RGB:
+          switch (type) {
+             case GL_BYTE:
+@@ -441,16 +520,20 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_BYTE_2_3_3_REV:
+             case GL_UNSIGNED_SHORT_5_6_5:
+             case GL_UNSIGNED_SHORT_5_6_5_REV:
+-               return GL_TRUE;
+-            case GL_HALF_FLOAT_ARB:
+-               return ctx->Extensions.ARB_half_float_pixel;
++               return GL_NO_ERROR;
++            case GL_HALF_FLOAT:
++               return ctx->Extensions.ARB_half_float_pixel
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             case GL_UNSIGNED_INT_5_9_9_9_REV:
+-               return ctx->Extensions.EXT_texture_shared_exponent;
++               return ctx->Extensions.EXT_texture_shared_exponent
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             case GL_UNSIGNED_INT_10F_11F_11F_REV:
+-               return ctx->Extensions.EXT_packed_float;
++               return ctx->Extensions.EXT_packed_float
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
++
+       case GL_BGR:
+          switch (type) {
+             /* NOTE: no packed types are supported with BGR.  That's
+@@ -463,12 +546,14 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+             case GL_FLOAT:
+-               return GL_TRUE;
+-            case GL_HALF_FLOAT_ARB:
+-               return ctx->Extensions.ARB_half_float_pixel;
++               return GL_NO_ERROR;
++            case GL_HALF_FLOAT:
++               return ctx->Extensions.ARB_half_float_pixel
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
++
+       case GL_RGBA:
+       case GL_BGRA:
+       case GL_ABGR_EXT:
+@@ -488,28 +573,37 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_INT_8_8_8_8_REV:
+             case GL_UNSIGNED_INT_10_10_10_2:
+             case GL_UNSIGNED_INT_2_10_10_10_REV:
+-               return GL_TRUE;
+-            case GL_HALF_FLOAT_ARB:
+-               return ctx->Extensions.ARB_half_float_pixel;
++               return GL_NO_ERROR;
++            case GL_HALF_FLOAT:
++               return ctx->Extensions.ARB_half_float_pixel
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
++
+       case GL_YCBCR_MESA:
++         if (!ctx->Extensions.MESA_ycbcr_texture)
++            return GL_INVALID_ENUM;
+          if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
+              type == GL_UNSIGNED_SHORT_8_8_REV_MESA)
+-            return GL_TRUE;
++            return GL_NO_ERROR;
+          else
+-            return GL_FALSE;
++            return GL_INVALID_OPERATION;
++
+       case GL_DEPTH_STENCIL_EXT:
+-         if ((ctx->Extensions.EXT_packed_depth_stencil &&
+-              type == GL_UNSIGNED_INT_24_8_EXT) ||
+-             (ctx->Extensions.ARB_depth_buffer_float &&
+-              type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV))
+-            return GL_TRUE;
++         if (ctx->Extensions.EXT_packed_depth_stencil &&
++             type == GL_UNSIGNED_INT_24_8)
++            return GL_NO_ERROR;
++         else if (ctx->Extensions.ARB_depth_buffer_float &&
++             type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV)
++            return GL_NO_ERROR;
+          else
+-            return GL_FALSE;
++            return GL_INVALID_ENUM;
++
+       case GL_DUDV_ATI:
+       case GL_DU8DV8_ATI:
++         if (!ctx->Extensions.ATI_envmap_bumpmap)
++            return GL_INVALID_ENUM;
+          switch (type) {
+             case GL_BYTE:
+             case GL_UNSIGNED_BYTE:
+@@ -518,9 +612,9 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+             case GL_FLOAT:
+-               return GL_TRUE;
++               return GL_NO_ERROR;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
+ 
+       /* integer-valued formats */
+@@ -536,9 +630,11 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_SHORT:
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+-               return ctx->Extensions.EXT_texture_integer;
++               return (ctx->VersionMajor >= 3 ||
++                       ctx->Extensions.EXT_texture_integer)
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
+ 
+       case GL_RGB_INTEGER_EXT:
+@@ -549,14 +645,17 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_SHORT:
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+-               return ctx->Extensions.EXT_texture_integer;
++               return (ctx->VersionMajor >= 3 ||
++                       ctx->Extensions.EXT_texture_integer)
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             case GL_UNSIGNED_BYTE_3_3_2:
+             case GL_UNSIGNED_BYTE_2_3_3_REV:
+             case GL_UNSIGNED_SHORT_5_6_5:
+             case GL_UNSIGNED_SHORT_5_6_5_REV:
+-               return ctx->Extensions.ARB_texture_rgb10_a2ui;
++               return ctx->Extensions.ARB_texture_rgb10_a2ui
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
+ 
+       case GL_BGR_INTEGER_EXT:
+@@ -568,9 +667,11 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+             /* NOTE: no packed formats w/ BGR format */
+-               return ctx->Extensions.EXT_texture_integer;
++               return (ctx->VersionMajor >= 3 ||
++                       ctx->Extensions.EXT_texture_integer)
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
+ 
+       case GL_RGBA_INTEGER_EXT:
+@@ -582,7 +683,9 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_SHORT:
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+-               return ctx->Extensions.EXT_texture_integer;
++               return (ctx->VersionMajor >= 3 ||
++                       ctx->Extensions.EXT_texture_integer)
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             case GL_UNSIGNED_SHORT_4_4_4_4:
+             case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+             case GL_UNSIGNED_SHORT_5_5_5_1:
+@@ -591,9 +694,10 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_INT_8_8_8_8_REV:
+             case GL_UNSIGNED_INT_10_10_10_2:
+             case GL_UNSIGNED_INT_2_10_10_10_REV:
+-               return ctx->Extensions.ARB_texture_rgb10_a2ui;
++               return ctx->Extensions.ARB_texture_rgb10_a2ui
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
+ 
+       case GL_LUMINANCE_INTEGER_EXT:
+@@ -605,15 +709,16 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
+             case GL_UNSIGNED_SHORT:
+             case GL_INT:
+             case GL_UNSIGNED_INT:
+-               return ctx->Extensions.EXT_texture_integer;
++               return ctx->Extensions.EXT_texture_integer
++                  ? GL_NO_ERROR : GL_INVALID_ENUM;
+             default:
+-               return GL_FALSE;
++               return GL_INVALID_ENUM;
+          }
+ 
+       default:
+-         ; /* fall-through */
++         return GL_INVALID_ENUM;
+    }
+-   return GL_FALSE;
++   return GL_NO_ERROR;
+ }
+ 
+ 
+diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
+index e4961ed..f1ed883 100644
+--- a/src/mesa/main/image.h
++++ b/src/mesa/main/image.h
+@@ -53,9 +53,9 @@ _mesa_components_in_format( GLenum format );
+ extern GLint
+ _mesa_bytes_per_pixel( GLenum format, GLenum type );
+ 
+-extern GLboolean
+-_mesa_is_legal_format_and_type(const struct gl_context *ctx,
+-                               GLenum format, GLenum type);
++extern GLenum
++_mesa_error_check_format_and_type(const struct gl_context *ctx,
++                                  GLenum format, GLenum type);
+ 
+ extern GLboolean
+ _mesa_is_color_format(GLenum format);
+diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
+index 6c041fa..d0947d6 100644
+--- a/src/mesa/main/readpix.c
++++ b/src/mesa/main/readpix.c
+@@ -650,6 +650,7 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
+ {
+    const char *readDraw = drawing ? "Draw" : "Read";
+    const GLboolean reading = !drawing;
++   GLenum err;
+ 
+    /* state validation should have already been done */
+    ASSERT(ctx->NewState == 0x0);
+@@ -671,9 +672,9 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
+    }
+ 
+    /* basic combinations test */
+-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+-      _mesa_error(ctx, GL_INVALID_ENUM,
+-                  "gl%sPixels(format or type)", readDraw);
++   err = _mesa_error_check_format_and_type(ctx, format, type);
++   if (err != GL_NO_ERROR) {
++      _mesa_error(ctx, err, "gl%sPixels(format or type)", readDraw);
+       return GL_TRUE;
+    }
+ 
+@@ -777,7 +778,7 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
+       }
+       break;
+    default:
+-      /* this should have been caught in _mesa_is_legal_format_type() */
++      /* this should have been caught in _mesa_error_check_format_type() */
+       _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
+       return GL_TRUE;
+    }
+diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
+index 259eb90..5fdc2ab 100644
+--- a/src/mesa/main/texformat.c
++++ b/src/mesa/main/texformat.c
+@@ -706,6 +706,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
+          RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32);
+          RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+          break;
++      }
++   }
++
++   if (ctx->VersionMajor >= 3 ||
++       ctx->Extensions.EXT_texture_integer) {
++      switch (internalFormat) {
+       case GL_RGB8UI_EXT:
+          RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8);
+          RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+@@ -822,7 +828,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
+       }
+    }
+ 
+-   if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.EXT_texture_integer) {
++   if (ctx->VersionMajor >= 3 ||
++       (ctx->Extensions.ARB_texture_rg &&
++        ctx->Extensions.EXT_texture_integer)) {
+       switch (internalFormat) {
+       case GL_R8UI:
+          RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT8);
+diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
+index 76ac5a2..254199b 100644
+--- a/src/mesa/main/texgetimage.c
++++ b/src/mesa/main/texgetimage.c
+@@ -691,7 +691,7 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
+    struct gl_texture_image *texImage;
+    const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
+    const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
+-   GLenum baseFormat;
++   GLenum baseFormat, err;
+ 
+    if (maxLevels == 0) {
+       _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target);
+@@ -734,6 +734,12 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
+    if (!ctx->Extensions.ATI_envmap_bumpmap
+        && _mesa_is_dudv_format(format)) {
+       _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)");
++      return;
++   }
++
++   err = _mesa_error_check_format_and_type(ctx, format, type);
++   if (err != GL_NO_ERROR) {
++      _mesa_error(ctx, err, "glGetTexImage(format/type)");
+       return GL_TRUE;
+    }
+ 
+@@ -744,14 +750,6 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
+       return GL_TRUE;
+    }
+ 
+-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+-      /* GL_INVALID_OPERATION is generated by a format/type
+-       * mismatch (see the 1.2 spec page 94, sec 3.6.4.)
+-       */
+-      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(target)");
+-      return GL_TRUE;
+-   }
+-
+    texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+    if (!texImage) {
+       /* non-existant texture image */
+diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
+index c347f59..077c196 100644
+--- a/src/mesa/main/teximage.c
++++ b/src/mesa/main/teximage.c
+@@ -323,7 +323,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
+    }
+ #endif /* FEATURE_EXT_texture_sRGB */
+ 
+-   if (ctx->Extensions.EXT_texture_integer) {
++   if (ctx->VersionMajor >= 3 ||
++       ctx->Extensions.EXT_texture_integer) {
+       switch (internalFormat) {
+       case GL_RGBA8UI_EXT:
+       case GL_RGBA16UI_EXT:
+@@ -340,6 +341,11 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
+       case GL_RGB16I_EXT:
+       case GL_RGB32I_EXT:
+          return GL_RGB;
++      }
++   }
++
++   if (ctx->Extensions.EXT_texture_integer) {
++      switch (internalFormat) {
+       case GL_ALPHA8UI_EXT:
+       case GL_ALPHA16UI_EXT:
+       case GL_ALPHA32UI_EXT:
+@@ -391,7 +397,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
+       case GL_R16UI:
+       case GL_R32I:
+       case GL_R32UI:
+-	 if (!ctx->Extensions.EXT_texture_integer)
++	 if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
+ 	    break;
+ 	 /* FALLTHROUGH */
+       case GL_R8:
+@@ -416,7 +422,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
+       case GL_RG16UI:
+       case GL_RG32I:
+       case GL_RG32UI:
+-	 if (!ctx->Extensions.EXT_texture_integer)
++	 if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
+ 	    break;
+ 	 /* FALLTHROUGH */
+       case GL_RG:
+@@ -1578,6 +1584,7 @@ texture_error_check( struct gl_context *ctx,
+    const GLboolean isProxy = target == proxyTarget;
+    GLboolean sizeOK = GL_TRUE;
+    GLboolean colorFormat;
++   GLenum err;
+ 
+    /* Even though there are no color-index textures, we still have to support
+     * uploading color-index data and remapping it to RGB via the
+@@ -1646,16 +1653,10 @@ texture_error_check( struct gl_context *ctx,
+    }
+ 
+    /* Check incoming image format and type */
+-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+-      /* Normally, GL_INVALID_OPERATION is generated by a format/type
+-       * mismatch (see the 1.2 spec page 94, sec 3.6.4.).  But with the
+-       * GL_EXT_texture_integer extension, some combinations should generate
+-       * GL_INVALID_ENUM instead (grr!).
+-       */
++   err = _mesa_error_check_format_and_type(ctx, format, type);
++   if (err != GL_NO_ERROR) {
+       if (!isProxy) {
+-         GLenum error = _mesa_is_integer_format(format)
+-            ? GL_INVALID_ENUM : GL_INVALID_OPERATION;
+-         _mesa_error(ctx, error,
++         _mesa_error(ctx, err,
+                      "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
+                      dimensions, format, type);
+       }
+@@ -1754,7 +1755,7 @@ texture_error_check( struct gl_context *ctx,
+    }
+ 
+    /* additional checks for integer textures */
+-   if (ctx->Extensions.EXT_texture_integer &&
++   if ((ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) &&
+        (_mesa_is_integer_format(format) !=
+         _mesa_is_integer_format(internalFormat))) {
+       if (!isProxy) {
+@@ -1805,6 +1806,8 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
+                         GLint width, GLint height, GLint depth,
+                         GLenum format, GLenum type )
+ {
++   GLenum err;
++
+    /* Basic level check */
+    if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
+       _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level);
+@@ -1828,13 +1831,9 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
+       return GL_TRUE;
+    }
+ 
+-   if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+-      /* As with the glTexImage2D check above, the error code here
+-       * depends on texture integer.
+-       */
+-      GLenum error = _mesa_is_integer_format(format)
+-         ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
+-      _mesa_error(ctx, error,
++   err = _mesa_error_check_format_and_type(ctx, format, type);
++   if (err != GL_NO_ERROR) {
++      _mesa_error(ctx, err,
+                   "glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
+                   dimensions, format, type);
+       return GL_TRUE;
+diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
+index 38ae1ce..fc6e17c 100644
+--- a/src/mesa/main/version.c
++++ b/src/mesa/main/version.c
+@@ -140,7 +140,6 @@ compute_version(struct gl_context *ctx)
+                               ctx->Extensions.EXT_framebuffer_sRGB &&
+                               ctx->Extensions.EXT_packed_float &&
+                               ctx->Extensions.EXT_texture_array &&
+-                              ctx->Extensions.EXT_texture_integer &&
+                               ctx->Extensions.EXT_texture_shared_exponent &&
+                               ctx->Extensions.EXT_transform_feedback &&
+                               ctx->Extensions.NV_conditional_render);
+diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
+index 04d451b..d4992a7 100644
+--- a/src/mesa/state_tracker/st_cb_drawpixels.c
++++ b/src/mesa/state_tracker/st_cb_drawpixels.c
+@@ -215,7 +215,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
+    if (!p)
+       return NULL;
+ 
+-   p->NumInstructions = write_depth ? 2 : 1;
++   p->NumInstructions = write_depth ? 3 : 1;
+    p->NumInstructions += write_stencil ? 1 : 0;
+ 
+    p->Instructions = _mesa_alloc_instructions(p->NumInstructions);
+@@ -236,6 +236,13 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
+       p->Instructions[ic].TexSrcUnit = 0;
+       p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
+       ic++;
++      /* MOV result.color, fragment.color; */
++      p->Instructions[ic].Opcode = OPCODE_MOV;
++      p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
++      p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
++      p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
++      p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
++      ic++;
+    }
+ 
+    if (write_stencil) {
+@@ -258,8 +265,10 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
+ 
+    p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
+    p->OutputsWritten = 0;
+-   if (write_depth)
++   if (write_depth) {
+       p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH);
++      p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_COLOR);
++   }
+    if (write_stencil)
+       p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_STENCIL);
+ 
+diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
+index ad4f23c..88c5ad7 100644
+--- a/src/mesa/state_tracker/st_cb_texture.c
++++ b/src/mesa/state_tracker/st_cb_texture.c
+@@ -406,6 +406,8 @@ guess_and_alloc_texture(struct st_context *st,
+                                  ptLayers,
+                                  bindings);
+ 
++   stObj->lastLevel = lastLevel;
++
+    DBG("%s returning %d\n", __FUNCTION__, (stObj->pt != NULL));
+ 
+    return stObj->pt != NULL;
+diff --git a/tests/glx/Makefile.am b/tests/glx/Makefile.am
+index cdebf5d..5f55a5b 100644
+--- a/tests/glx/Makefile.am
++++ b/tests/glx/Makefile.am
+@@ -1,6 +1,6 @@
+-AM_CFLAGS = -I$(top_builddir)/src/glx -I$(top_builddir)/src/mapi \
++AM_CFLAGS = -I$(top_builddir)/src/glx -I$(top_builddir)/src/mapi -I$(top_builddir)/include \
+ 	$(X11_CFLAGS) $(GTEST_CFLAGS)
+-AM_CXXFLAGS = -I$(top_builddir)/src/glx -I$(top_builddir)/src/mapi \
++AM_CXXFLAGS = -I$(top_builddir)/src/glx -I$(top_builddir)/src/mapi -I$(top_builddir)/include \
+ 	$(X11_CFLAGS) $(GTEST_CFLAGS)
+ 
+ if HAVE_GTEST
diff --git a/mesa.spec b/mesa.spec
index 45b6a85..21abf4c 100644
--- a/mesa.spec
+++ b/mesa.spec
@@ -36,7 +36,7 @@
 Summary: Mesa graphics libraries
 Name: mesa
 Version: 8.0.3
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://www.mesa3d.org
@@ -54,6 +54,7 @@ Patch9: mesa-8.0-llvmpipe-shmget.patch
 Patch12: mesa-8.0.1-fix-16bpp.patch
 Patch13: mesa-8.0-nouveau-vieux-nvfx-lowmem.patch
 Patch14: mesa-8.0-nouveau-vieux-finish.patch
+Patch15: mesa-8.0.3-git.patch
 
 BuildRequires: pkgconfig autoconf automake libtool
 %if %{with_hardware}
@@ -293,6 +294,7 @@ Mesa shared glapi
 %patch12 -p1 -b .16bpp
 %patch13 -p1 -b .nouveau-lowmem
 %patch14 -p1 -b .nouveau-finish
+%patch15 -p1 -b .git
 
 %build
 
@@ -568,6 +570,9 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
+* Mon Jun 25 2012 Adam Jackson <ajax at redhat.com> 8.0.3-3
+- mesa-8.0.3-git.patch: Sync with 8.0 branch.
+
 * Thu Jun 07 2012 Adam Jackson <ajax at redhat.com> 8.0.3-2
 - Disable llvm on non-x86 (#829202)
 


More information about the scm-commits mailing list