summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-05-01 14:13:18 -0700
committerEric Anholt <[email protected]>2019-05-13 12:02:59 -0700
commitd88f3392fff7c6342f3840c4bd8195a1296c2372 (patch)
tree8efeeeeb76348773a0c0c573e456ff54c9769128 /src/mesa/main/texobj.c
parent20b42fad9b705f59b2467226abac299a7d473920 (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/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c29
1 files changed, 2 insertions, 27 deletions
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;
}