mesa: Branch 'master' - 3 commits

Brian Paul brianp at kemper.freedesktop.org
Sat Jan 27 02:02:23 UTC 2007


 src/mesa/main/bufferobj.c         |    4 ++--
 src/mesa/main/imports.c           |   28 ++++++++++++++++++----------
 src/mesa/swrast/s_atifragshader.c |    5 +++--
 src/mesa/swrast/s_buffers.c       |    5 ++++-
 src/mesa/swrast/s_context.c       |    4 ++--
 src/mesa/swrast/s_stencil.c       |   12 +++++++-----
 src/mesa/swrast/s_zoom.c          |   16 ++++++++--------
 7 files changed, 44 insertions(+), 30 deletions(-)

New commits:
diff-tree 99c9bc386f54964eea0ed93f6b036477076dae57 (from 1d74e565dbfc1a69c49fe67eed9c91f10d0ad2fc)
Author: Brian <brian at nostromo.localnet.net>
Date:   Fri Jan 26 19:01:55 2007 -0700

    document, re-indent _mesa_ffsll()

diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index ad77373..be2f04c 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -574,28 +574,36 @@ _mesa_ffs(int i)
 #endif
 }
 
+
+/**
+ * Find position of first bit set in given value.
+ * XXX Warning: this function can only be used on 64-bit systems!
+ * \return  position of lest significant bit set, starting at 1, return zero
+ *          if no bits set.
+ */
 int
 _mesa_ffsll(long long val)
 {
 #ifdef ffsll
-	return ffsll(val);
+   return ffsll(val);
 #else
-	int bit;
+   int bit;
 
-	assert(sizeof(val) == 8);
+   assert(sizeof(val) == 8);
 
-	bit = ffs(val);
-	if (bit != 0)
-		return bit;
+   bit = ffs(val);
+   if (bit != 0)
+      return bit;
 
-	bit = ffs(val >> 32);
-	if (bit != 0)
-		return 32 + bit;
+   bit = ffs(val >> 32);
+   if (bit != 0)
+      return 32 + bit;
 
-	return 0;
+   return 0;
 #endif
 }
 
+
 /**
  * Return number of bits set in given GLuint.
  */
diff-tree 1d74e565dbfc1a69c49fe67eed9c91f10d0ad2fc (from parents)
Merge: 7e85b0a025a82c3ffed060a757a3b4adae03d269 5a3d9853958993174f13c8cff6bcf11993a48f65
Author: Brian <brian at nostromo.localnet.net>
Date:   Fri Jan 26 18:55:12 2007 -0700

    Merge branch 'master' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa

diff-tree 7e85b0a025a82c3ffed060a757a3b4adae03d269 (from 18d1fdebebcb52e7fcf50e62c4c02862d173af51)
Author: Brian <brian at nostromo.localnet.net>
Date:   Tue Jan 23 12:50:08 2007 -0700

    silence C++ warnings

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 3f9f798..009055a 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -119,7 +119,7 @@ buffer_object_subdata_range_good( GLcont
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
       return NULL;
    }
-   if ((GLuint) (offset + size) > bufObj->Size) {
+   if (offset + size > bufObj->Size) {
       _mesa_error(ctx, GL_INVALID_VALUE,
 		  "%s(size + offset > buffer size)", caller);
       return NULL;
@@ -297,7 +297,7 @@ _mesa_buffer_subdata( GLcontext *ctx, GL
    (void) ctx; (void) target;
 
    /* this should have been caught in _mesa_BufferSubData() */
-   ASSERT((GLuint) (size + offset) <= bufObj->Size);
+   ASSERT(size + offset <= bufObj->Size);
 
    if (bufObj->Data) {
       _mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size );
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 75df50b..467b865 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -325,7 +325,8 @@ execute_shader(GLcontext *ctx, const str
    struct atifs_instruction *inst;
    struct atifs_setupinst *texinst;
    GLint optype;
-   GLint i, j, pass;
+   GLuint i;
+   GLint j, pass;
    GLint dstreg;
    GLfloat src[2][3][4];
    GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 };
@@ -348,7 +349,7 @@ execute_shader(GLcontext *ctx, const str
 
 	 /* setup the source registers for color and alpha ops */
 	 for (optype = 0; optype < 2; optype++) {
-	    for (i = 0; i < inst->ArgCount[optype]; i++) {
+ 	    for (i = 0; i < inst->ArgCount[optype]; i++) {
 	       GLint index = inst->SrcReg[optype][i].Index;
 
 	       if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI)
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index 284ea2b..35f2dd6 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -80,7 +80,10 @@ clear_rgba_buffer_with_masking(GLcontext
    else {
       ASSERT(span.array->ChanType == GL_FLOAT);
       for (i = 0; i < width; i++) {
-         COPY_4V(span.array->rgba[i], ctx->Color.ClearColor);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][0], ctx->Color.ClearColor[0]);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][1], ctx->Color.ClearColor[1]);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][2], ctx->Color.ClearColor[2]);
+         CLAMPED_FLOAT_TO_CHAN(span.array->rgba[i][3], ctx->Color.ClearColor[3]);
       }
    }
 
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index d4b8080..1c9a098 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -401,7 +401,7 @@ _swrast_validate_texture_images(GLcontex
             GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
             GLuint face;
             for (face = 0; face < numFaces; face++) {
-               GLuint lvl;
+               GLint lvl;
                for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
                   struct gl_texture_image *texImg = texObj->Image[face][lvl];
                   if (texImg && !texImg->Data) {
@@ -439,7 +439,7 @@ _swrast_eject_texture_images(GLcontext *
             GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
             GLuint face;
             for (face = 0; face < numFaces; face++) {
-               GLuint lvl;
+               GLint lvl;
                for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
                   struct gl_texture_image *texImg = texObj->Image[face][lvl];
                   if (texImg && texImg->Data) {
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index dbab6b3..a8aa1d4 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/src/mesa/swrast/s_stencil.c
@@ -1062,7 +1062,8 @@ void
 _swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb,
                           GLint n, GLint x, GLint y, GLstencil stencil[])
 {
-   if (y < 0 || y >= rb->Height || x + n <= 0 || x >= rb->Width) {
+   if (y < 0 || y >= (GLint) rb->Height ||
+       x + n <= 0 || x >= (GLint) rb->Width) {
       /* span is completely outside framebuffer */
       return; /* undefined values OK */
    }
@@ -1073,7 +1074,7 @@ _swrast_read_stencil_span(GLcontext *ctx
       n -= dx;
       stencil += dx;
    }
-   if (x + n > rb->Width) {
+   if (x + n > (GLint) rb->Width) {
       GLint dx = x + n - rb->Width;
       n -= dx;
    }
@@ -1103,7 +1104,8 @@ _swrast_write_stencil_span(GLcontext *ct
    const GLuint stencilMax = (1 << fb->Visual.stencilBits) - 1;
    const GLuint stencilMask = ctx->Stencil.WriteMask[0];
 
-   if (y < 0 || y >= rb->Height || x + n <= 0 || x >= rb->Width) {
+   if (y < 0 || y >= (GLint) rb->Height ||
+       x + n <= 0 || x >= (GLint) rb->Width) {
       /* span is completely outside framebuffer */
       return; /* undefined values OK */
    }
@@ -1113,7 +1115,7 @@ _swrast_write_stencil_span(GLcontext *ct
       n -= dx;
       stencil += dx;
    }
-   if (x + n > rb->Width) {
+   if (x + n > (GLint) rb->Width) {
       GLint dx = x + n - rb->Width;
       n -= dx;
    }
@@ -1191,7 +1193,7 @@ _swrast_clear_stencil_buffer( GLcontext 
       }
       else {
          /* no bit masking */
-         if (width == rb->Width && rb->DataType == GL_UNSIGNED_BYTE) {
+         if (width == (GLint) rb->Width && rb->DataType == GL_UNSIGNED_BYTE) {
             /* optimized case */
             /* Note: bottom-to-top raster assumed! */
             GLubyte *stencil = (GLubyte *) rb->GetPointer(ctx, rb, x, y);
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 29b8df4..036a608 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -209,7 +209,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
          for (i = 0; i < zoomedWidth; i++) {
             GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
             ASSERT(j >= 0);
-            ASSERT(j < span->end);
+            ASSERT(j < (GLint) span->end);
             COPY_4UBV(zoomed.array->color.sz1.rgba[i], rgba[j]);
          }
       }
@@ -219,7 +219,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
          for (i = 0; i < zoomedWidth; i++) {
             GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
             ASSERT(j >= 0);
-            ASSERT(j < span->end);
+            ASSERT(j < (GLint) span->end);
             COPY_4V(zoomed.array->color.sz2.rgba[i], rgba[j]);
          }
       }
@@ -229,7 +229,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
          for (i = 0; i < zoomedWidth; i++) {
             GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
             ASSERT(j >= 0);
-            ASSERT(j < span->end);
+            ASSERT(j < (GLint) span->end);
             COPY_4V(zoomed.array->color.sz4.rgba[i], rgba[j]);
          }
       }
@@ -241,7 +241,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
          for (i = 0; i < zoomedWidth; i++) {
             GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
             ASSERT(j >= 0);
-            ASSERT(j < span->end);
+            ASSERT(j < (GLint) span->end);
             zoomed.array->color.sz1.rgba[i][0] = rgb[j][0];
             zoomed.array->color.sz1.rgba[i][1] = rgb[j][1];
             zoomed.array->color.sz1.rgba[i][2] = rgb[j][2];
@@ -254,7 +254,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
          for (i = 0; i < zoomedWidth; i++) {
             GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
             ASSERT(j >= 0);
-            ASSERT(j < span->end);
+            ASSERT(j < (GLint) span->end);
             zoomed.array->color.sz2.rgba[i][0] = rgb[j][0];
             zoomed.array->color.sz2.rgba[i][1] = rgb[j][1];
             zoomed.array->color.sz2.rgba[i][2] = rgb[j][2];
@@ -267,7 +267,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
          for (i = 0; i < zoomedWidth; i++) {
             GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
             ASSERT(j >= 0);
-            ASSERT(j < span->end);
+            ASSERT(j < (GLint) span->end);
             zoomed.array->color.sz4.rgba[i][0] = rgb[j][0];
             zoomed.array->color.sz4.rgba[i][1] = rgb[j][1];
             zoomed.array->color.sz4.rgba[i][2] = rgb[j][2];
@@ -281,7 +281,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
       for (i = 0; i < zoomedWidth; i++) {
          GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
          ASSERT(j >= 0);
-         ASSERT(j < span->end);
+         ASSERT(j < (GLint) span->end);
          zoomed.array->index[i] = indexes[j];
       }
    }
@@ -291,7 +291,7 @@ zoom_span( GLcontext *ctx, GLint imgX, G
       for (i = 0; i < zoomedWidth; i++) {
          GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
          ASSERT(j >= 0);
-         ASSERT(j < span->end);
+         ASSERT(j < (GLint) span->end);
          zoomed.array->z[i] = zValues[j];
       }
       /* Now, fall into either the RGB or COLOR_INDEX path below */



More information about the mesa-commit mailing list