diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-19 15:27:54 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:40 +0200 |
commit | de0b1e5a81fddd95070952ce1a9a3dc7e7d820c5 (patch) | |
tree | 66fe64c32dd47ccf01a6b36e149706772ea9fd83 /src/mesa/main/teximage.c | |
parent | ffe8813b02590bcd00437fe5cdc1103273ac2920 (diff) |
mesa: add texturesubimage_error() helper
And make texturesubimage() always inline.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 1de40b04bf4..3839c9fede4 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3369,13 +3369,13 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, * 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; @@ -3390,24 +3390,29 @@ texturesubimage(struct gl_context *ctx, GLuint dims, _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) { @@ -3442,7 +3447,7 @@ texturesubimage(struct gl_context *ctx, GLuint dims, * 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); @@ -3475,6 +3480,20 @@ texturesubimage(struct gl_context *ctx, GLuint 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, @@ -3569,10 +3588,8 @@ _mesa_TextureSubImage1D(GLuint texture, GLint level, 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"); } @@ -3584,10 +3601,9 @@ _mesa_TextureSubImage2D(GLuint texture, GLint level, 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"); } @@ -3599,10 +3615,9 @@ _mesa_TextureSubImage3D(GLuint texture, GLint level, 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"); } |