[Piglit] [PATCH 1/2] util: Add piglit_build_simple_program_unlinked().

Paul Berry stereotype441 at gmail.com
Tue Aug 20 07:20:20 PDT 2013


---
 tests/util/piglit-shader.c | 29 +++++++++++++++++++++++++++++
 tests/util/piglit-shader.h |  2 ++
 2 files changed, 31 insertions(+)

diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index 8172dfb..f7bd06f 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -265,6 +265,35 @@ GLint piglit_link_simple_program(GLint vs, GLint fs)
 	return prog;
 }
 
+
+/**
+ * Builds a program from optional VS and FS sources, but does not link
+ * it.  If there is a compile failure, the test is terminated.
+ */
+GLuint
+piglit_build_simple_program_unlinked(const char *vs_source,
+				     const char *fs_source)
+{
+	GLuint prog;
+
+	piglit_require_GLSL();
+	prog = glCreateProgram();
+	if (vs_source) {
+		GLuint vs = piglit_compile_shader_text(GL_VERTEX_SHADER,
+						       vs_source);
+		glAttachShader(prog, vs);
+		glDeleteShader(vs);
+	}
+	if (fs_source) {
+		GLuint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
+						       fs_source);
+		glAttachShader(prog, fs);
+		glDeleteShader(fs);
+	}
+	return prog;
+}
+
+
 /**
  * Builds and links a program from optional VS and FS sources,
  * throwing PIGLIT_FAIL on error.
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 3e6b8fd..8f18f0a 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -36,6 +36,8 @@ GLboolean piglit_link_check_status(GLint prog);
 GLboolean piglit_link_check_status_quiet(GLint prog);
 GLint piglit_link_simple_program(GLint vs, GLint fs);
 GLint piglit_build_simple_program(const char *vs_source, const char *fs_source);
+GLuint piglit_build_simple_program_unlinked(const char *vs_source,
+					    const char *fs_source);
 
 #if defined(PIGLIT_USE_OPENGL_ES1)
 #define glAttachShader assert(!"glAttachShader does not exist in ES1")
-- 
1.8.3.4



More information about the Piglit mailing list