[Piglit] [PATCH v2 09/15] nv_conditional_render: add helpers to compile useful programs

Erik Faye-Lund erik.faye-lund at collabora.com
Wed Nov 7 21:14:14 UTC 2018


---
 tests/spec/nv_conditional_render/common.c | 36 +++++++++++++++++++++++
 tests/spec/nv_conditional_render/common.h |  6 ++++
 2 files changed, 42 insertions(+)

diff --git a/tests/spec/nv_conditional_render/common.c b/tests/spec/nv_conditional_render/common.c
index f47c9939d..f17d10cc6 100644
--- a/tests/spec/nv_conditional_render/common.c
+++ b/tests/spec/nv_conditional_render/common.c
@@ -43,6 +43,42 @@ fill_tex(int level, int w, int h, const unsigned char *color)
 	free(data);
 }
 
+static const char *vs_source =
+	"attribute vec4 piglit_vertex;\n"
+	"attribute vec4 piglit_texcoord;\n"
+	"varying vec2 uv;\n"
+	"void main()\n"
+	"{\n"
+	"  gl_Position = piglit_vertex;\n"
+	"  uv = piglit_texcoord.xy;\n"
+	"}\n";
+
+static const char *fs_source_green =
+	"void main()\n"
+	"{\n"
+	"  gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
+	"}\n";
+
+static const char *fs_source_texture =
+	"uniform sampler2D tex;\n"
+	"varying mediump vec2 uv;\n"
+	"void main()\n"
+	"{\n"
+	"  gl_FragColor = texture2D(tex, uv);\n"
+	"}\n";
+
+GLint
+build_green_program()
+{
+	return piglit_build_simple_program(vs_source, fs_source_green);
+}
+
+GLint
+build_texture_program()
+{
+	return piglit_build_simple_program(vs_source, fs_source_texture);
+}
+
 void
 gen_queries(GLsizei n, GLuint *ids)
 {
diff --git a/tests/spec/nv_conditional_render/common.h b/tests/spec/nv_conditional_render/common.h
index d50063c28..d03d012dd 100644
--- a/tests/spec/nv_conditional_render/common.h
+++ b/tests/spec/nv_conditional_render/common.h
@@ -30,6 +30,12 @@
 void
 fill_tex(int level, int w, int h, const unsigned char *color);
 
+GLint
+build_green_program();
+
+GLint
+build_texture_program();
+
 void
 gen_queries(GLsizei n, GLuint *ids);
 
-- 
2.19.1



More information about the Piglit mailing list