aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texformat.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-22 19:42:40 +0000
committermarha <marha@users.sourceforge.net>2010-11-22 19:42:40 +0000
commit85ef9930f56bf15181f9a0b238f03d55303cf411 (patch)
tree63b43286956ebd1c35c96e9b3d5305aabdf71a0f /mesalib/src/mesa/main/texformat.c
parent94810d19989336862251dbf69c3f3acb18a9b06d (diff)
downloadvcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.tar.gz
vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.tar.bz2
vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.zip
Updated to mesalib 7.9
Diffstat (limited to 'mesalib/src/mesa/main/texformat.c')
-rw-r--r--mesalib/src/mesa/main/texformat.c95
1 files changed, 87 insertions, 8 deletions
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 096945a64..b9271ef58 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -61,12 +61,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
(void) type;
switch (internalFormat) {
- /* RGBA formats */
+ /* shallow RGBA formats */
case 4:
case GL_RGBA:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
case GL_RGBA8:
return MESA_FORMAT_RGBA8888;
case GL_RGB5_A1:
@@ -76,12 +73,15 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_RGBA4:
return MESA_FORMAT_ARGB4444;
- /* RGB formats */
+ /* deep RGBA formats */
+ case GL_RGB10_A2:
+ case GL_RGBA12:
+ case GL_RGBA16:
+ return MESA_FORMAT_RGBA_16;
+
+ /* shallow RGB formats */
case 3:
case GL_RGB:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
case GL_RGB8:
return MESA_FORMAT_RGB888;
case GL_R3_G3_B2:
@@ -91,6 +91,12 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_RGB5:
return MESA_FORMAT_RGB565;
+ /* deep RGB formats */
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ return MESA_FORMAT_RGBA_16;
+
/* Alpha formats */
case GL_ALPHA:
case GL_ALPHA4:
@@ -294,6 +300,32 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
}
}
+ if (ctx->VersionMajor * 10 + ctx->VersionMinor >= 31) {
+ switch (internalFormat) {
+ case GL_RED_SNORM:
+ case GL_R8_SNORM:
+ return MESA_FORMAT_SIGNED_R8;
+ case GL_RG_SNORM:
+ case GL_RG8_SNORM:
+ return MESA_FORMAT_SIGNED_RG88;
+ case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
+ return MESA_FORMAT_SIGNED_RGBX8888;
+ case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
+ return MESA_FORMAT_SIGNED_RGBA8888;
+ case GL_R16_SNORM:
+ return MESA_FORMAT_SIGNED_R_16;
+ case GL_RG16_SNORM:
+ return MESA_FORMAT_SIGNED_RG_16;
+ case GL_RGB16_SNORM:
+ return MESA_FORMAT_SIGNED_RGB_16;
+ case GL_RGBA16_SNORM:
+ return MESA_FORMAT_SIGNED_RGBA_16;
+ default:
+ ; /* fall-through */
+ }
+ }
#if FEATURE_EXT_texture_sRGB
if (ctx->Extensions.EXT_texture_sRGB) {
@@ -350,6 +382,53 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
}
#endif /* FEATURE_EXT_texture_sRGB */
+ if (ctx->Extensions.EXT_texture_integer) {
+ switch (internalFormat) {
+ case GL_RGBA32UI_EXT:
+ case GL_RGB32UI_EXT:
+ case GL_ALPHA32UI_EXT:
+ case GL_INTENSITY32UI_EXT:
+ case GL_LUMINANCE32UI_EXT:
+ case GL_LUMINANCE_ALPHA32UI_EXT:
+ return MESA_FORMAT_RGBA_UINT32;
+ case GL_RGBA16UI_EXT:
+ case GL_RGB16UI_EXT:
+ case GL_ALPHA16UI_EXT:
+ case GL_INTENSITY16UI_EXT:
+ case GL_LUMINANCE16UI_EXT:
+ case GL_LUMINANCE_ALPHA16UI_EXT:
+ return MESA_FORMAT_RGBA_UINT16;
+ case GL_RGBA8UI_EXT:
+ case GL_RGB8UI_EXT:
+ case GL_ALPHA8UI_EXT:
+ case GL_INTENSITY8UI_EXT:
+ case GL_LUMINANCE8UI_EXT:
+ case GL_LUMINANCE_ALPHA8UI_EXT:
+ return MESA_FORMAT_RGBA_UINT8;
+ case GL_RGBA32I_EXT:
+ case GL_RGB32I_EXT:
+ case GL_ALPHA32I_EXT:
+ case GL_INTENSITY32I_EXT:
+ case GL_LUMINANCE32I_EXT:
+ case GL_LUMINANCE_ALPHA32I_EXT:
+ return MESA_FORMAT_RGBA_INT32;
+ case GL_RGBA16I_EXT:
+ case GL_RGB16I_EXT:
+ case GL_ALPHA16I_EXT:
+ case GL_INTENSITY16I_EXT:
+ case GL_LUMINANCE16I_EXT:
+ case GL_LUMINANCE_ALPHA16I_EXT:
+ return MESA_FORMAT_RGBA_INT16;
+ case GL_RGBA8I_EXT:
+ case GL_RGB8I_EXT:
+ case GL_ALPHA8I_EXT:
+ case GL_INTENSITY8I_EXT:
+ case GL_LUMINANCE8I_EXT:
+ case GL_LUMINANCE_ALPHA8I_EXT:
+ return MESA_FORMAT_RGBA_INT8;
+ }
+ }
+
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
return MESA_FORMAT_NONE;
}