summaryrefslogtreecommitdiff
path: root/src/mesa/main/texformat_tmp.h
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/texformat_tmp.h
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/texformat_tmp.h')
-rw-r--r--src/mesa/main/texformat_tmp.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h
index 7499ba7b36..b1031b0cfe 100644
--- a/src/mesa/main/texformat_tmp.h
+++ b/src/mesa/main/texformat_tmp.h
@@ -3,6 +3,7 @@
* Version: 6.5.1
*
* Copyright (C) 1999-2006 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"),
@@ -1191,6 +1192,31 @@ static void store_texel_srgba8(struct gl_texture_image *texImage,
dst[0] = rgba[RCOMP];
dst[1] = rgba[GCOMP];
dst[2] = rgba[BCOMP];
+ dst[3] = rgba[ACOMP];
+}
+#endif
+
+/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
+static void FETCH(sargb8)(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
+ texel[RCOMP] = nonlinear_to_linear(src[1]);
+ texel[GCOMP] = nonlinear_to_linear(src[2]);
+ texel[BCOMP] = nonlinear_to_linear(src[3]);
+ texel[ACOMP] = UBYTE_TO_FLOAT(src[0]); /* linear! */
+}
+
+#if DIM == 3
+static void store_texel_sargb8(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
+ dst[0] = rgba[ACOMP];
+ dst[1] = rgba[RCOMP];
+ dst[2] = rgba[GCOMP];
+ dst[3] = rgba[BCOMP];
}
#endif