[Mesa-dev] [PATCH 1/3] main: Added _mesa_cube_level_complete to check for the completeness of an arbitrary cube map level.
Laura Ekstrand
laura at jlekstrand.net
Wed Dec 31 17:26:52 PST 2014
---
src/mesa/main/texobj.c | 23 ++++++++++++++---------
src/mesa/main/texobj.h | 4 ++++
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 126b523..82d52c5 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -806,25 +806,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)
@@ -832,7 +828,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 ||
@@ -843,6 +839,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)
+{
+ _mesa_cube_level_complete(texObj, texObj->BaseLevel);
+}
/**
* Mark a texture object dirty. It forces the object to be incomplete
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 3a62d63..75aaec0 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -173,6 +173,10 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
struct gl_texture_object *obj );
extern GLboolean
+_mesa_cube_level_complete(const struct gl_texture_object *texObj,
+ const GLint level);
+
+extern GLboolean
_mesa_cube_complete(const struct gl_texture_object *texObj);
extern void
--
2.1.0
More information about the mesa-dev
mailing list