|
|
|
@@ -388,9 +388,10 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) |
|
|
|
* index, depth, stencil, etc). |
|
|
|
* \param format the image format value (may by an internal texture format) |
|
|
|
* \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise. |
|
|
|
* XXX maybe move this func to image.c |
|
|
|
*/ |
|
|
|
static GLboolean |
|
|
|
is_color_format(GLenum format) |
|
|
|
GLboolean |
|
|
|
_mesa_is_color_format(GLenum format) |
|
|
|
{ |
|
|
|
switch (format) { |
|
|
|
case GL_RED: |
|
|
|
@@ -491,6 +492,7 @@ is_color_format(GLenum format) |
|
|
|
#endif /* FEATURE_EXT_texture_sRGB */ |
|
|
|
return GL_TRUE; |
|
|
|
case GL_YCBCR_MESA: /* not considered to be RGB */ |
|
|
|
/* fall-through */ |
|
|
|
default: |
|
|
|
return GL_FALSE; |
|
|
|
} |
|
|
|
@@ -1576,9 +1578,9 @@ texture_error_check( GLcontext *ctx, GLenum target, |
|
|
|
} |
|
|
|
|
|
|
|
/* make sure internal format and format basically agree */ |
|
|
|
colorFormat = is_color_format(format); |
|
|
|
colorFormat = _mesa_is_color_format(format); |
|
|
|
indexFormat = is_index_format(format); |
|
|
|
if ((is_color_format(internalFormat) && !colorFormat && !indexFormat) || |
|
|
|
if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) || |
|
|
|
(is_index_format(internalFormat) && !indexFormat) || |
|
|
|
(is_depth_format(internalFormat) != is_depth_format(format)) || |
|
|
|
(is_ycbcr_format(internalFormat) != is_ycbcr_format(format)) || |
|
|
|
@@ -2325,8 +2327,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, |
|
|
|
* texture's format. Note that a color index texture can be converted |
|
|
|
* to RGBA so that combo is allowed. |
|
|
|
*/ |
|
|
|
if (is_color_format(format) |
|
|
|
&& !is_color_format(texImage->TexFormat->BaseFormat) |
|
|
|
if (_mesa_is_color_format(format) |
|
|
|
&& !_mesa_is_color_format(texImage->TexFormat->BaseFormat) |
|
|
|
&& !is_index_format(texImage->TexFormat->BaseFormat)) { |
|
|
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); |
|
|
|
goto out; |
|
|
|
@@ -2419,7 +2421,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, |
|
|
|
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
if (is_color_format(internalFormat)) { |
|
|
|
if (_mesa_is_color_format(internalFormat)) { |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
|
|
|
} |
|
|
|
#endif |
|
|
|
@@ -2516,7 +2518,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, |
|
|
|
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
if (is_color_format(internalFormat)) { |
|
|
|
if (_mesa_is_color_format(internalFormat)) { |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
|
|
|
&postConvHeight); |
|
|
|
} |
|
|
|
@@ -2741,7 +2743,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
/* XXX should test internal format */ |
|
|
|
if (is_color_format(format)) { |
|
|
|
if (_mesa_is_color_format(format)) { |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
|
|
|
} |
|
|
|
#endif |
|
|
|
@@ -2801,7 +2803,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
/* XXX should test internal format */ |
|
|
|
if (is_color_format(format)) { |
|
|
|
if (_mesa_is_color_format(format)) { |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
|
|
|
&postConvHeight); |
|
|
|
} |
|
|
|
@@ -2916,7 +2918,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, |
|
|
|
_mesa_update_state(ctx); |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
if (is_color_format(internalFormat)) { |
|
|
|
if (_mesa_is_color_format(internalFormat)) { |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
|
|
|
} |
|
|
|
#endif |
|
|
|
@@ -2981,7 +2983,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, |
|
|
|
_mesa_update_state(ctx); |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
if (is_color_format(internalFormat)) { |
|
|
|
if (_mesa_is_color_format(internalFormat)) { |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
|
|
|
&postConvHeight); |
|
|
|
} |
|
|
|
@@ -3048,6 +3050,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, |
|
|
|
_mesa_update_state(ctx); |
|
|
|
|
|
|
|
#if FEATURE_convolve |
|
|
|
|
|
|
|
/* XXX should test internal format */ |
|
|
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
|
|
|
#endif |