summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texformat.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2009-03-27 19:39:52 +0100
committerRoland Scheidegger <[email protected]>2009-03-28 02:02:42 +0100
commitc6a6cc191813e8343a17b028146a34f193a6ce44 (patch)
treecb1ecd35ac15c9b2c0cf3740dbdc631c7622233a /src/mesa/main/texformat.c
parenta9bf5b5ccac2a75f1a2470d4910361e65b2d8eab (diff)
mesa: add new signed rgba texture format
This is a (partial) backport of the signed texture format support in OGL 3.1. Since it wasn't promoted from an existing extension roll our own.
Diffstat (limited to 'src/mesa/main/texformat.c')
-rw-r--r--src/mesa/main/texformat.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index c372b49398a..0ceaaf3ecec 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -699,9 +699,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = {
const struct gl_texture_format _mesa_texformat_dudv8 = {
MESA_FORMAT_DUDV8, /* MesaFormat */
GL_DUDV_ATI, /* BaseFormat */
- /* FIXME: spec doesn't say since that parameter didn't exist then,
- but this should be something like SIGNED_NORMALIZED */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ GL_SIGNED_NORMALIZED, /* DataType */
/* maybe should add dudvBits field, but spec seems to be
lacking the ability to query with GetTexLevelParameter anyway */
0, /* RedBits */
@@ -724,6 +722,30 @@ const struct gl_texture_format _mesa_texformat_dudv8 = {
NULL /* StoreTexel */
};
+const struct gl_texture_format _mesa_texformat_signed_rgba8888 = {
+ MESA_FORMAT_SIGNED_RGBA8888, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_SIGNED_NORMALIZED, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* StencilBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel2D */
+ NULL, /* FetchTexel3D */
+ fetch_texel_1d_signed_rgba8888, /* FetchTexel1Df */
+ fetch_texel_2d_signed_rgba8888, /* FetchTexel2Df */
+ fetch_texel_3d_signed_rgba8888, /* FetchTexel3Df */
+ store_texel_signed_rgba8888 /* StoreTexel */
+};
+
/*@}*/
@@ -1671,6 +1693,17 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
}
}
+ if (ctx->Extensions.MESA_texture_signed_rgba) {
+ switch (internalFormat) {
+ case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
+ return &_mesa_texformat_signed_rgba8888;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+
#if FEATURE_EXT_texture_sRGB
if (ctx->Extensions.EXT_texture_sRGB) {
switch (internalFormat) {
@@ -1820,6 +1853,11 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*comps = 2;
return;
+ case MESA_FORMAT_SIGNED_RGBA8888:
+ *datatype = GL_BYTE;
+ *comps = 4;
+ return;
+
#if FEATURE_EXT_texture_sRGB
case MESA_FORMAT_SRGB8:
*datatype = GL_UNSIGNED_BYTE;