[Piglit] [PATCH 04/16] util/shader: Unify some funcs between GL and GLES
Chad Versace
chad.versace at linux.intel.com
Wed Jul 9 14:56:46 PDT 2014
Move the implementations of the functions below from piglit-shader-gl.c
into piglit-shader.c, and delete their stub implementations in
piglit-shader-gles2.c.
Now that piglit-dispatch supports every OpenGL API, there is no
longer a need to provide separate implementations for GL and GLES.
This patch brings us one step closer to unifying Piglit's CMake files.
piglit_require_GLSL
piglit_require_vertex_shader
piglit_require_fragment_shader
piglit_program_pipeline_check_status
piglit_program_pipeline_check_status_quiet
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/util/piglit-shader-gl.c | 101 ---------------------------------------
tests/util/piglit-shader-gles2.c | 20 --------
tests/util/piglit-shader.c | 101 +++++++++++++++++++++++++++++++++++++++
3 files changed, 101 insertions(+), 121 deletions(-)
diff --git a/tests/util/piglit-shader-gl.c b/tests/util/piglit-shader-gl.c
index 8689bd5..973f6d1 100644
--- a/tests/util/piglit-shader-gl.c
+++ b/tests/util/piglit-shader-gl.c
@@ -26,104 +26,3 @@
#endif
#include "piglit-util-gl-common.h"
-
-void
-piglit_require_GLSL(void)
-{
- if (piglit_get_gl_version() < 20
- && !(piglit_is_extension_supported("GL_ARB_shader_objects")
- && piglit_is_extension_supported("GL_ARB_shading_language_100"))) {
- printf("GLSL not supported.\n");
- piglit_report_result(PIGLIT_SKIP);
- }
-}
-
-void
-piglit_require_GLSL_version(int version)
-{
- bool es;
- int major, minor;
-
- piglit_require_GLSL();
-
- piglit_get_glsl_version(&es, &major, &minor);
-
- if (es || 100 * major + minor < version) {
- printf("GLSL %d.%d not supported.\n",
- version / 100, version % 100);
- piglit_report_result(PIGLIT_SKIP);
- }
-}
-
-void
-piglit_require_vertex_shader(void)
-{
- if (piglit_get_gl_version() < 20
- && !(piglit_is_extension_supported("GL_ARB_shader_objects")
- && piglit_is_extension_supported("GL_ARB_vertex_shader"))) {
- printf("GLSL vertex shaders are not supported.\n");
- piglit_report_result(PIGLIT_SKIP);
- }
-}
-
-void
-piglit_require_fragment_shader(void)
-{
- if (piglit_get_gl_version() < 20
- && !(piglit_is_extension_supported("GL_ARB_shader_objects")
- && piglit_is_extension_supported("GL_ARB_fragment_shader"))) {
- printf("GLSL fragment shaders are not supported.\n");
- piglit_report_result(PIGLIT_SKIP);
- }
-}
-
-/* Same function as link_check_status but for program pipeline */
-static GLboolean
-program_pipeline_check_status(GLuint pipeline, FILE *output)
-{
- GLchar *info = NULL;
- GLint size;
- GLint ok;
-
- piglit_require_extension("GL_ARB_separate_shader_objects");
-
- glValidateProgramPipeline(pipeline);
- glGetProgramPipelineiv(pipeline, GL_VALIDATE_STATUS, &ok);
-
- /* Some drivers return a size of 1 for an empty log. This is the size
- * of a log that contains only a terminating NUL character.
- */
- glGetProgramPipelineiv(pipeline, GL_INFO_LOG_LENGTH, &size);
- if (size > 1) {
- info = malloc(size);
- glGetProgramPipelineInfoLog(pipeline, size, NULL, info);
- }
-
- if (!ok) {
- fprintf(output, "Failed to validate the pipeline: %s\n",
- (info != NULL) ? info : "<empty log>");
- }
- else if (0 && info != NULL) {
- /* Enable this to get extra linking info.
- * Even if there's no link errors, the info log may
- * have some remarks.
- */
- printf("Pipeline validation warning: %s\n", info);
- }
-
- free(info);
-
- return ok;
-}
-
-GLboolean
-piglit_program_pipeline_check_status(GLuint pipeline)
-{
- return program_pipeline_check_status(pipeline, stderr);
-}
-
-GLboolean
-piglit_program_pipeline_check_status_quiet(GLuint pipeline)
-{
- return program_pipeline_check_status(pipeline, stdout);
-}
diff --git a/tests/util/piglit-shader-gles2.c b/tests/util/piglit-shader-gles2.c
index 607bc4d..be58598 100644
--- a/tests/util/piglit-shader-gles2.c
+++ b/tests/util/piglit-shader-gles2.c
@@ -22,23 +22,3 @@
*/
#include "piglit-util-gl-common.h"
-
-void piglit_require_GLSL(void) {}
-void piglit_require_vertex_shader(void) {}
-void piglit_require_fragment_shader(void) {}
-
-GLboolean
-piglit_program_pipeline_check_status(GLuint pipeline)
-{
- (void) pipeline;
- piglit_report_result(PIGLIT_SKIP);
- return GL_FALSE;
-}
-
-GLboolean
-piglit_program_pipeline_check_status_quiet(GLuint pipeline)
-{
- (void) pipeline;
- piglit_report_result(PIGLIT_SKIP);
- return GL_FALSE;
-}
diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index 5bd7cd2..38e5182 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -442,3 +442,104 @@ piglit_build_simple_program_multiple_shaders(GLenum target1,
return prog;
}
+
+void
+piglit_require_GLSL(void)
+{
+ if (piglit_get_gl_version() < 20
+ && !(piglit_is_extension_supported("GL_ARB_shader_objects")
+ && piglit_is_extension_supported("GL_ARB_shading_language_100"))) {
+ printf("GLSL not supported.\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+}
+
+void
+piglit_require_GLSL_version(int version)
+{
+ bool es;
+ int major, minor;
+
+ piglit_require_GLSL();
+
+ piglit_get_glsl_version(&es, &major, &minor);
+
+ if (es || 100 * major + minor < version) {
+ printf("GLSL %d.%d not supported.\n",
+ version / 100, version % 100);
+ piglit_report_result(PIGLIT_SKIP);
+ }
+}
+
+void
+piglit_require_vertex_shader(void)
+{
+ if (piglit_get_gl_version() < 20
+ && !(piglit_is_extension_supported("GL_ARB_shader_objects")
+ && piglit_is_extension_supported("GL_ARB_vertex_shader"))) {
+ printf("GLSL vertex shaders are not supported.\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+}
+
+void
+piglit_require_fragment_shader(void)
+{
+ if (piglit_get_gl_version() < 20
+ && !(piglit_is_extension_supported("GL_ARB_shader_objects")
+ && piglit_is_extension_supported("GL_ARB_fragment_shader"))) {
+ printf("GLSL fragment shaders are not supported.\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+}
+
+/* Same function as link_check_status but for program pipeline */
+static GLboolean
+program_pipeline_check_status(GLuint pipeline, FILE *output)
+{
+ GLchar *info = NULL;
+ GLint size;
+ GLint ok;
+
+ piglit_require_extension("GL_ARB_separate_shader_objects");
+
+ glValidateProgramPipeline(pipeline);
+ glGetProgramPipelineiv(pipeline, GL_VALIDATE_STATUS, &ok);
+
+ /* Some drivers return a size of 1 for an empty log. This is the size
+ * of a log that contains only a terminating NUL character.
+ */
+ glGetProgramPipelineiv(pipeline, GL_INFO_LOG_LENGTH, &size);
+ if (size > 1) {
+ info = malloc(size);
+ glGetProgramPipelineInfoLog(pipeline, size, NULL, info);
+ }
+
+ if (!ok) {
+ fprintf(output, "Failed to validate the pipeline: %s\n",
+ (info != NULL) ? info : "<empty log>");
+ }
+ else if (0 && info != NULL) {
+ /* Enable this to get extra linking info.
+ * Even if there's no link errors, the info log may
+ * have some remarks.
+ */
+ printf("Pipeline validation warning: %s\n", info);
+ }
+
+ free(info);
+
+ return ok;
+}
+
+GLboolean
+piglit_program_pipeline_check_status(GLuint pipeline)
+{
+ return program_pipeline_check_status(pipeline, stderr);
+}
+
+GLboolean
+piglit_program_pipeline_check_status_quiet(GLuint pipeline)
+{
+ return program_pipeline_check_status(pipeline, stdout);
+}
--
2.0.0
More information about the Piglit
mailing list