[Mesa-dev] [PATCH shader-db] skip the 'GL >= x.y' line if present

Samuel Pitoiset samuel.pitoiset at gmail.com
Sun Oct 2 14:27:33 UTC 2016


shaderdb runner fails at parsing shader_test files when the first
line inside the require block is not 'GLSL >= x.y'. This just skips
the GL version requirement which is actually unused and allows to
compile +164 shaders from piglit.
---
 run.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/run.c b/run.c
index d833879..5b5afa8 100644
--- a/run.c
+++ b/run.c
@@ -77,6 +77,7 @@ get_shaders(const struct context_info *core, const struct context_info *compat,
             const char *shader_name)
 {
     static const char *req = "[require]";
+    static const char *gl_req = "\nGL >= ";
     static const char *glsl_req = "\nGLSL >= ";
     static const char *fp_req = "\nGL_ARB_fragment_program";
     static const char *vp_req = "\nGL_ARB_vertex_program";
@@ -97,6 +98,11 @@ get_shaders(const struct context_info *core, const struct context_info *compat,
     /* Find the [require] block and parse it first. */
     text = memmem(text, end_text - text, req, strlen(req)) + strlen(req);
 
+    /* Skip the GL >= x.y line if present. */
+    if (memcmp(text, gl_req, strlen(gl_req)) == 0) {
+        text += strlen(gl_req) + 3; /* for x.y */
+    }
+
     if (memcmp(text, glsl_req, strlen(glsl_req)) == 0) {
         text += strlen(glsl_req);
         long major = strtol(text, (char **)&text, 10);
-- 
2.10.0



More information about the mesa-dev mailing list