From: Brian Paul Date: Tue, 6 Jan 2009 00:52:14 +0000 (-0700) Subject: mesa: add GLushort cases for render to texture (Z-buffers) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5c9241cca3c57684db955390410c8cda44b785e;p=mesa.git mesa: add GLushort cases for render to texture (Z-buffers) --- diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 163bda45014..4ae13a7b9b5 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));