[Piglit] [PATCH 2/2] ext_polygon_offset_clamp: add a gles2 version of draw test
Ilia Mirkin
imirkin at alum.mit.edu
Mon Apr 4 00:32:34 UTC 2016
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
tests/all.py | 1 +
.../ext_polygon_offset_clamp/CMakeLists.gles2.txt | 3 +++
tests/spec/ext_polygon_offset_clamp/draw.c | 20 +++++++++++++++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 tests/spec/ext_polygon_offset_clamp/CMakeLists.gles2.txt
diff --git a/tests/all.py b/tests/all.py
index bc886a1..b4cb597 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4254,6 +4254,7 @@ with profile.group_manager(
PiglitGLTest,
grouptools.join('spec', 'ext_polygon_offset_clamp')) as g:
g(['ext_polygon_offset_clamp-draw'])
+ g(['ext_polygon_offset_clamp-draw_gles2'])
g(['ext_polygon_offset_clamp-dlist'])
with profile.group_manager(
diff --git a/tests/spec/ext_polygon_offset_clamp/CMakeLists.gles2.txt b/tests/spec/ext_polygon_offset_clamp/CMakeLists.gles2.txt
new file mode 100644
index 0000000..4ff8d17
--- /dev/null
+++ b/tests/spec/ext_polygon_offset_clamp/CMakeLists.gles2.txt
@@ -0,0 +1,3 @@
+link_libraries(piglitutil_${piglit_target_api})
+
+piglit_add_executable (ext_polygon_offset_clamp-draw_gles2 draw.c)
diff --git a/tests/spec/ext_polygon_offset_clamp/draw.c b/tests/spec/ext_polygon_offset_clamp/draw.c
index f17cfb8..5c73825 100644
--- a/tests/spec/ext_polygon_offset_clamp/draw.c
+++ b/tests/spec/ext_polygon_offset_clamp/draw.c
@@ -40,8 +40,11 @@
#include "piglit-util-gl.h"
PIGLIT_GL_TEST_CONFIG_BEGIN
-
+#if PIGLIT_USE_OPENGL
config.supports_gl_compat_version = 21;
+#else
+ config.supports_gl_es_version = 20;
+#endif
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
@@ -65,7 +68,11 @@ piglit_display(void)
glUniform1f(zflip, 1.0);
glClearColor(0, 0, 1, 1);
+#ifdef PIGLIT_USE_OPENGL
glClearDepth(0.5);
+#else
+ glClearDepthf(0.5);
+#endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* NOTE: It appears that at least nvidia hw will end up
@@ -152,11 +159,22 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_EXT_polygon_offset_clamp");
prog = piglit_build_simple_program(
+#ifdef PIGLIT_USE_OPENGL
"#version 120\n"
+#else
+ "#version 100\n"
+ "attribute vec4 vertex;\n"
+ "#define gl_Vertex vertex\n"
+#endif
"uniform float zflip;\n"
"void main() { gl_Position = gl_Vertex * vec4(1, 1, zflip, 1); }\n",
+#ifdef PIGLIT_USE_OPENGL
"#version 120\n"
+#else
+ "#version 100\n"
+ "precision highp float;\n"
+#endif
"uniform vec4 color;\n"
"void main() { gl_FragColor = color; }\n");
color = glGetUniformLocation(prog, "color");
--
2.7.3
More information about the Piglit
mailing list