diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/teximage.c | 27 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 4 |
3 files changed, 20 insertions, 14 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 4a419fde26..1838e41e48 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -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 diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index b718c0046d..eb60a1fa8f 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -111,6 +111,9 @@ extern GLuint _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(). diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 75b14c2bf0..a5cf52b5a6 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3006,7 +3006,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint sizeInBytes; (void) border; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { + if (_mesa_is_color_format(internalFormat)) { _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; (void) border; - if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { + if (_mesa_is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } |