[Piglit] [PATCH v2 14/15] nv_conditional_render: port generatemipmap-test to gles2
Erik Faye-Lund
erik.faye-lund at collabora.com
Wed Nov 7 21:14:19 UTC 2018
This test can relatively easily be ported to gles2, so let's do that for
better test-coverage.
Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
---
tests/opengl.py | 1 +
.../CMakeLists.gles2.txt | 1 +
.../nv_conditional_render/generatemipmap.c | 26 +++++++++++++++++++
3 files changed, 28 insertions(+)
diff --git a/tests/opengl.py b/tests/opengl.py
index 811f8e131..514df0244 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3817,6 +3817,7 @@ with profile.test_list.group_manager(
g(['nv_conditional_render-dlist'], 'dlist')
g(['nv_conditional_render-drawpixels'], 'drawpixels')
g(['nv_conditional_render-generatemipmap'], 'generatemipmap')
+ g(['nv_conditional_render-generatemipmap_gles2'], 'generatemipmap_gles2')
g(['nv_conditional_render-vertex_array'], 'vertex_array')
with profile.test_list.group_manager(
diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
index 46a8f660b..f2e5d7eda 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
@@ -6,5 +6,6 @@ piglit_add_executable (nv_conditional_render-blitframebuffer_gles3 blitframebuff
piglit_add_executable (nv_conditional_render-clear_gles2 clear.c common.c)
piglit_add_executable (nv_conditional_render-copyteximage_gles2 copyteximage.c common.c)
piglit_add_executable (nv_conditional_render-copytexsubimage_gles2 copytexsubimage.c common.c)
+piglit_add_executable (nv_conditional_render-generatemipmap_gles2 generatemipmap.c common.c)
# vim: ft=cmake:
diff --git a/tests/spec/nv_conditional_render/generatemipmap.c b/tests/spec/nv_conditional_render/generatemipmap.c
index c6acdddf0..e9ec73e09 100644
--- a/tests/spec/nv_conditional_render/generatemipmap.c
+++ b/tests/spec/nv_conditional_render/generatemipmap.c
@@ -36,7 +36,12 @@
PIGLIT_GL_TEST_CONFIG_BEGIN
+#ifdef PIGLIT_USE_OPENGL
config.supports_gl_compat_version = 10;
+#else // PIGLIT_USE_OPENGL_ES2
+ config.supports_gl_es_version = 20;
+#endif
+
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
config.khr_no_error_support = PIGLIT_NO_ERRORS;
/* Note that this must be half of the texture size,
@@ -47,6 +52,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
+#ifndef PIGLIT_USE_OPENGL
+
+static GLint prog_tex;
+
+#endif
+
enum piglit_result
piglit_display(void)
{
@@ -70,12 +81,17 @@ piglit_display(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
+#ifdef PIGLIT_USE_OPENGL
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
+#endif
for (i = 0; tex_size / (1 << i) > 0; i++) {
int level_size = tex_size / (1 << i);
fill_tex(i, level_size, level_size, i == 0 ? green_ub : red);
}
+#ifndef PIGLIT_USE_OPENGL
+ glGenerateMipmap(GL_TEXTURE_2D);
+#endif
gen_queries(1, &q);
fail_query(q);
@@ -88,10 +104,16 @@ piglit_display(void)
/* This should draw level 1, since starting window size is 32
* and texture is 64.
*/
+#ifdef PIGLIT_USE_OPENGL
glEnable(GL_TEXTURE_2D);
+#else
+ glUseProgram(prog_tex);
+#endif
piglit_draw_rect_tex(-1, -1, 2, 2,
0, 0, 1, 1);
+#ifdef PIGLIT_USE_OPENGL
glDisable(GL_TEXTURE_2D);
+#endif
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
green);
@@ -107,5 +129,9 @@ void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_NV_conditional_render");
+#ifdef PIGLIT_USE_OPENGL
piglit_require_extension("GL_EXT_framebuffer_object");
+#else
+ prog_tex = build_texture_program();
+#endif
}
--
2.19.1
More information about the Piglit
mailing list