[Piglit] [PATCH 1/4] util: Bind fixed attrib locations for "piglit_vertex" and "piglit_texcoord"
Eric Anholt
eric at anholt.net
Wed May 8 14:01:59 PDT 2013
This will let us easily use piglit_draw_rect_tex() in ES-only shader
tests, and is a step toward having the same shaders usable between ES
and desktop without going to full VBO setup in shader_runner.
---
tests/shaders/shader_runner.c | 7 +++++++
tests/util/piglit-shader.c | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 9089f09..5a3629d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -779,6 +779,13 @@ link_and_use_shaders(void)
}
#endif
+ /* If the shaders reference piglit_vertex or piglit_tex, bind
+ * them to some fixed attribute locations so they can be used
+ * with piglit_draw_rect_tex() in GLES.
+ */
+ glBindAttribLocation(prog, PIGLIT_ATTRIB_POS, "piglit_vertex");
+ glBindAttribLocation(prog, PIGLIT_ATTRIB_TEX, "piglit_texcoord");
+
glLinkProgram(prog);
for (i = 0; i < num_vertex_shaders; i++) {
diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index c67e58a..ca48f41 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -246,6 +246,14 @@ GLint piglit_link_simple_program(GLint vs, GLint fs)
glAttachShader(prog, vs);
if (fs)
glAttachShader(prog, fs);
+
+ /* If the shaders reference piglit_vertex or piglit_tex, bind
+ * them to some fixed attribute locations so they can be used
+ * with piglit_draw_rect_tex() in GLES.
+ */
+ glBindAttribLocation(prog, PIGLIT_ATTRIB_POS, "piglit_vertex");
+ glBindAttribLocation(prog, PIGLIT_ATTRIB_TEX, "piglit_texcoord");
+
glLinkProgram(prog);
if (!piglit_link_check_status(prog)) {
--
1.8.3.rc0
More information about the Piglit
mailing list