diff options
author | Brian Paul <brianp@vmware.com> | 2009-01-05 17:52:14 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-01-05 18:12:23 -0700 |
commit | c5c9241cca3c57684db955390410c8cda44b785e (patch) | |
tree | ef84a9b81ff81dc56953bd5d475f966ed22cca94 | |
parent | 9736d8f03364068c9ca786f88a4c2881d98d5768 (diff) |
mesa: add GLushort cases for render to texture (Z-buffers)
-rw-r--r-- | 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 163bda4501..4ae13a7b9b 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)); |