summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-07-18 21:21:50 +0200
committerSamuel Pitoiset <[email protected]>2017-07-31 13:53:39 +0200
commit15603acfd90bd43684bb9e9131f6d59a2d6f5019 (patch)
tree3188c39933a38f349100cc7f5b0e1e51b840538f /src
parentef0b0389818f9dd99e55e44e52dc7e4446e37c79 (diff)
mesa: add generate_texture_mipmap_error() helper
And make generate_texture_mipmap() always inline. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/genmipmap.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index be49136aa89..9eb83cf85f3 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -107,10 +107,10 @@ _mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx,
* Implements glGenerateMipmap and glGenerateTextureMipmap.
* Generates all the mipmap levels below the base level.
*/
-static void
+static ALWAYS_INLINE void
generate_texture_mipmap(struct gl_context *ctx,
struct gl_texture_object *texObj, GLenum target,
- bool dsa)
+ bool dsa, bool no_error)
{
struct gl_texture_image *srcImage;
const char *suffix = dsa ? "Texture" : "";
@@ -122,7 +122,7 @@ generate_texture_mipmap(struct gl_context *ctx,
return;
}
- if (texObj->Target == GL_TEXTURE_CUBE_MAP &&
+ if (!no_error && texObj->Target == GL_TEXTURE_CUBE_MAP &&
!_mesa_cube_complete(texObj)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGenerate%sMipmap(incomplete cube map)", suffix);
@@ -132,20 +132,22 @@ generate_texture_mipmap(struct gl_context *ctx,
_mesa_lock_texture(ctx, texObj);
srcImage = _mesa_select_tex_image(texObj, target, texObj->BaseLevel);
- if (!srcImage) {
- _mesa_unlock_texture(ctx, texObj);
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGenerate%sMipmap(zero size base image)", suffix);
- return;
- }
+ if (!no_error) {
+ if (!srcImage) {
+ _mesa_unlock_texture(ctx, texObj);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGenerate%sMipmap(zero size base image)", suffix);
+ return;
+ }
- if (!_mesa_is_valid_generate_texture_mipmap_internalformat(ctx,
- srcImage->InternalFormat)) {
- _mesa_unlock_texture(ctx, texObj);
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGenerate%sMipmap(invalid internal format %s)", suffix,
- _mesa_enum_to_string(srcImage->InternalFormat));
- return;
+ if (!_mesa_is_valid_generate_texture_mipmap_internalformat(ctx,
+ srcImage->InternalFormat)) {
+ _mesa_unlock_texture(ctx, texObj);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGenerate%sMipmap(invalid internal format %s)", suffix,
+ _mesa_enum_to_string(srcImage->InternalFormat));
+ return;
+ }
}
if (srcImage->Width == 0 || srcImage->Height == 0) {
@@ -166,6 +168,14 @@ generate_texture_mipmap(struct gl_context *ctx,
_mesa_unlock_texture(ctx, texObj);
}
+static void
+generate_texture_mipmap_error(struct gl_context *ctx,
+ struct gl_texture_object *texObj, GLenum target,
+ bool dsa)
+{
+ generate_texture_mipmap(ctx, texObj, target, dsa, false);
+}
+
/**
* Generate all the mipmap levels below the base level.
* Note: this GL function would be more useful if one could specify a
@@ -187,7 +197,7 @@ _mesa_GenerateMipmap(GLenum target)
if (!texObj)
return;
- generate_texture_mipmap(ctx, texObj, target, false);
+ generate_texture_mipmap_error(ctx, texObj, target, false);
}
/**
@@ -209,5 +219,5 @@ _mesa_GenerateTextureMipmap(GLuint texture)
return;
}
- generate_texture_mipmap(ctx, texObj, texObj->Target, true);
+ generate_texture_mipmap_error(ctx, texObj, texObj->Target, true);
}