On Sun, 5 Sep 2010 09:48:22 -0700
Ian Romanick <i...@paranormal-entertainment.com> wrote:

> On Sep 4, 2010, at 3:48 AM, Török Edwin <edwinto...@gmail.com> wrote:
> 
> > From: Török Edvin <edwinto...@gmail.com>
> >
> > Otherwise spring 0.82+.4.0 crashes when starting a game
> > because prog->_LinkedShaders[0] is NULL.
> 
> Any idea what this app is doing to hit this?  A piglit test would be  
> good.
> 

Looks like this occurs when linking a completely empty program.
I wrote a piglit test based on other similar tests (see attached file).

This is first time I write a piglit test, so I'm not sure if this is
the right way to do it, but here is what it does:
$ bin/glsl-emptylink
Segmentation fault

After applying the mesa patch:
$ bin/glsl-emptylink 
PIGLIT: {'result': 'pass' }

Best regards,
--Edwin
From 6b96443e71eccd4ae5126e80812d00a819faa91c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edwin?= <edwinto...@gmail.com>
Date: Mon, 6 Sep 2010 19:46:30 +0300
Subject: [PATCH] Add glsl empty link crash test.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Török Edwin <edwinto...@gmail.com>
---
 tests/shaders/CMakeLists.txt   |    1 +
 tests/shaders/glsl-emptylink.c |   52 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 tests/shaders/glsl-emptylink.c

diff --git a/tests/shaders/CMakeLists.txt b/tests/shaders/CMakeLists.txt
index 5d25ead..8168d51 100644
--- a/tests/shaders/CMakeLists.txt
+++ b/tests/shaders/CMakeLists.txt
@@ -114,6 +114,7 @@ add_executable (glsl-lod-bias glsl-lod-bias.c)
 add_executable (glsl-preprocessor-comments glsl-preprocessor-comments.c)
 add_executable (vp-ignore-input vp-ignore-input.c)
 add_executable (glsl-empty-vs-no-fs glsl-empty-vs-no-fs.c)
+add_executable (glsl-emptylink glsl-emptylink.c)
 add_executable (glsl-max-varyings glsl-max-varyings.c)
 add_executable (glsl-useprogram-displaylist glsl-useprogram-displaylist.c)
 add_executable (glsl-routing glsl-routing.c)
diff --git a/tests/shaders/glsl-emptylink.c b/tests/shaders/glsl-emptylink.c
new file mode 100644
index 0000000..86f231e
--- /dev/null
+++ b/tests/shaders/glsl-emptylink.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2010 Török Edwin
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 64;
+int piglit_height = 64;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+enum piglit_result piglit_display(void)
+{
+    GLint objID = glCreateProgram();
+    /* check that it doesn't crash when linking empty shader */
+    glLinkProgram(objID);
+    glValidateProgram(objID);
+    if (!piglit_link_check_status(objID))
+	piglit_report_result(PIGLIT_FAILURE);
+    glUseProgram(objID);
+    glUseProgram(0);
+    glDeleteProgram(objID);
+    piglit_report_result(PIGLIT_SUCCESS);
+    return PIGLIT_SUCCESS;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+    if (!GLEW_VERSION_2_0) {
+	printf("Requires OpenGL 2.0\n");
+	piglit_report_result(PIGLIT_SKIP);
+    }
+}
-- 
1.7.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to