Module: Mesa Branch: main Commit: c67e6ea4c124c4eaeee49ee0a5639c6225ba1e68 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c67e6ea4c124c4eaeee49ee0a5639c6225ba1e68
Author: Erik Faye-Lund <[email protected]> Date: Wed Nov 29 21:40:35 2023 +0100 mesa/main: remove unused Log2 variants of width/height/depth These are unused, and the comments about the relationships between it an the other variants seems to be seriously outdated. Let's get rid of it. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26418> --- src/mesa/main/mtypes.h | 9 +++------ src/mesa/main/teximage.c | 24 +++++------------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 77c38bf48d5..4d3aeda5b42 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -766,15 +766,12 @@ struct gl_texture_image mesa_format TexFormat; /**< The actual texture memory format */ GLuint Border; /**< 0 or 1 */ - GLuint Width; /**< = 2^WidthLog2 + 2*Border */ - GLuint Height; /**< = 2^HeightLog2 + 2*Border */ - GLuint Depth; /**< = 2^DepthLog2 + 2*Border */ + GLuint Width; + GLuint Height; + GLuint Depth; GLuint Width2; /**< = Width - 2*Border */ GLuint Height2; /**< = Height - 2*Border */ GLuint Depth2; /**< = Depth - 2*Border */ - GLuint WidthLog2; /**< = log2(Width2) */ - GLuint HeightLog2; /**< = log2(Height2) */ - GLuint DepthLog2; /**< = log2(Depth2) */ GLuint MaxNumLevels; /**< = maximum possible number of mipmap levels, computed from the dimensions */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 412fce4d8c7..7318a3d4a59 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -797,9 +797,6 @@ clear_teximage_fields(struct gl_texture_image *img) img->Width2 = 0; img->Height2 = 0; img->Depth2 = 0; - img->WidthLog2 = 0; - img->HeightLog2 = 0; - img->DepthLog2 = 0; img->TexFormat = MESA_FORMAT_NONE; img->NumSamples = 0; img->FixedSampleLocations = GL_TRUE; @@ -957,8 +954,7 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, } _mesa_update_teximage_format_swizzle(ctx, img, depth_mode); - img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */ - img->WidthLog2 = util_logbase2(img->Width2); + img->Width2 = width - 2 * border; switch(target) { case GL_TEXTURE_1D: @@ -968,22 +964,18 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, img->Height2 = 0; else img->Height2 = 1; - img->HeightLog2 = 0; if (depth == 0) img->Depth2 = 0; else img->Depth2 = 1; - img->DepthLog2 = 0; break; case GL_TEXTURE_1D_ARRAY: case GL_PROXY_TEXTURE_1D_ARRAY: img->Height2 = height; /* no border */ - img->HeightLog2 = 0; /* not used */ if (depth == 0) img->Depth2 = 0; else img->Depth2 = 1; - img->DepthLog2 = 0; break; case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE: @@ -1000,13 +992,11 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, case GL_PROXY_TEXTURE_CUBE_MAP: case GL_TEXTURE_2D_MULTISAMPLE: case GL_PROXY_TEXTURE_2D_MULTISAMPLE: - img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ - img->HeightLog2 = util_logbase2(img->Height2); + img->Height2 = height - 2 * border; if (depth == 0) img->Depth2 = 0; else img->Depth2 = 1; - img->DepthLog2 = 0; break; case GL_TEXTURE_2D_ARRAY: case GL_PROXY_TEXTURE_2D_ARRAY: @@ -1014,17 +1004,13 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: - img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ - img->HeightLog2 = util_logbase2(img->Height2); + img->Height2 = height - 2 * border; img->Depth2 = depth; /* no border */ - img->DepthLog2 = 0; /* not used */ break; case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: - img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ - img->HeightLog2 = util_logbase2(img->Height2); - img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */ - img->DepthLog2 = util_logbase2(img->Depth2); + img->Height2 = height - 2 * border; + img->Depth2 = depth - 2 * border; break; default: _mesa_problem(NULL, "invalid target 0x%x in _mesa_init_teximage_fields()",
