From 9bcd31ea90addd7a16802de8a28b2f3242dc8298 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 19 Jun 2016 00:36:48 -0700 Subject: mesa: Move compute_num_levels from st_gen_mipmap.c to mipmap.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I want to use compute_num_levels inside i965. Rather than duplicating it, move it from mesa/st to core Mesa, and make it non-static. Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_gen_mipmap.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 16b914a8845..f2aa8005a03 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -44,32 +44,6 @@ #include "st_cb_texture.h" -/** - * Compute the expected number of mipmap levels in the texture given - * the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/ - * GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap - * levels should be generated. - */ -static GLuint -compute_num_levels(struct gl_context *ctx, - struct gl_texture_object *texObj, - GLenum target) -{ - const struct gl_texture_image *baseImage; - GLuint numLevels; - - baseImage = _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel); - - numLevels = texObj->BaseLevel + baseImage->MaxNumLevels; - numLevels = MIN2(numLevels, (GLuint) texObj->MaxLevel + 1); - if (texObj->Immutable) - numLevels = MIN2(numLevels, texObj->NumLevels); - assert(numLevels >= 1); - - return numLevels; -} - - /** * Called via ctx->Driver.GenerateMipmap(). */ @@ -92,7 +66,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, assert(pt->nr_samples < 2); /* find expected last mipmap level to generate*/ - lastLevel = compute_num_levels(ctx, texObj, target) - 1; + lastLevel = _mesa_compute_num_levels(ctx, texObj, target) - 1; if (lastLevel == 0) return; -- cgit v1.2.3