Mesa (master): mesa: add GLushort cases for render to texture (Z-buffers)

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 5 17:13:03 PST 2009


Module: Mesa
Branch: master
Commit: c5c9241cca3c57684db955390410c8cda44b785e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5c9241cca3c57684db955390410c8cda44b785e

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jan  5 17:52:14 2009 -0700

mesa: add GLushort cases for render to texture (Z-buffers)

---

 src/mesa/main/texrender.c |   52 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index 163bda4..4ae13a7 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -49,6 +49,14 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
          trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i);
       }
    }
+   else if (rb->DataType == GL_UNSIGNED_SHORT) {
+      GLushort *zValues = (GLushort *) values;
+      for (i = 0; i < count; i++) {
+         GLfloat flt;
+         trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+         zValues[i] = (GLushort) (flt * 0xffff);
+      }
+   }
    else if (rb->DataType == GL_UNSIGNED_INT) {
       GLuint *zValues = (GLuint *) values;
       /*
@@ -96,6 +104,15 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
 				    z, rgbaOut + 4 * i);
       }
    }
+   else if (rb->DataType == GL_UNSIGNED_SHORT) {
+      GLushort *zValues = (GLushort *) values;
+      for (i = 0; i < count; i++) {
+         GLfloat flt;
+         trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+				    z, &flt);
+         zValues[i] = (GLushort) (flt * 0xffff);
+      }
+   }
    else if (rb->DataType == GL_UNSIGNED_INT) {
       GLuint *zValues = (GLuint *) values;
       for (i = 0; i < count; i++) {
@@ -147,6 +164,14 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
          rgba += 4;
       }
    }
+   else if (rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLushort *zValues = (const GLushort *) values;
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            trb->Store(trb->TexImage, x + i, y, z, zValues + i);
+         }
+      }
+   }
    else if (rb->DataType == GL_UNSIGNED_INT) {
       const GLuint *zValues = (const GLuint *) values;
       for (i = 0; i < count; i++) {
@@ -189,6 +214,14 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
          }
       }
    }
+   else if (rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLushort zValue = *((const GLushort *) value);
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            trb->Store(trb->TexImage, x + i, y, z, &zValue);
+         }
+      }
+   }
    else if (rb->DataType == GL_UNSIGNED_INT) {
       const GLuint zValue = *((const GLuint *) value);
       for (i = 0; i < count; i++) {
@@ -231,12 +264,19 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
          rgba += 4;
       }
    }
+   else if (rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLushort *zValues = (const GLushort *) values;
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
+         }
+      }
+   }
    else if (rb->DataType == GL_UNSIGNED_INT) {
       const GLuint *zValues = (const GLuint *) values;
       for (i = 0; i < count; i++) {
          if (!mask || mask[i]) {
-            trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z,
-		       zValues + i);
+            trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
          }
       }
    }
@@ -281,6 +321,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
          }
       }
    }
+   else if (rb->DataType == GL_UNSIGNED_SHORT) {
+      const GLushort zValue = *((const GLushort *) value);
+      for (i = 0; i < count; i++) {
+         if (!mask || mask[i]) {
+            trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &zValue);
+         }
+      }
+   }
    else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
       const GLuint zValue = *((const GLuint *) value);
       const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff));



More information about the mesa-commit mailing list