[Piglit] [PATCH] tex-miplevel-selection: avoid generating errors in glEnable/Disable
Brian Paul
brianp at vmware.com
Mon Mar 21 16:24:01 UTC 2016
It's illegal to call glEnable/Disable with GL_TEXTURE_1D/2D/CUBE_MAP_
ARRAY targets (they're not supported for fixed-function rendering).
By avoiding these GL errors we can actually run the test, rather than
exiting early with an unexpected GL error message.
---
tests/texturing/tex-miplevel-selection.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 959bab2..3e50c74 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -201,6 +201,24 @@ static void set_sampler_parameter(GLenum pname, GLint value)
glSamplerParameteri(samp[1], pname, value);
}
+/**
+ * Is the given texture target an array type?
+ * Note that texture arrays cannot be enabled/disabled with the
+ * fixed function pipeline.
+ */
+static bool
+is_array_tex_target(GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D_ARRAY:
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ return true;
+ default:
+ return false;
+ }
+}
+
void
piglit_init(int argc, char **argv)
{
@@ -864,7 +882,7 @@ piglit_init(int argc, char **argv)
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
- if (test == FIXED_FUNCTION)
+ if (test == FIXED_FUNCTION && !is_array_tex_target(gltarget))
glDisable(gltarget);
glGenFramebuffers(1, &fb);
@@ -975,7 +993,7 @@ piglit_init(int argc, char **argv)
glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
- if (test == FIXED_FUNCTION)
+ if (test == FIXED_FUNCTION && !is_array_tex_target(gltarget))
glEnable(gltarget);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
--
1.9.1
More information about the Piglit
mailing list