* Implement all the glTextureSubImage1/2/3D() functions.
* Must split this out this way because of GL_TEXTURE_CUBE_MAP.
*/
-static void
+static ALWAYS_INLINE void
texturesubimage(struct gl_context *ctx, GLuint dims,
GLuint texture, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *pixels,
- const char *callerName)
+ const char *callerName, bool no_error)
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
_mesa_enum_to_string(type), pixels);
/* Get the texture object by Name. */
- texObj = _mesa_lookup_texture_err(ctx, texture, callerName);
- if (!texObj)
- return;
-
- /* check target (proxies not allowed) */
- if (!legal_texsubimage_target(ctx, dims, texObj->Target, true)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(target=%s)",
- callerName, _mesa_enum_to_string(texObj->Target));
- return;
+ if (!no_error) {
+ texObj = _mesa_lookup_texture_err(ctx, texture, callerName);
+ if (!texObj)
+ return;
+ } else {
+ texObj = _mesa_lookup_texture(ctx, texture);
}
- if (texsubimage_error_check(ctx, dims, texObj, texObj->Target, level,
- xoffset, yoffset, zoffset,
- width, height, depth, format, type,
- pixels, true, callerName)) {
- return; /* error was detected */
- }
+ if (!no_error) {
+ /* check target (proxies not allowed) */
+ if (!legal_texsubimage_target(ctx, dims, texObj->Target, true)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target=%s)",
+ callerName, _mesa_enum_to_string(texObj->Target));
+ return;
+ }
+ if (texsubimage_error_check(ctx, dims, texObj, texObj->Target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth, format, type,
+ pixels, true, callerName)) {
+ return; /* error was detected */
+ }
+ }
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
* It seems reasonable to check for cube completeness of an arbitrary
* level here so that the image data has a consistent format and size.
*/
- if (!_mesa_cube_level_complete(texObj, level)) {
+ if (!no_error && !_mesa_cube_level_complete(texObj, level)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTextureSubImage%uD(cube map incomplete)",
dims);
}
+static void
+texturesubimage_error(struct gl_context *ctx, GLuint dims,
+ GLuint texture, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const char *callerName)
+{
+ texturesubimage(ctx, dims, texture, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels, callerName,
+ false);
+}
+
+
void GLAPIENTRY
_mesa_TexSubImage1D_no_error(GLenum target, GLint level,
GLint xoffset, GLsizei width,
const GLvoid *pixels)
{
GET_CURRENT_CONTEXT(ctx);
- texturesubimage(ctx, 1, texture, level,
- xoffset, 0, 0,
- width, 1, 1,
- format, type, pixels, "glTextureSubImage1D");
+ texturesubimage_error(ctx, 1, texture, level, xoffset, 0, 0, width, 1, 1,
+ format, type, pixels, "glTextureSubImage1D");
}
const GLvoid *pixels)
{
GET_CURRENT_CONTEXT(ctx);
- texturesubimage(ctx, 2, texture, level,
- xoffset, yoffset, 0,
- width, height, 1,
- format, type, pixels, "glTextureSubImage2D");
+ texturesubimage_error(ctx, 2, texture, level, xoffset, yoffset, 0, width,
+ height, 1, format, type, pixels,
+ "glTextureSubImage2D");
}
const GLvoid *pixels)
{
GET_CURRENT_CONTEXT(ctx);
- texturesubimage(ctx, 3, texture, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels, "glTextureSubImage3D");
+ texturesubimage_error(ctx, 3, texture, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels,
+ "glTextureSubImage3D");
}