summaryrefslogtreecommitdiff
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@tungstengraphics.com>2008-12-12 05:06:48 +0100
committerRoland Scheidegger <sroland@tungstengraphics.com>2008-12-12 05:12:48 +0100
commit5bd093bd7b3711f88e1fd0fc9cdb37a18d7d24b9 (patch)
tree455ddf79b8f86c7c3c9ef2853ccfa304019d5e14 /src/mesa/main/texstore.c
parent9106a18f46cd83180b17f4b30f54bd2d5b437db1 (diff)
mesa: fixes for srgb, new srgb formats
add some more srgb texture formats, including compressed ones various fixes relating to srgb formats issues: _mesa_get_teximage is completely broken for srgb textures, both for non-compressed ones (swizzling) and compressed ones (shouldn't do standard-to-linear conversion) texelFetch function may be broken for little or big endian (or both...)
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 7278180a5c..8afb947fa1 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3,6 +3,7 @@
* Version: 7.3
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (c) 2008 VMware, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -2662,7 +2663,6 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_srgb8(TEXSTORE_PARAMS)
{
- const GLboolean littleEndian = _mesa_little_endian();
const struct gl_texture_format *newDstFormat;
StoreTexImageFunc store;
GLboolean k;
@@ -2670,14 +2670,8 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS)
ASSERT(dstFormat == &_mesa_texformat_srgb8);
/* reuse normal rgb texstore code */
- if (littleEndian) {
- newDstFormat = &_mesa_texformat_bgr888;
- store = _mesa_texstore_bgr888;
- }
- else {
- newDstFormat = &_mesa_texformat_rgb888;
- store = _mesa_texstore_rgb888;
- }
+ newDstFormat = &_mesa_texformat_rgb888;
+ store = _mesa_texstore_rgb888;
k = store(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
@@ -2693,17 +2687,13 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_srgba8(TEXSTORE_PARAMS)
{
- const GLboolean littleEndian = _mesa_little_endian();
const struct gl_texture_format *newDstFormat;
GLboolean k;
ASSERT(dstFormat == &_mesa_texformat_srgba8);
/* reuse normal rgba texstore code */
- if (littleEndian)
- newDstFormat = &_mesa_texformat_rgba8888_rev;
- else
- newDstFormat = &_mesa_texformat_rgba8888;
+ newDstFormat = &_mesa_texformat_rgba8888;
k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
@@ -2717,6 +2707,28 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS)
GLboolean
+_mesa_texstore_sargb8(TEXSTORE_PARAMS)
+{
+ const struct gl_texture_format *newDstFormat;
+ GLboolean k;
+
+ ASSERT(dstFormat == &_mesa_texformat_sargb8);
+
+ /* reuse normal rgba texstore code */
+ newDstFormat = &_mesa_texformat_argb8888;
+
+ k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
+ newDstFormat, dstAddr,
+ dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageOffsets,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType,
+ srcAddr, srcPacking);
+ return k;
+}
+
+
+GLboolean
_mesa_texstore_sl8(TEXSTORE_PARAMS)
{
const struct gl_texture_format *newDstFormat;
@@ -2741,17 +2753,13 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_sla8(TEXSTORE_PARAMS)
{
- const GLboolean littleEndian = _mesa_little_endian();
const struct gl_texture_format *newDstFormat;
GLboolean k;
ASSERT(dstFormat == &_mesa_texformat_sla8);
/* reuse normal luminance/alpha texstore code */
- if (littleEndian)
- newDstFormat = &_mesa_texformat_al88;
- else
- newDstFormat = &_mesa_texformat_al88_rev;
+ newDstFormat = &_mesa_texformat_al88;
k = _mesa_texstore_al88(ctx, dims, baseInternalFormat,
newDstFormat, dstAddr,
@@ -3581,6 +3589,7 @@ is_srgb_teximage(const struct gl_texture_image *texImage)
switch (texImage->TexFormat->MesaFormat) {
case MESA_FORMAT_SRGB8:
case MESA_FORMAT_SRGBA8:
+ case MESA_FORMAT_SARGB8:
case MESA_FORMAT_SL8:
case MESA_FORMAT_SLA8:
return GL_TRUE;
@@ -3713,6 +3722,10 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
MEMCPY(dest,
(const GLubyte *) texImage->Data + row * rowstride,
comps * width * sizeof(GLubyte));
+ /* FIXME: isn't it necessary to still do component assigning
+ according to format/type? */
+ /* FIXME: need to do something else for compressed srgb textures
+ (currently will return values converted to linear) */
}
#endif /* FEATURE_EXT_texture_sRGB */
else {