summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-06-26 12:38:21 +1000
committerTimothy Arceri <[email protected]>2017-06-27 08:15:09 +1000
commitc7f7a375d90166fcb765cb4c008a07b083b853ff (patch)
treede25667f51010e77cb1a5f545953f447af3ea1e7
parent45498aff8234b6c250c8cb633865d858c4cf1c7b (diff)
mesa: create copy_texture_sub_image_err() helper
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r--src/mesa/main/teximage.c84
1 files changed, 48 insertions, 36 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 88c76f0c1b2..9d39759c3da 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3717,27 +3717,10 @@ copy_texture_sub_image(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height,
- const char *caller)
+ GLint x, GLint y, GLsizei width, GLsizei height)
{
struct gl_texture_image *texImage;
- FLUSH_VERTICES(ctx, 0);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "%s %s %d %d %d %d %d %d %d %d\n", caller,
- _mesa_enum_to_string(target),
- level, xoffset, yoffset, zoffset, x, y, width, height);
-
- if (ctx->NewState & NEW_COPY_TEX_STATE)
- _mesa_update_state(ctx);
-
- if (copytexsubimage_error_check(ctx, dims, texObj, target, level,
- xoffset, yoffset, zoffset,
- width, height, caller)) {
- return;
- }
-
_mesa_lock_texture(ctx, texObj);
texImage = _mesa_select_tex_image(texObj, target, level);
@@ -3775,6 +3758,35 @@ copy_texture_sub_image(struct gl_context *ctx, GLuint dims,
}
+static void
+copy_texture_sub_image_err(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_object *texObj,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ const char *caller)
+{
+ FLUSH_VERTICES(ctx, 0);
+
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "%s %s %d %d %d %d %d %d %d %d\n", caller,
+ _mesa_enum_to_string(target),
+ level, xoffset, yoffset, zoffset, x, y, width, height);
+
+ if (ctx->NewState & NEW_COPY_TEX_STATE)
+ _mesa_update_state(ctx);
+
+ if (copytexsubimage_error_check(ctx, dims, texObj, target, level,
+ xoffset, yoffset, zoffset,
+ width, height, caller)) {
+ return;
+ }
+
+ copy_texture_sub_image(ctx, dims, texObj, target, level, xoffset, yoffset,
+ zoffset, x, y, width, height);
+}
+
+
/**
* Implement the glCopyTexImage1/2D() functions.
*/
@@ -3827,8 +3839,8 @@ copyteximage(struct gl_context *ctx, GLuint dims,
if (texImage && can_avoid_reallocation(texImage, internalFormat, texFormat,
x, y, width, height, border)) {
_mesa_unlock_texture(ctx, texObj);
- copy_texture_sub_image(ctx, dims, texObj, target, level, 0, 0, 0, x, y,
- width, height,"CopyTexImage");
+ copy_texture_sub_image_err(ctx, dims, texObj, target, level, 0, 0, 0,
+ x, y, width, height,"CopyTexImage");
return;
}
}
@@ -3977,8 +3989,8 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
if (!texObj)
return;
- copy_texture_sub_image(ctx, 1, texObj, target, level, xoffset, 0, 0,
- x, y, width, 1, self);
+ copy_texture_sub_image_err(ctx, 1, texObj, target, level, xoffset, 0, 0,
+ x, y, width, 1, self);
}
void GLAPIENTRY
@@ -4003,8 +4015,8 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
if (!texObj)
return;
- copy_texture_sub_image(ctx, 2, texObj, target, level, xoffset, yoffset, 0,
- x, y, width, height, self);
+ copy_texture_sub_image_err(ctx, 2, texObj, target, level, xoffset, yoffset,
+ 0, x, y, width, height, self);
}
@@ -4031,8 +4043,8 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
if (!texObj)
return;
- copy_texture_sub_image(ctx, 3, texObj, target, level, xoffset, yoffset,
- zoffset, x, y, width, height, self);
+ copy_texture_sub_image_err(ctx, 3, texObj, target, level, xoffset, yoffset,
+ zoffset, x, y, width, height, self);
}
void GLAPIENTRY
@@ -4054,8 +4066,8 @@ _mesa_CopyTextureSubImage1D(GLuint texture, GLint level,
return;
}
- copy_texture_sub_image(ctx, 1, texObj, texObj->Target, level, xoffset, 0, 0,
- x, y, width, 1, self);
+ copy_texture_sub_image_err(ctx, 1, texObj, texObj->Target, level, xoffset, 0,
+ 0, x, y, width, 1, self);
}
void GLAPIENTRY
@@ -4078,8 +4090,8 @@ _mesa_CopyTextureSubImage2D(GLuint texture, GLint level,
return;
}
- copy_texture_sub_image(ctx, 2, texObj, texObj->Target, level, xoffset,
- yoffset, 0, x, y, width, height, self);
+ copy_texture_sub_image_err(ctx, 2, texObj, texObj->Target, level, xoffset,
+ yoffset, 0, x, y, width, height, self);
}
@@ -4106,14 +4118,14 @@ _mesa_CopyTextureSubImage3D(GLuint texture, GLint level,
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
/* Act like CopyTexSubImage2D */
- copy_texture_sub_image(ctx, 2, texObj,
- GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset,
- level, xoffset, yoffset, 0, x, y, width, height,
- self);
+ copy_texture_sub_image_err(ctx, 2, texObj,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset,
+ level, xoffset, yoffset, 0, x, y, width, height,
+ self);
}
else
- copy_texture_sub_image(ctx, 3, texObj, texObj->Target, level, xoffset,
- yoffset, zoffset, x, y, width, height, self);
+ copy_texture_sub_image_err(ctx, 3, texObj, texObj->Target, level, xoffset,
+ yoffset, zoffset, x, y, width, height, self);
}
static bool