diff options
author | Brian Paul <[email protected]> | 2006-08-04 03:44:53 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-08-04 03:44:53 +0000 |
commit | 0a4be7036864efa6b30d78e0aac449d34b812c13 (patch) | |
tree | fd8e2d967bbeb0ebd931b9b5521573d6ca1e4b61 /src/mesa/main/teximage.c | |
parent | 2eb00b4388c6e9ca3a1303e7f849c060e99cd0a5 (diff) |
more work for GL_EXT_texture_sRGB.
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2ada4a89420..14024fec047 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -348,6 +348,36 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) } } +#if FEATURE_EXT_texture_sRGB + if (ctx->Extensions.EXT_texture_sRGB) { + switch (internalFormat) { + case GL_SRGB_EXT: + case GL_SRGB8_EXT: + case GL_COMPRESSED_SRGB_EXT: + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + return GL_RGB; + case GL_SRGB_ALPHA_EXT: + case GL_SRGB8_ALPHA8_EXT: + case GL_COMPRESSED_SRGB_ALPHA_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + return GL_RGBA; + case GL_SLUMINANCE_ALPHA_EXT: + case GL_SLUMINANCE8_ALPHA8_EXT: + case GL_COMPRESSED_SLUMINANCE_EXT: + case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: + return GL_LUMINANCE_ALPHA; + case GL_SLUMINANCE_EXT: + case GL_SLUMINANCE8_EXT: + return GL_LUMINANCE; + default: + ; /* fallthrough */ + } + } + +#endif /* FEATURE_EXT_texture_sRGB */ + return -1; /* error */ } @@ -440,6 +470,24 @@ is_color_format(GLenum format) case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: +#if FEATURE_EXT_texture_sRGB + case GL_SRGB_EXT: + case GL_SRGB8_EXT: + case GL_SRGB_ALPHA_EXT: + case GL_SRGB8_ALPHA8_EXT: + case GL_SLUMINANCE_ALPHA_EXT: + case GL_SLUMINANCE8_ALPHA8_EXT: + case GL_SLUMINANCE_EXT: + case GL_SLUMINANCE8_EXT: + case GL_COMPRESSED_SRGB_EXT: + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + case GL_COMPRESSED_SLUMINANCE_EXT: + case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: +#endif /* FEATURE_EXT_texture_sRGB */ return GL_TRUE; case GL_YCBCR_MESA: /* not considered to be RGB */ default: @@ -1646,6 +1694,20 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } +#if FEATURE_EXT_texture_sRGB + if (destTex->InternalFormat == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT || + destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT || + destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT || + destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) { + if ((width & 0x3) || (height & 0x3) || + (xoffset & 0x3) || (yoffset & 0x3)) + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%dD(size or offset not multiple of 4)", + dimensions); + return GL_TRUE; + } +#endif + if (destTex->IsCompressed) { const struct gl_texture_unit *texUnit; const struct gl_texture_image *texImage; @@ -2951,6 +3013,16 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, if (expectedSize != imageSize) return GL_INVALID_VALUE; +#if FEATURE_EXT_texture_sRGB + if ((internalFormat == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT || + internalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT || + internalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT || + internalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) + && border != 0) { + return GL_INVALID_OPERATION; + } +#endif + return GL_NO_ERROR; } |