summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c229
1 files changed, 87 insertions, 142 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ca1bd6096e2..bc66e5d76e0 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -33,7 +33,6 @@
#include "glheader.h"
#include "bufferobj.h"
#include "context.h"
-#include "convolve.h"
#include "enums.h"
#include "fbobject.h"
#include "framebuffer.h"
@@ -128,7 +127,7 @@ logbase2( int n )
* XXX this could be static
*/
GLint
-_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
+_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
{
switch (internalFormat) {
case GL_ALPHA:
@@ -404,29 +403,54 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
if (ctx->Extensions.ARB_texture_rg) {
switch (internalFormat) {
- case GL_R8:
- case GL_R16:
case GL_R16F:
+ /* R16F depends on both ARB_half_float_pixel and ARB_texture_float.
+ */
+ if (!ctx->Extensions.ARB_half_float_pixel)
+ break;
+ /* FALLTHROUGH */
case GL_R32F:
+ if (!ctx->Extensions.ARB_texture_float)
+ break;
+ return GL_RED;
case GL_R8I:
case GL_R8UI:
case GL_R16I:
case GL_R16UI:
case GL_R32I:
case GL_R32UI:
- return GL_R;
- case GL_RG:
- case GL_RG_INTEGER:
- case GL_RG8:
- case GL_RG16:
+ if (!ctx->Extensions.EXT_texture_integer)
+ break;
+ /* FALLTHROUGH */
+ case GL_R8:
+ case GL_R16:
+ case GL_RED:
+ case GL_COMPRESSED_RED:
+ return GL_RED;
+
case GL_RG16F:
+ /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float.
+ */
+ if (!ctx->Extensions.ARB_half_float_pixel)
+ break;
+ /* FALLTHROUGH */
case GL_RG32F:
+ if (!ctx->Extensions.ARB_texture_float)
+ break;
+ return GL_RG;
case GL_RG8I:
case GL_RG8UI:
case GL_RG16I:
case GL_RG16UI:
case GL_RG32I:
case GL_RG32UI:
+ if (!ctx->Extensions.EXT_texture_integer)
+ break;
+ /* FALLTHROUGH */
+ case GL_RG:
+ case GL_RG8:
+ case GL_RG16:
+ case GL_COMPRESSED_RG:
return GL_RG;
default:
; /* fallthrough */
@@ -462,15 +486,13 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
}
}
- if (ctx->Extensions.EXT_texture_compression_rgtc) {
+ if (ctx->Extensions.ARB_texture_compression_rgtc) {
switch (internalFormat) {
- case GL_COMPRESSED_RED:
- case GL_COMPRESSED_RED_RGTC1_EXT:
- case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT:
+ case GL_COMPRESSED_RED_RGTC1:
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
return GL_RED;
- case GL_COMPRESSED_RG:
- case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
- case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
+ case GL_COMPRESSED_RG_RGTC2:
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
return GL_RG;
default:
; /* fallthrough */
@@ -536,7 +558,7 @@ _mesa_set_tex_image(struct gl_texture_object *tObj,
* zero.
*/
struct gl_texture_image *
-_mesa_new_texture_image( GLcontext *ctx )
+_mesa_new_texture_image( struct gl_context *ctx )
{
(void) ctx;
return CALLOC_STRUCT(gl_texture_image);
@@ -552,7 +574,7 @@ _mesa_new_texture_image( GLcontext *ctx )
* Free the texture image data if it's not marked as client data.
*/
void
-_mesa_free_texture_image_data(GLcontext *ctx,
+_mesa_free_texture_image_data(struct gl_context *ctx,
struct gl_texture_image *texImage)
{
(void) ctx;
@@ -574,7 +596,7 @@ _mesa_free_texture_image_data(GLcontext *ctx,
* Free the texture image structure and the associated image data.
*/
void
-_mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage )
+_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *texImage )
{
/* Free texImage->Data and/or any other driver-specific texture
* image storage.
@@ -624,7 +646,7 @@ _mesa_is_proxy_texture(GLenum target)
* \sa gl_texture_unit.
*/
struct gl_texture_object *
-_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
GLenum target)
{
switch (target) {
@@ -681,7 +703,7 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
* Return pointer to texture object for given target on current texture unit.
*/
struct gl_texture_object *
-_mesa_get_current_tex_object(GLcontext *ctx, GLenum target)
+_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
{
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
return _mesa_select_tex_object(ctx, texUnit, target);
@@ -701,7 +723,7 @@ _mesa_get_current_tex_object(GLcontext *ctx, GLenum target)
* \return pointer to the texture image structure, or NULL on failure.
*/
struct gl_texture_image *
-_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
+_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj,
GLenum target, GLint level)
{
const GLuint face = _mesa_tex_target_to_face(target);
@@ -720,7 +742,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
* out of memory.
*/
struct gl_texture_image *
-_mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj,
+_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
GLenum target, GLint level)
{
struct gl_texture_image *texImage;
@@ -750,7 +772,7 @@ _mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj,
* level, or out of memory.
*/
struct gl_texture_image *
-_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level)
+_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
{
struct gl_texture_image *texImage;
GLuint texIndex;
@@ -825,7 +847,7 @@ _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level)
* \sa gl_constants.
*/
GLint
-_mesa_max_texture_levels(GLcontext *ctx, GLenum target)
+_mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
{
switch (target) {
case GL_TEXTURE_1D:
@@ -971,7 +993,7 @@ clear_teximage_fields(struct gl_texture_image *img)
* Note: width, height and depth include the border.
*/
void
-_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
+_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat)
@@ -1062,7 +1084,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
* fields are cleared so that its parent object will test incomplete.
*/
void
-_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage)
+_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage)
{
ctx->Driver.FreeTexImageData(ctx, texImage);
clear_teximage_fields(texImage);
@@ -1094,7 +1116,7 @@ _mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage)
* \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
*/
GLboolean
-_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat, GLenum format, GLenum type,
GLint width, GLint height, GLint depth, GLint border)
{
@@ -1206,7 +1228,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
* Helper function to determine whether a target supports compressed textures
*/
static GLboolean
-target_can_be_compressed(GLcontext *ctx, GLenum target)
+target_can_be_compressed(struct gl_context *ctx, GLenum target)
{
return (((target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D))
|| ((ctx->Extensions.ARB_texture_cube_map &&
@@ -1237,11 +1259,11 @@ target_can_be_compressed(GLcontext *ctx, GLenum target)
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*
* Verifies each of the parameters against the constants specified in
- * __GLcontextRec::Const and the supported extensions, and according to the
+ * __struct gl_contextRec::Const and the supported extensions, and according to the
* OpenGL specification.
*/
static GLboolean
-texture_error_check( GLcontext *ctx, GLenum target,
+texture_error_check( struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLenum format, GLenum type,
GLuint dimensions,
@@ -1484,11 +1506,11 @@ texture_error_check( GLcontext *ctx, GLenum target,
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*
* Verifies each of the parameters against the constants specified in
- * __GLcontextRec::Const and the supported extensions, and according to the
+ * __struct gl_contextRec::Const and the supported extensions, and according to the
* OpenGL specification.
*/
static GLboolean
-subtexture_error_check( GLcontext *ctx, GLuint dimensions,
+subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
@@ -1581,7 +1603,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
* \return GL_TRUE if error recorded, GL_FALSE otherwise
*/
static GLboolean
-subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
+subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
@@ -1679,11 +1701,11 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*
* Verifies each of the parameters against the constants specified in
- * __GLcontextRec::Const and the supported extensions, and according to the
+ * __struct gl_contextRec::Const and the supported extensions, and according to the
* OpenGL specification.
*/
static GLboolean
-copytexture_error_check( GLcontext *ctx, GLuint dimensions,
+copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level, GLint internalFormat,
GLint width, GLint height, GLint border )
{
@@ -1858,7 +1880,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*/
static GLboolean
-copytexsubimage_error_check1( GLcontext *ctx, GLuint dimensions,
+copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level)
{
/* Check that the source buffer is complete */
@@ -1932,7 +1954,7 @@ copytexsubimage_error_check1( GLcontext *ctx, GLuint dimensions,
* \param height image height given by the user.
*/
static GLboolean
-copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions,
+copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height,
@@ -2059,7 +2081,7 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions,
/** Callback info for walking over FBO hash table */
struct cb_info
{
- GLcontext *ctx;
+ struct gl_context *ctx;
struct gl_texture_object *texObj;
GLuint level, face;
};
@@ -2073,7 +2095,7 @@ check_rtt_cb(GLuint key, void *data, void *userData)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
const struct cb_info *info = (struct cb_info *) userData;
- GLcontext *ctx = info->ctx;
+ struct gl_context *ctx = info->ctx;
const struct gl_texture_object *texObj = info->texObj;
const GLuint level = info->level, face = info->face;
@@ -2105,7 +2127,7 @@ check_rtt_cb(GLuint key, void *data, void *userData)
* Any FBOs rendering into the texture must be re-validated.
*/
static void
-update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj,
+update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
GLuint face, GLuint level)
{
/* Only check this texture if it's been marked as RenderToTexture */
@@ -2126,7 +2148,7 @@ update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj,
* mipmap levels now.
*/
static INLINE void
-check_gen_mipmap(GLcontext *ctx, GLenum target,
+check_gen_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj, GLint level)
{
ASSERT(target != GL_TEXTURE_CUBE_MAP);
@@ -2192,7 +2214,7 @@ override_internal_format(GLenum internalFormat, GLint width, GLint height)
* comes up during automatic mipmap generation.
*/
void
-_mesa_choose_texture_format(GLcontext *ctx,
+_mesa_choose_texture_format(struct gl_context *ctx,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLenum target, GLint level,
@@ -2230,7 +2252,6 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
GLsizei width, GLint border, GLenum format,
GLenum type, const GLvoid *pixels )
{
- GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -2243,12 +2264,6 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
internalFormat = override_internal_format(internalFormat, width, 1);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (target == GL_TEXTURE_1D) {
/* non-proxy target */
struct gl_texture_object *texObj;
@@ -2256,7 +2271,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
const GLuint face = _mesa_tex_target_to_face(target);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 1, postConvWidth, 1, 1, border)) {
+ format, type, 1, width, 1, 1, border)) {
return; /* error was recorded */
}
@@ -2279,7 +2294,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, 1, 1,
+ width, 1, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
@@ -2311,7 +2326,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texImage = _mesa_get_proxy_tex_image(ctx, target, level);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 1, postConvWidth, 1, 1, border)) {
+ format, type, 1, width, 1, 1, border)) {
/* when error, clear all proxy texture image parameters */
if (texImage)
clear_teximage_fields(texImage);
@@ -2322,7 +2337,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
_mesa_get_current_tex_object(ctx, target);
ASSERT(texImage);
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, 1, 1,
+ width, 1, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
internalFormat, format, type);
@@ -2341,7 +2356,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
GLenum format, GLenum type,
const GLvoid *pixels )
{
- GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -2354,13 +2368,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
internalFormat = override_internal_format(internalFormat, width, height);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
- }
-#endif
-
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
@@ -2375,8 +2382,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
const GLuint face = _mesa_tex_target_to_face(target);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 2, postConvWidth, postConvHeight,
- 1, border)) {
+ format, type, 2, width, height, 1, border)) {
return; /* error was recorded */
}
@@ -2398,7 +2404,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
ASSERT(texImage->Data == NULL);
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, postConvHeight, 1,
+ width, height, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
@@ -2436,8 +2442,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texImage = _mesa_get_proxy_tex_image(ctx, target, level);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 2, postConvWidth, postConvHeight,
- 1, border)) {
+ format, type, 2, width, height, 1, border)) {
/* when error, clear all proxy texture image parameters */
if (texImage)
clear_teximage_fields(texImage);
@@ -2447,7 +2452,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_object *texObj =
_mesa_get_current_tex_object(ctx, target);
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, postConvHeight, 1,
+ width, height, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
internalFormat, format, type);
@@ -2634,7 +2639,6 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
GLenum format, GLenum type,
const GLvoid *pixels )
{
- GLsizei postConvWidth = width;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
@@ -2649,15 +2653,8 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- /* XXX should test internal format */
- if (_mesa_is_color_format(format)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0,
- postConvWidth, 1, 1, format, type)) {
+ width, 1, 1, format, type)) {
return; /* error was detected */
}
@@ -2670,8 +2667,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (subtexture_error_check2(ctx, 1, target, level, xoffset, 0, 0,
- postConvWidth, 1, 1,
- format, type, texImage)) {
+ width, 1, 1, format, type, texImage)) {
/* error was recorded */
}
else if (width > 0) {
@@ -2699,7 +2695,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
GLenum format, GLenum type,
const GLvoid *pixels )
{
- GLsizei postConvWidth = width, postConvHeight = height;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
@@ -2715,16 +2710,8 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- /* XXX should test internal format */
- if (_mesa_is_color_format(format)) {
- _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
- }
-#endif
-
if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
- postConvWidth, postConvHeight, 1, format, type)) {
+ width, height, 1, format, type)) {
return; /* error was detected */
}
@@ -2735,8 +2722,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (subtexture_error_check2(ctx, 2, target, level, xoffset, yoffset, 0,
- postConvWidth, postConvHeight, 1,
- format, type, texImage)) {
+ width, height, 1, format, type, texImage)) {
/* error was recorded */
}
else if (width > 0 && height >= 0) {
@@ -2829,7 +2815,6 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width;
const GLuint face = _mesa_tex_target_to_face(target);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -2843,14 +2828,8 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (copytexture_error_check(ctx, 1, target, level, internalFormat,
- postConvWidth, 1, border))
+ width, 1, border))
return;
texObj = _mesa_get_current_tex_object(ctx, target);
@@ -2869,7 +2848,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
ASSERT(texImage->Data == NULL);
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
@@ -2904,7 +2883,6 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width, postConvHeight = height;
const GLuint face = _mesa_tex_target_to_face(target);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -2918,15 +2896,8 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
if (ctx->NewState & NEW_COPY_TEX_STATE)
_mesa_update_state(ctx);
-#if FEATURE_convolve
- if (_mesa_is_color_format(internalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
- &postConvHeight);
- }
-#endif
-
if (copytexture_error_check(ctx, 2, target, level, internalFormat,
- postConvWidth, postConvHeight, border))
+ width, height, border))
return;
texObj = _mesa_get_current_tex_object(ctx, target);
@@ -2947,7 +2918,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, postConvHeight, 1,
+ width, height, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
@@ -2980,7 +2951,6 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width;
GLint yoffset = 0;
GLsizei height = 1;
@@ -3004,15 +2974,8 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-#if FEATURE_convolve
- if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
- }
-#endif
-
if (copytexsubimage_error_check2(ctx, 1, target, level,
- xoffset, 0, 0, postConvWidth, 1,
- texImage)) {
+ xoffset, 0, 0, width, 1, texImage)) {
/* error was recorded */
}
else {
@@ -3043,7 +3006,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -3064,17 +3026,9 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-#if FEATURE_convolve
- if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2,
- &postConvWidth, &postConvHeight);
- }
-#endif
-
if (copytexsubimage_error_check2(ctx, 2, target, level,
xoffset, yoffset, 0,
- postConvWidth, postConvHeight,
- texImage)) {
+ width, height, texImage)) {
/* error was recorded */
}
else {
@@ -3106,7 +3060,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -3127,16 +3080,8 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
-#if FEATURE_convolve
- if (texImage && _mesa_is_color_format(texImage->InternalFormat)) {
- _mesa_adjust_image_for_convolution(ctx, 2,
- &postConvWidth, &postConvHeight);
- }
-#endif
-
if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset,
- zoffset, postConvWidth, postConvHeight,
- texImage)) {
+ zoffset, width, height, texImage)) {
/* error was recored */
}
else {
@@ -3197,7 +3142,7 @@ get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
* \return error code or GL_NO_ERROR.
*/
static GLenum
-compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
+compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLsizei height, GLsizei depth, GLint border,
@@ -3304,7 +3249,7 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
* \return error code or GL_NO_ERROR.
*/
static GLenum
-compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
+compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
@@ -3388,7 +3333,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
* \return GL_TRUE if error found, GL_FALSE otherwise.
*/
static GLboolean
-compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims,
+compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
GLsizei width, GLsizei height,
GLsizei depth, GLenum format,
struct gl_texture_image *texImage)