summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-12-22 19:29:56 +0100
committerMarek Olšák <[email protected]>2011-01-04 21:59:56 +0100
commit50630f9016bdf0ea33ae1007c5a523cdcde3e3c9 (patch)
treecd9a19d1c36c44f49af5370e59dce2c99c62c5fa /src/mesa/main/texstore.c
parent73e8a2738743035e1347571ba630747d2ec33a2d (diff)
mesa: preserve 10 bits of precision in the texstore general path for ARGB2101010
Use make_temp_float_image instead of _make_temp_chan_image. The latter converts the texture to 8 bits/component, losing 2 bits.
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index acb390b7810..de99e6c1862 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2063,13 +2063,14 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
}
else {
/* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ const GLfloat *tempImage = make_temp_float_image(ctx, dims,
baseInternalFormat,
baseFormat,
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
+ srcPacking,
+ ctx->_ImageTransferState);
+ const GLfloat *src = tempImage;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
@@ -2080,24 +2081,29 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
+ dstXoffset * texelBytes;
if (baseInternalFormat == GL_RGBA) {
for (row = 0; row < srcHeight; row++) {
- GLuint *dstUS = (GLuint *) dstRow;
+ GLuint *dstUI = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_2101010( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
+ GLushort a,r,g,b;
+
+ UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+ dstUI[col] = PACK_COLOR_2101010_US(a, r, g, b);
src += 4;
}
dstRow += dstRowStride;
}
} else if (baseInternalFormat == GL_RGB) {
for (row = 0; row < srcHeight; row++) {
- GLuint *dstUS = (GLuint *) dstRow;
+ GLuint *dstUI = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_2101010( 0xff,
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
+ GLushort r,g,b;
+
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+ dstUI[col] = PACK_COLOR_2101010_US(0xffff, r, g, b);
src += 4;
}
dstRow += dstRowStride;