mesa: move assertion in _mesa_cube_face_target()
authorBrian Paul <brianp@vmware.com>
Sun, 14 Feb 2016 14:16:25 +0000 (07:16 -0700)
committerBrian Paul <brianp@vmware.com>
Sun, 14 Feb 2016 16:16:22 +0000 (09:16 -0700)
Fixes piglit arb_texture_view-sampling-2d-array-as-2d-layer regression.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94134
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/mesa/main/teximage.h

index a7e54f78cfe95a5468446e11cb648cfa436d19c6..17f2c908ecc606931103af54a4dd7766ed4b1eca 100644 (file)
@@ -76,11 +76,13 @@ _mesa_num_tex_faces(GLenum target)
 static inline GLenum
 _mesa_cube_face_target(GLenum target, unsigned face)
 {
-   assert(face < 6);
-   if (target == GL_TEXTURE_CUBE_MAP)
+   if (target == GL_TEXTURE_CUBE_MAP) {
+      assert(face < 6);
       return GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
-   else
+   }
+   else {
       return target;
+   }
 }