[Haiku-commits] r31287 - in haiku/vendor/mesa/current/src: main shader/slang swrast vbo

korli at BerliOS korli at mail.berlios.de
Sun Jun 28 15:31:53 CEST 2009


Author: korli
Date: 2009-06-28 15:31:51 +0200 (Sun, 28 Jun 2009)
New Revision: 31287
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31287&view=rev

Modified:
   haiku/vendor/mesa/current/src/main/context.c
   haiku/vendor/mesa/current/src/main/context.h
   haiku/vendor/mesa/current/src/main/fbobject.c
   haiku/vendor/mesa/current/src/main/get.c
   haiku/vendor/mesa/current/src/main/image.c
   haiku/vendor/mesa/current/src/main/matrix.c
   haiku/vendor/mesa/current/src/main/mtypes.h
   haiku/vendor/mesa/current/src/main/state.c
   haiku/vendor/mesa/current/src/main/texrender.c
   haiku/vendor/mesa/current/src/main/texstate.c
   haiku/vendor/mesa/current/src/main/version.h
   haiku/vendor/mesa/current/src/shader/slang/slang_preprocess.c
   haiku/vendor/mesa/current/src/swrast/s_texfilter.c
   haiku/vendor/mesa/current/src/vbo/vbo_exec_array.c
   haiku/vendor/mesa/current/src/vbo/vbo_exec_draw.c
Log:
updating mesa vendor with version 7.4.4


Modified: haiku/vendor/mesa/current/src/main/context.c
===================================================================
--- haiku/vendor/mesa/current/src/main/context.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/context.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -1550,6 +1550,24 @@
 
 
 /**
+ * Check if the viewport/scissor size has not yet been initialized.
+ * Initialize the size if the given width and height are non-zero.
+ */
+void
+_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
+{
+   if (!ctx->ViewportInitialized && width > 0 && height > 0) {
+      /* Note: set flag here, before calling _mesa_set_viewport(), to prevent
+       * potential infinite recursion.
+       */
+      ctx->ViewportInitialized = GL_TRUE;
+      _mesa_set_viewport(ctx, 0, 0, width, height);
+      _mesa_set_scissor(ctx, 0, 0, width, height);
+   }
+}
+
+
+/**
  * Bind the given context to the given drawBuffer and readBuffer and
  * make it the current context for the calling thread.
  * We'll render into the drawBuffer and read pixels from the
@@ -1651,25 +1669,24 @@
          ASSERT(drawBuffer->Height > 0);
 #endif
 
-         if (newCtx->FirstTimeCurrent) {
-            /* set initial viewport and scissor size now */
-            _mesa_set_viewport(newCtx, 0, 0,
-                               drawBuffer->Width, drawBuffer->Height);
-	    _mesa_set_scissor(newCtx, 0, 0,
-			      drawBuffer->Width, drawBuffer->Height );
-            check_context_limits(newCtx);
+         if (drawBuffer) {
+            _mesa_check_init_viewport(newCtx,
+                                      drawBuffer->Width, drawBuffer->Height);
          }
       }
 
-      /* We can use this to help debug user's problems.  Tell them to set
-       * the MESA_INFO env variable before running their app.  Then the
-       * first time each context is made current we'll print some useful
-       * information.
-       */
       if (newCtx->FirstTimeCurrent) {
+         check_context_limits(newCtx);
+
+         /* We can use this to help debug user's problems.  Tell them to set
+          * the MESA_INFO env variable before running their app.  Then the
+          * first time each context is made current we'll print some useful
+          * information.
+          */
 	 if (_mesa_getenv("MESA_INFO")) {
 	    _mesa_print_info();
 	 }
+
 	 newCtx->FirstTimeCurrent = GL_FALSE;
       }
    }

Modified: haiku/vendor/mesa/current/src/main/context.h
===================================================================
--- haiku/vendor/mesa/current/src/main/context.h	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/context.h	2009-06-28 13:31:51 UTC (rev 31287)
@@ -132,6 +132,9 @@
 _mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
                     GLframebuffer *readBuffer );
 
+extern void
+_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height);
+
 extern GLboolean
 _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
 

Modified: haiku/vendor/mesa/current/src/main/fbobject.c
===================================================================
--- haiku/vendor/mesa/current/src/main/fbobject.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/fbobject.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -323,6 +323,7 @@
             /* OK */
          }
          else if (ctx->Extensions.EXT_packed_depth_stencil &&
+                  ctx->Extensions.ARB_depth_texture &&
                   texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
             /* OK */
          }
@@ -332,9 +333,18 @@
          }
       }
       else {
-         /* no such thing as stencil textures */
-         att->Complete = GL_FALSE;
-         return;
+         ASSERT(format == GL_STENCIL);
+         ASSERT(att->Renderbuffer->StencilBits);
+         if (ctx->Extensions.EXT_packed_depth_stencil &&
+             ctx->Extensions.ARB_depth_texture &&
+             att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
+            /* OK */
+         }
+         else {
+            /* no such thing as stencil-only textures */
+            att->Complete = GL_FALSE;
+            return;
+         }
       }
    }
    else if (att->Type == GL_RENDERBUFFER_EXT) {

Modified: haiku/vendor/mesa/current/src/main/get.c
===================================================================
--- haiku/vendor/mesa/current/src/main/get.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/get.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -1905,6 +1905,10 @@
          CHECK_EXT1(ARB_shader_objects, "GetBooleanv");
          params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0);
          break;
+      case GL_VERTEX_ARRAY_BINDING_APPLE:
+         CHECK_EXT1(APPLE_vertex_array_object, "GetBooleanv");
+         params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Name);
+         break;
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
    }
@@ -3753,6 +3757,10 @@
          CHECK_EXT1(ARB_shader_objects, "GetFloatv");
          params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0);
          break;
+      case GL_VERTEX_ARRAY_BINDING_APPLE:
+         CHECK_EXT1(APPLE_vertex_array_object, "GetFloatv");
+         params[0] = (GLfloat)(ctx->Array.ArrayObj->Name);
+         break;
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname);
    }
@@ -5601,6 +5609,10 @@
          CHECK_EXT1(ARB_shader_objects, "GetIntegerv");
          params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0;
          break;
+      case GL_VERTEX_ARRAY_BINDING_APPLE:
+         CHECK_EXT1(APPLE_vertex_array_object, "GetIntegerv");
+         params[0] = ctx->Array.ArrayObj->Name;
+         break;
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
    }

Modified: haiku/vendor/mesa/current/src/main/image.c
===================================================================
--- haiku/vendor/mesa/current/src/main/image.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/image.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -1,8 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.1
+ * Version:  7.5
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -738,12 +739,20 @@
                           GLint width, GLint height,
                           GLenum format, GLenum type )
 {
+   GLint bytesPerRow, bytesPerImage, remainder;
+
    ASSERT(packing);
-   ASSERT(type != GL_BITMAP);
 
-   {
+   if (type == GL_BITMAP) {
+      if (packing->RowLength == 0) {
+         bytesPerRow = (width + 7) / 8;
+      }
+      else {
+         bytesPerRow = (packing->RowLength + 7) / 8;
+      }
+   }
+   else {
       const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
-      GLint bytesPerRow, bytesPerImage, remainder;
 
       if (bytesPerPixel <= 0)
          return -1;  /* error */
@@ -753,17 +762,18 @@
       else {
          bytesPerRow = bytesPerPixel * packing->RowLength;
       }
-      remainder = bytesPerRow % packing->Alignment;
-      if (remainder > 0)
-         bytesPerRow += (packing->Alignment - remainder);
+   }
 
-      if (packing->ImageHeight == 0)
-         bytesPerImage = bytesPerRow * height;
-      else
-         bytesPerImage = bytesPerRow * packing->ImageHeight;
+   remainder = bytesPerRow % packing->Alignment;
+   if (remainder > 0)
+      bytesPerRow += (packing->Alignment - remainder);
 
-      return bytesPerImage;
-   }
+   if (packing->ImageHeight == 0)
+      bytesPerImage = bytesPerRow * height;
+   else
+      bytesPerImage = bytesPerRow * packing->ImageHeight;
+
+   return bytesPerImage;
 }
 
 

Modified: haiku/vendor/mesa/current/src/main/matrix.c
===================================================================
--- haiku/vendor/mesa/current/src/main/matrix.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/matrix.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -580,8 +580,8 @@
    }
 
    /* clamp width and height to the implementation dependent range */
-   width  = CLAMP(width,  1, (GLsizei) ctx->Const.MaxViewportWidth);
-   height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight);
+   width  = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
+   height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
 
    ctx->Viewport.X = x;
    ctx->Viewport.Width = width;

Modified: haiku/vendor/mesa/current/src/main/mtypes.h
===================================================================
--- haiku/vendor/mesa/current/src/main/mtypes.h	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/mtypes.h	2009-06-28 13:31:51 UTC (rev 31287)
@@ -3063,6 +3063,8 @@
    GLenum RenderMode;        /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
    GLbitfield NewState;      /**< bitwise-or of _NEW_* flags */
 
+   GLboolean ViewportInitialized;  /**< has viewport size been initialized? */
+
    /** \name Derived state */
    /*@{*/
    /** Bitwise-or of DD_* flags.  Note that this bitfield may be used before

Modified: haiku/vendor/mesa/current/src/main/state.c
===================================================================
--- haiku/vendor/mesa/current/src/main/state.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/state.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -157,7 +157,7 @@
 
    /* 16..31 */
    if (ctx->VertexProgram._Current) {
-      for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
+      for (i = 0; i < Elements(ctx->Array.ArrayObj->VertexAttrib); i++) {
          if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {
             min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);
          }

Modified: haiku/vendor/mesa/current/src/main/texrender.c
===================================================================
--- haiku/vendor/mesa/current/src/main/texrender.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/texrender.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -507,6 +507,7 @@
    trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits;
    trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits;
    trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits;
+   trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits;
 }
 
 

Modified: haiku/vendor/mesa/current/src/main/texstate.c
===================================================================
--- haiku/vendor/mesa/current/src/main/texstate.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/texstate.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -429,7 +429,7 @@
       }
       if (texObj->_Complete) {
          texUnit->_ReallyEnabled = textureBit;
-         texUnit->_Current = texObj;
+         _mesa_reference_texobj(&texUnit->_Current, texObj);
          update_texture_compare_function(ctx, texObj);
       }
    }
@@ -485,7 +485,6 @@
       GLbitfield enableBits;
       GLuint tex;
 
-      texUnit->_Current = NULL;
       texUnit->_ReallyEnabled = 0;
       texUnit->_GenFlags = 0;
 

Modified: haiku/vendor/mesa/current/src/main/version.h
===================================================================
--- haiku/vendor/mesa/current/src/main/version.h	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/main/version.h	2009-06-28 13:31:51 UTC (rev 31287)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.4.2
+ * Version:  7.4.4
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
@@ -31,8 +31,8 @@
 /* Mesa version */
 #define MESA_MAJOR 7
 #define MESA_MINOR 4
-#define MESA_PATCH 2
-#define MESA_VERSION_STRING "7.4.2"
+#define MESA_PATCH 4
+#define MESA_VERSION_STRING "7.4.4"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

Modified: haiku/vendor/mesa/current/src/shader/slang/slang_preprocess.c
===================================================================
--- haiku/vendor/mesa/current/src/shader/slang/slang_preprocess.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/shader/slang/slang_preprocess.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -1041,11 +1041,11 @@
 
                /* Parse optional macro parameters. */
                while (prod[i++] != PARAM_END) {
+                  pp_symbol *param;
+
+                  id = (const char *) (&prod[i]);
+                  idlen = _mesa_strlen (id);
                   if (state.cond.top->effective) {
-                     pp_symbol *param;
-
-                     id = (const char *) (&prod[i]);
-                     idlen = _mesa_strlen (id);
                      pp_annotate (output, "%s, ", id);
                      param = pp_symbols_push (&symbol->parameters);
                      if (param == NULL)
@@ -1059,8 +1059,23 @@
                id = (const char *) (&prod[i]);
                idlen = _mesa_strlen (id);
                if (state.cond.top->effective) {
+                  slang_string replacement;
+                  expand_state es;
+
                   pp_annotate (output, ") %s", id);
-                  slang_string_pushs (&symbol->replacement, id, idlen);
+
+                  slang_string_init(&replacement);
+                  slang_string_pushs(&replacement, id, idlen);
+
+                  /* Expand macro replacement. */
+                  es.output = &symbol->replacement;
+                  es.input = slang_string_cstr(&replacement);
+                  es.state = &state;
+                  if (!expand(&es, &state.symbols)) {
+                     slang_string_free(&replacement);
+                     goto error;
+                  }
+                  slang_string_free(&replacement);
                }
                i += idlen + 1;
             }
@@ -1292,6 +1307,45 @@
 
 
 /**
+ * Remove the continuation characters from the input string.
+ * This is the very first step in preprocessing and is effective
+ * even inside comment blocks.
+ * If there is a whitespace between a backslash and a newline,
+ * this is not considered as a line continuation.
+ * \return GL_TRUE for success, GL_FALSE otherwise.
+ */
+static GLboolean
+_slang_preprocess_backslashes(slang_string *output,
+                              const char *input)
+{
+   while (*input) {
+      if (input[0] == '\\') {
+         /* If a newline follows, eat the backslash and the newline. */
+         if (input[1] == '\r') {
+            if (input[2] == '\n') {
+               input += 3;
+            } else {
+               input += 2;
+            }
+         } else if (input[1] == '\n') {
+            if (input[2] == '\r') {
+               input += 3;
+            } else {
+               input += 2;
+            }
+         } else {
+            /* Leave the backslash alone. */
+            slang_string_pushc(output, *input++);
+         }
+      } else {
+         slang_string_pushc(output, *input++);
+      }
+   }
+   return GL_TRUE;
+}
+
+
+/**
  * Run preprocessor on source code.
  * \param extensions  indicates which GL extensions are enabled
  * \param output  the post-process results
@@ -1308,6 +1362,7 @@
 {
    grammar pid, eid;
    GLboolean success;
+   slang_string without_backslashes;
 
    pid = grammar_load_from_text ((const byte *) (slang_pp_directives_syn));
    if (pid == 0) {
@@ -1320,9 +1375,36 @@
       grammar_destroy (pid);
       return GL_FALSE;
    }
-   success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas);
+
+   slang_string_init(&without_backslashes);
+   success = _slang_preprocess_backslashes(&without_backslashes, input);
+
+   if (0) {
+      _mesa_printf("Pre-processed shader:\n");
+      _mesa_printf("%s", slang_string_cstr(&without_backslashes));
+      _mesa_printf("----------------------\n");
+   }
+
+   if (success) {
+      success = preprocess_source(output,
+                                  slang_string_cstr(&without_backslashes),
+                                  pid,
+                                  eid,
+                                  elog,
+                                  extensions,
+                                  pragmas);
+   }
+
+   slang_string_free(&without_backslashes);
    grammar_destroy (eid);
    grammar_destroy (pid);
+
+   if (0) {
+      _mesa_printf("Post-processed shader:\n");
+      _mesa_printf("%s", slang_string_cstr(output));
+      _mesa_printf("----------------------\n");
+   }
+
    return success;
 }
 

Modified: haiku/vendor/mesa/current/src/swrast/s_texfilter.c
===================================================================
--- haiku/vendor/mesa/current/src/swrast/s_texfilter.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/swrast/s_texfilter.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -226,7 +226,7 @@
  * If A is a signed integer, A % B doesn't give the right value for A < 0
  * (in terms of texture repeat).  Just casting to unsigned fixes that.
  */
-#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B))
+#define REMAINDER(A, B) (((A) + (B) * 1024) % (B))
 
 
 /**

Modified: haiku/vendor/mesa/current/src/vbo/vbo_exec_array.c
===================================================================
--- haiku/vendor/mesa/current/src/vbo/vbo_exec_array.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/vbo/vbo_exec_array.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -114,8 +114,11 @@
    for (i = 0; i < 8; i++)
       exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i];
 
-   for (i = 0; i < VERT_ATTRIB_MAX; i++)
+   for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) {
+      assert(i < Elements(ctx->Array.ArrayObj->VertexAttrib));
+      assert(i < Elements(exec->array.generic_array));
       exec->array.generic_array[i] = &ctx->Array.ArrayObj->VertexAttrib[i];
+   }
    
    exec->array.array_obj = ctx->Array.ArrayObj->Name;
 }

Modified: haiku/vendor/mesa/current/src/vbo/vbo_exec_draw.c
===================================================================
--- haiku/vendor/mesa/current/src/vbo/vbo_exec_draw.c	2009-06-28 02:27:59 UTC (rev 31286)
+++ haiku/vendor/mesa/current/src/vbo/vbo_exec_draw.c	2009-06-28 13:31:51 UTC (rev 31287)
@@ -184,6 +184,7 @@
           (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
          exec->vtx.inputs[16] = exec->vtx.inputs[0];
          exec->vtx.attrsz[16] = exec->vtx.attrsz[0];
+         exec->vtx.attrptr[16] = exec->vtx.attrptr[0];
          exec->vtx.attrsz[0] = 0;
       }
       break;




More information about the Haiku-commits mailing list