diff options
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r-- | src/mesa/main/texstore.c | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 1534583af82..8eaf43a6a90 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2191,6 +2191,7 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL88 || + dstFormat == MESA_FORMAT_SIGNED_RG88 || dstFormat == MESA_FORMAT_SIGNED_RG88_REV); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); @@ -2210,13 +2211,27 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) for (img = 0; img < srcDepth; img++) { GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { - GLbyte *dst = dstRow; - for (col = 0; col < srcWidth; col++) { - dst[0] = FLOAT_TO_BYTE_TEX(src[0]); - dst[1] = FLOAT_TO_BYTE_TEX(src[1]); - src += 2; - dst += 2; + GLushort *dst = (GLushort *) dstRow; + + if (dstFormat == MESA_FORMAT_SIGNED_AL88 || + dstFormat == MESA_FORMAT_SIGNED_RG88_REV) { + for (col = 0; col < srcWidth; col++) { + GLubyte l = FLOAT_TO_BYTE_TEX(src[0]); + GLubyte a = FLOAT_TO_BYTE_TEX(src[1]); + + dst[col] = PACK_COLOR_88_REV(l, a); + src += 2; + } + } else { + for (col = 0; col < srcWidth; col++) { + GLubyte l = FLOAT_TO_BYTE_TEX(src[0]); + GLubyte a = FLOAT_TO_BYTE_TEX(src[1]); + + dst[col] = PACK_COLOR_88(l, a); + src += 2; + } } + dstRow += dstRowStride; } } @@ -2278,6 +2293,7 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL1616 || + dstFormat == MESA_FORMAT_SIGNED_RG1616 || dstFormat == MESA_FORMAT_SIGNED_GR1616); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); @@ -2297,17 +2313,29 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { - GLshort *dst = (GLshort *) dstRow; - for (col = 0; col < srcWidth; col++) { - GLushort l, a; + GLuint *dst = (GLuint *) dstRow; - UNCLAMPED_FLOAT_TO_SHORT(l, src[0]); - UNCLAMPED_FLOAT_TO_SHORT(a, src[1]); - dst[0] = l; - dst[1] = a; - src += 2; - dst += 2; + if (dstFormat == MESA_FORMAT_SIGNED_AL1616 || + dstFormat == MESA_FORMAT_SIGNED_GR1616) { + for (col = 0; col < srcWidth; col++) { + GLushort l, a; + + UNCLAMPED_FLOAT_TO_SHORT(l, src[0]); + UNCLAMPED_FLOAT_TO_SHORT(a, src[1]); + dst[col] = PACK_COLOR_1616_REV(l, a); + src += 2; + } + } else { + for (col = 0; col < srcWidth; col++) { + GLushort l, a; + + UNCLAMPED_FLOAT_TO_SHORT(l, src[0]); + UNCLAMPED_FLOAT_TO_SHORT(a, src[1]); + dst[col] = PACK_COLOR_1616_REV(l, a); + src += 2; + } } + dstRow += dstRowStride; } } @@ -3828,6 +3856,9 @@ _mesa_get_texstore_func(gl_format format) table[MESA_FORMAT_ABGR2101010] = _mesa_texstore_abgr2101010; + table[MESA_FORMAT_SIGNED_RG88] = _mesa_texstore_snorm88; + table[MESA_FORMAT_SIGNED_RG1616] = _mesa_texstore_snorm1616; + initialized = GL_TRUE; } |