mesa: in textore.c, only adjust image for convolution if image is a color format
Makes things consistant with the code in teximage.c. We only want to apply convolution to color formats (not depth/index formats)
This commit is contained in:
@@ -388,9 +388,10 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
|
|||||||
* index, depth, stencil, etc).
|
* index, depth, stencil, etc).
|
||||||
* \param format the image format value (may by an internal texture format)
|
* \param format the image format value (may by an internal texture format)
|
||||||
* \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
|
* \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
|
||||||
|
* XXX maybe move this func to image.c
|
||||||
*/
|
*/
|
||||||
static GLboolean
|
GLboolean
|
||||||
is_color_format(GLenum format)
|
_mesa_is_color_format(GLenum format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GL_RED:
|
case GL_RED:
|
||||||
@@ -491,6 +492,7 @@ is_color_format(GLenum format)
|
|||||||
#endif /* FEATURE_EXT_texture_sRGB */
|
#endif /* FEATURE_EXT_texture_sRGB */
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
case GL_YCBCR_MESA: /* not considered to be RGB */
|
case GL_YCBCR_MESA: /* not considered to be RGB */
|
||||||
|
/* fall-through */
|
||||||
default:
|
default:
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -1576,9 +1578,9 @@ texture_error_check( GLcontext *ctx, GLenum target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make sure internal format and format basically agree */
|
/* make sure internal format and format basically agree */
|
||||||
colorFormat = is_color_format(format);
|
colorFormat = _mesa_is_color_format(format);
|
||||||
indexFormat = is_index_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_index_format(internalFormat) && !indexFormat) ||
|
||||||
(is_depth_format(internalFormat) != is_depth_format(format)) ||
|
(is_depth_format(internalFormat) != is_depth_format(format)) ||
|
||||||
(is_ycbcr_format(internalFormat) != is_ycbcr_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
|
* texture's format. Note that a color index texture can be converted
|
||||||
* to RGBA so that combo is allowed.
|
* to RGBA so that combo is allowed.
|
||||||
*/
|
*/
|
||||||
if (is_color_format(format)
|
if (_mesa_is_color_format(format)
|
||||||
&& !is_color_format(texImage->TexFormat->BaseFormat)
|
&& !_mesa_is_color_format(texImage->TexFormat->BaseFormat)
|
||||||
&& !is_index_format(texImage->TexFormat->BaseFormat)) {
|
&& !is_index_format(texImage->TexFormat->BaseFormat)) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
|
||||||
goto out;
|
goto out;
|
||||||
@@ -2419,7 +2421,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
|
|||||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
if (is_color_format(internalFormat)) {
|
if (_mesa_is_color_format(internalFormat)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2516,7 +2518,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
|
|||||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
if (is_color_format(internalFormat)) {
|
if (_mesa_is_color_format(internalFormat)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
||||||
&postConvHeight);
|
&postConvHeight);
|
||||||
}
|
}
|
||||||
@@ -2741,7 +2743,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
|
|||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
/* XXX should test internal format */
|
/* 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);
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2801,7 +2803,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
|
|||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
/* XXX should test internal format */
|
/* XXX should test internal format */
|
||||||
if (is_color_format(format)) {
|
if (_mesa_is_color_format(format)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
||||||
&postConvHeight);
|
&postConvHeight);
|
||||||
}
|
}
|
||||||
@@ -2916,7 +2918,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
|
|||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
if (is_color_format(internalFormat)) {
|
if (_mesa_is_color_format(internalFormat)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2981,7 +2983,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
|
|||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
if (is_color_format(internalFormat)) {
|
if (_mesa_is_color_format(internalFormat)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
||||||
&postConvHeight);
|
&postConvHeight);
|
||||||
}
|
}
|
||||||
@@ -3048,6 +3050,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
|
|||||||
_mesa_update_state(ctx);
|
_mesa_update_state(ctx);
|
||||||
|
|
||||||
#if FEATURE_convolve
|
#if FEATURE_convolve
|
||||||
|
|
||||||
/* XXX should test internal format */
|
/* XXX should test internal format */
|
||||||
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -111,6 +111,9 @@ extern GLuint
|
|||||||
_mesa_tex_target_to_face(GLenum target);
|
_mesa_tex_target_to_face(GLenum target);
|
||||||
|
|
||||||
|
|
||||||
|
extern GLboolean
|
||||||
|
_mesa_is_color_format(GLenum format);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lock a texture for updating. See also _mesa_lock_context_textures().
|
* Lock a texture for updating. See also _mesa_lock_context_textures().
|
||||||
|
@@ -3006,7 +3006,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
|
|||||||
GLint sizeInBytes;
|
GLint sizeInBytes;
|
||||||
(void) border;
|
(void) border;
|
||||||
|
|
||||||
if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
|
if (_mesa_is_color_format(internalFormat)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3080,7 +3080,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
|
|||||||
GLint texelBytes, sizeInBytes;
|
GLint texelBytes, sizeInBytes;
|
||||||
(void) border;
|
(void) border;
|
||||||
|
|
||||||
if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
|
if (_mesa_is_color_format(internalFormat)) {
|
||||||
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
|
||||||
&postConvHeight);
|
&postConvHeight);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user