diff options
author | Laura Ekstrand <[email protected]> | 2014-12-31 16:31:50 -0800 |
---|---|---|
committer | Laura Ekstrand <[email protected]> | 2015-01-08 11:37:30 -0800 |
commit | b66dd38a37807c28203aa5c6c2707c1dc6dccedf (patch) | |
tree | 3a373612189dc10b12570a7ff77b526ab3f5a68d /src/mesa/main/texobj.c | |
parent | 2546d901be3b47d8731ccfed5feb55afdab94763 (diff) |
main: Added _mesa_cube_level_complete to check for the completeness of an arbitrary cube map level.
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d6e44f24c8c..6e5eb7398f1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -810,25 +810,21 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, } -/** - * Check if the given cube map texture is "cube complete" as defined in - * the OpenGL specification. - */ GLboolean -_mesa_cube_complete(const struct gl_texture_object *texObj) +_mesa_cube_level_complete(const struct gl_texture_object *texObj, + const GLint level) { - const GLint baseLevel = texObj->BaseLevel; const struct gl_texture_image *img0, *img; GLuint face; if (texObj->Target != GL_TEXTURE_CUBE_MAP) return GL_FALSE; - if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) + if ((level < 0) || (level >= MAX_TEXTURE_LEVELS)) return GL_FALSE; /* check first face */ - img0 = texObj->Image[0][baseLevel]; + img0 = texObj->Image[0][level]; if (!img0 || img0->Width < 1 || img0->Width != img0->Height) @@ -836,7 +832,7 @@ _mesa_cube_complete(const struct gl_texture_object *texObj) /* check remaining faces vs. first face */ for (face = 1; face < 6; face++) { - img = texObj->Image[face][baseLevel]; + img = texObj->Image[face][level]; if (!img || img->Width != img0->Width || img->Height != img0->Height || @@ -847,6 +843,15 @@ _mesa_cube_complete(const struct gl_texture_object *texObj) return GL_TRUE; } +/** + * Check if the given cube map texture is "cube complete" as defined in + * the OpenGL specification. + */ +GLboolean +_mesa_cube_complete(const struct gl_texture_object *texObj) +{ + return _mesa_cube_level_complete(texObj, texObj->BaseLevel); +} /** * Mark a texture object dirty. It forces the object to be incomplete |