diff options
author | Eric Anholt <[email protected]> | 2019-05-01 14:13:18 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-05-13 12:02:59 -0700 |
commit | d88f3392fff7c6342f3840c4bd8195a1296c2372 (patch) | |
tree | 8efeeeeb76348773a0c0c573e456ff54c9769128 /src/mesa | |
parent | 20b42fad9b705f59b2467226abac299a7d473920 (diff) |
mesa: Reuse _mesa_max_texture_levels() instead of open-coding it.
The shared function has some extension presence checks, but other than
that has the same switch statement contents.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/teximage.c | 2 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 2 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 29 |
3 files changed, 4 insertions, 29 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 1efdd7dd902..edcb48d9a6d 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -503,7 +503,7 @@ get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) * \sa gl_constants. */ GLint -_mesa_max_texture_levels(struct gl_context *ctx, GLenum target) +_mesa_max_texture_levels(const struct gl_context *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 266a9f3d83d..261daae3948 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -179,7 +179,7 @@ _mesa_base_tex_image(const struct gl_texture_object *texObj) extern GLint -_mesa_max_texture_levels(struct gl_context *ctx, GLenum target); +_mesa_max_texture_levels(const struct gl_context *ctx, GLenum target); extern GLboolean diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 38860fed4f0..ef6458e417f 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -715,33 +715,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, return; } - /* Compute _MaxLevel (the maximum mipmap level we'll sample from given the - * mipmap image sizes and GL_TEXTURE_MAX_LEVEL state). - */ - switch (t->Target) { - case GL_TEXTURE_1D: - case GL_TEXTURE_1D_ARRAY_EXT: - maxLevels = ctx->Const.MaxTextureLevels; - break; - case GL_TEXTURE_2D: - case GL_TEXTURE_2D_ARRAY_EXT: - maxLevels = ctx->Const.MaxTextureLevels; - break; - case GL_TEXTURE_3D: - maxLevels = ctx->Const.Max3DTextureLevels; - break; - case GL_TEXTURE_CUBE_MAP: - case GL_TEXTURE_CUBE_MAP_ARRAY: - maxLevels = ctx->Const.MaxCubeTextureLevels; - break; - case GL_TEXTURE_RECTANGLE_NV: - case GL_TEXTURE_BUFFER: - case GL_TEXTURE_EXTERNAL_OES: - case GL_TEXTURE_2D_MULTISAMPLE: - case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - maxLevels = 1; /* no mipmapping */ - break; - default: + maxLevels = _mesa_max_texture_levels(ctx, t->Target); + if (maxLevels == 0) { _mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness"); return; } |