summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-03-17 16:30:02 -0600
committerBrian Paul <[email protected]>2012-03-20 08:23:32 -0600
commit4c385d382f6932d5d88a26dcc9eedf520b3a9ed7 (patch)
tree5ed62681f72c352061f6d6b5eda8e0c1b202bccc /src/mesa/main
parentcfd5b14dac6a197be3fa85b5448b45802951aa3d (diff)
mesa: use switch(target) in _mesa_test_texobj_completeness()
and add missing case for GL_TEXTURE_BUFFER. Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texobj.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index def09e2d7fa..1611ba7f8d5 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -452,35 +452,39 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
return;
}
- /* Compute _MaxLevel */
- if ((t->Target == GL_TEXTURE_1D) ||
- (t->Target == GL_TEXTURE_1D_ARRAY_EXT)) {
+ /* 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:
maxLog2 = t->Image[0][baseLevel]->WidthLog2;
maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if ((t->Target == GL_TEXTURE_2D) ||
- (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_2D_ARRAY_EXT:
maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
t->Image[0][baseLevel]->HeightLog2);
maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_3D) {
+ break;
+ case GL_TEXTURE_3D:
maxLog2 = MAX3(t->Image[0][baseLevel]->WidthLog2,
t->Image[0][baseLevel]->HeightLog2,
t->Image[0][baseLevel]->DepthLog2);
maxLevels = ctx->Const.Max3DTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
t->Image[0][baseLevel]->HeightLog2);
maxLevels = ctx->Const.MaxCubeTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_RECTANGLE_NV ||
- t->Target == GL_TEXTURE_EXTERNAL_OES) {
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_TEXTURE_BUFFER:
+ case GL_TEXTURE_EXTERNAL_OES:
maxLog2 = 0; /* not applicable */
maxLevels = 1; /* no mipmapping */
- }
- else {
+ break;
+ default:
_mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness");
return;
}