[Piglit] [PATCH 1/4] piglit: Switch a bunch of tests over to piglit_build_simple_program.
Eric Anholt
eric at anholt.net
Wed May 29 10:59:41 PDT 2013
Since I was about to clean up some piglit_compile_shader_text calls, I
was looking at all these anyway.
---
.../execution/fbo-extended-blend-explicit.c | 12 +-----------
.../draw-elements-instanced-base-vertex.c | 10 ++--------
tests/spec/arb_draw_instanced/execution/elements.c | 13 ++-----------
.../arb_es2_compatibility-fixed-type.c | 5 ++---
.../arb_es2_compatibility-releaseshadercompiler.c | 9 ++-------
tests/spec/arb_framebuffer_srgb/blit.c | 8 ++------
tests/spec/arb_instanced_arrays/instanced_arrays.c | 10 ++--------
tests/spec/arb_sampler_objects/sampler-incomplete.c | 5 ++---
tests/spec/arb_shader_objects/clear-with-deleted.c | 10 +---------
tests/spec/arb_shader_objects/delete-repeat.c | 10 +---------
.../arb_shader_objects/getactiveuniform-beginend.c | 7 ++-----
tests/spec/arb_shader_objects/getuniform.c | 8 +-------
.../getuniformlocation-array-of-struct-of-array.c | 4 +---
tests/spec/arb_shader_texture_lod/execution/texgrad.c | 7 ++-----
.../arb_shader_texture_lod/execution/texgradcube.c | 7 ++-----
.../arb_texture_buffer_object/fetch-outside-bounds.c | 11 ++---------
tests/spec/arb_texture_buffer_object/formats.c | 17 ++---------------
tests/spec/arb_texture_buffer_object/render-no-bo.c | 11 ++---------
tests/spec/arb_texture_buffer_range/ranges.c | 17 +----------------
tests/spec/arb_texture_cube_map_array/cubemap.c | 7 ++-----
.../arb_texture_cube_map_array/fbo-cubemap-array.c | 11 ++---------
.../sampler-cube-array-shadow.c | 6 +-----
tests/spec/arb_texture_float/texture-float-formats.c | 7 ++-----
tests/spec/arb_uniform_buffer_object/dlist.c | 9 ++-------
.../getactiveuniformblockiv-uniform-block-data-size.c | 10 ++--------
.../getactiveuniformblockname.c | 10 ++--------
.../arb_uniform_buffer_object/getactiveuniformname.c | 10 ++--------
.../getactiveuniformsiv-uniform-array-stride.c | 9 ++-------
.../getactiveuniformsiv-uniform-block-index.c | 18 ++----------------
.../getactiveuniformsiv-uniform-matrix-stride.c | 9 ++-------
.../getactiveuniformsiv-uniform-type.c | 14 +++-----------
tests/spec/arb_uniform_buffer_object/getprogramiv.c | 17 ++---------------
.../arb_uniform_buffer_object/getuniformblockindex.c | 11 +----------
.../spec/arb_uniform_buffer_object/getuniformindices.c | 11 +----------
.../arb_uniform_buffer_object/getuniformlocation.c | 12 +-----------
.../layout-std140-base-size-and-alignment.c | 10 ++--------
tests/spec/arb_uniform_buffer_object/layout-std140.c | 12 +-----------
.../negative-getactiveuniformblockiv.c | 9 ++-------
.../negative-getactiveuniformsiv.c | 9 ++-------
tests/spec/arb_uniform_buffer_object/row-major.c | 14 ++------------
.../arb_uniform_buffer_object/uniformblockbinding.c | 10 ++--------
.../arb_vertex_buffer_object/mixed-immediate-and-vbo.c | 5 ++---
tests/spec/ext_texture_array/maxlayers.c | 7 ++-----
tests/spec/ext_texture_integer/fbo-blending.c | 8 ++------
.../fbo-integer-readpixels-sint-uint.c | 8 +++-----
.../spec/ext_texture_integer/texture-integer-glsl130.c | 8 ++------
.../depth_texture_mode_and_swizzle.c | 17 ++---------------
tests/spec/ext_timer_query/time-elapsed.c | 8 +-------
tests/spec/gl-2.0/api/getattriblocation-conventional.c | 4 +---
tests/spec/gl-2.0/edgeflag.c | 13 ++-----------
tests/spec/gl-2.0/vertex-program-two-side.c | 12 +-----------
tests/spec/gl-3.0/texture-integer.c | 6 ++----
tests/spec/gles-2.0/glsl-fs-pointcoord.c | 5 +----
.../gles-3.0/oes_compressed_etc2_texture-miptree.c | 8 +-------
.../execution/clipping/clip-plane-transformation.c | 11 +----------
.../glsl-1.30/execution/clipping/max-clip-distances.c | 11 +----------
tests/spec/glsl-1.30/execution/fs-discard-exit-2.c | 8 ++------
tests/spec/glsl-1.30/execution/fs-execution-ordering.c | 6 +-----
tests/spec/glsl-1.30/execution/fs-texelFetch-2D.c | 6 ++----
.../spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c | 6 ++----
tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c | 6 ++----
tests/spec/glsl-1.30/execution/vertexid-beginend.c | 9 ++-------
tests/spec/glsl-1.30/execution/vertexid-drawarrays.c | 9 ++-------
tests/spec/glsl-1.30/execution/vertexid-drawelements.c | 9 ++-------
tests/spec/nv_texture_barrier/blending-in-shader.c | 5 ++---
.../oes_compressed_etc1_rgb8_texture-miptree.c | 8 +-------
66 files changed, 114 insertions(+), 505 deletions(-)
diff --git a/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-explicit.c b/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-explicit.c
index ff8414b..1605961 100644
--- a/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-explicit.c
+++ b/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-explicit.c
@@ -257,8 +257,6 @@ test(void)
static const GLfloat test_color1[4] = { 0.5, 0.5, 0.5, 0.5 };
GLfloat expected[4];
GLuint prog;
- GLuint vs;
- GLuint fs;
int i, j, k, o;
if (max_ds_buffers > 1) {
@@ -266,19 +264,11 @@ test(void)
max_ds_buffers = 1;
}
- prog = glCreateProgram();
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
-
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- glAttachShader(prog, vs);
- glAttachShader(prog, fs);
- piglit_check_gl_error(GL_NO_ERROR);
-
create_fbo();
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
- glLinkProgram(prog);
+ prog = piglit_build_simple_program(vs_text, fs_text);
glUseProgram(prog);
uniform_src0 = glGetUniformLocation(prog, "src0");
diff --git a/tests/spec/arb_draw_elements_base_vertex/draw-elements-instanced-base-vertex.c b/tests/spec/arb_draw_elements_base_vertex/draw-elements-instanced-base-vertex.c
index fdb21fa..e8399a9 100644
--- a/tests/spec/arb_draw_elements_base_vertex/draw-elements-instanced-base-vertex.c
+++ b/tests/spec/arb_draw_elements_base_vertex/draw-elements-instanced-base-vertex.c
@@ -64,7 +64,7 @@ static const char *FragShaderText =
" gl_FragColor = gl_Color; \n"
"}\n";
-static GLuint VertShader, FragShader, Program;
+static GLuint Program;
static uintptr_t ib_offset;
@@ -134,13 +134,7 @@ piglit_init(int argc, char **argv)
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, user_va ? vb : NULL);
- VertShader = piglit_compile_shader_text(GL_VERTEX_SHADER, VertShaderText);
- assert(VertShader);
-
- FragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
- assert(FragShader);
-
- Program = piglit_link_simple_program(VertShader, FragShader);
+ Program = piglit_build_simple_program(VertShaderText, FragShaderText);
glUseProgram(Program);
diff --git a/tests/spec/arb_draw_instanced/execution/elements.c b/tests/spec/arb_draw_instanced/execution/elements.c
index e5998ab..7cb418b 100644
--- a/tests/spec/arb_draw_instanced/execution/elements.c
+++ b/tests/spec/arb_draw_instanced/execution/elements.c
@@ -113,20 +113,11 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLuint vs, fs, prog;
+ GLuint prog;
piglit_require_extension("GL_ARB_draw_instanced");
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
-
- prog = piglit_link_simple_program(vs, fs);
-
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
-
- glDeleteShader(vs);
- glDeleteShader(fs);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
}
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-fixed-type.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-fixed-type.c
index eda5e71..2f59279 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-fixed-type.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-fixed-type.c
@@ -85,7 +85,7 @@ static void expect_error(GLenum expect, const char * where, ...)
void
piglit_init(int argc, char **argv)
{
- GLuint vs, prog;
+ GLuint prog;
int i,j;
piglit_require_gl_version(20);
@@ -95,8 +95,7 @@ piglit_init(int argc, char **argv)
glClearColor(0.2, 0.2, 0.2, 0.2);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vertShaderText);
- prog = piglit_link_simple_program(vs, 0);
+ prog = piglit_build_simple_program(vertShaderText, NULL);
glUseProgram(prog);
diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c
index d0af980..0550bd6 100644
--- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c
+++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c
@@ -62,21 +62,16 @@ static const char fs_text[] =
void
draw(const float *color, float x_offset)
{
- GLuint vs, fs, prog;
+ GLuint prog;
GLint color_location;
GLint offset_location;
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vs_text, fs_text);
glBindAttribLocation(prog, 0, "vertex");
glLinkProgram(prog);
piglit_link_check_status(prog);
- glDeleteShader(vs);
- glDeleteShader(fs);
-
glUseProgram(prog);
color_location = glGetUniformLocation(prog, "color");
offset_location = glGetUniformLocation(prog, "offset");
diff --git a/tests/spec/arb_framebuffer_srgb/blit.c b/tests/spec/arb_framebuffer_srgb/blit.c
index cd8aecd..6791789 100644
--- a/tests/spec/arb_framebuffer_srgb/blit.c
+++ b/tests/spec/arb_framebuffer_srgb/blit.c
@@ -220,7 +220,7 @@ print_usage_and_exit(char *prog_name)
void
piglit_init(int argc, char **argv)
{
- GLint vs, fs, max_samples;
+ GLint max_samples;
if (argc != 5) {
print_usage_and_exit(argv[0]);
@@ -293,11 +293,7 @@ piglit_init(int argc, char **argv)
piglit_report_result(PIGLIT_SKIP);
}
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- prog = piglit_link_simple_program(vs, fs);
- glDeleteShader(vs);
- glDeleteShader(fs);
+ prog = piglit_build_simple_program(vs_text, fs_text);
src_fbo = setup_fbo(src_format, src_samples);
dst_fbo = setup_fbo(dst_format, dst_samples);
diff --git a/tests/spec/arb_instanced_arrays/instanced_arrays.c b/tests/spec/arb_instanced_arrays/instanced_arrays.c
index d349b22..083ae94 100644
--- a/tests/spec/arb_instanced_arrays/instanced_arrays.c
+++ b/tests/spec/arb_instanced_arrays/instanced_arrays.c
@@ -65,7 +65,7 @@ static const char *FragShaderText =
"} \n";
-static GLuint VertShader, FragShader, Program;
+static GLuint Program;
static GLboolean use_vbo = GL_FALSE;
@@ -199,13 +199,7 @@ piglit_init(int argc, char **argv)
piglit_require_GLSL();
piglit_require_extension("GL_ARB_instanced_arrays");
- VertShader = piglit_compile_shader_text(GL_VERTEX_SHADER, VertShaderText);
- assert(VertShader);
-
- FragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
- assert(FragShader);
-
- Program = piglit_link_simple_program(VertShader, FragShader);
+ Program = piglit_build_simple_program(VertShaderText, FragShaderText);
glUseProgram(Program);
diff --git a/tests/spec/arb_sampler_objects/sampler-incomplete.c b/tests/spec/arb_sampler_objects/sampler-incomplete.c
index 505887e..7ac930e 100644
--- a/tests/spec/arb_sampler_objects/sampler-incomplete.c
+++ b/tests/spec/arb_sampler_objects/sampler-incomplete.c
@@ -58,13 +58,12 @@ setup(void)
" + texture2D(tex1, coord);\n"
"}\n";
GLuint samplers[2];
- GLuint frag, prog;
+ GLuint prog;
GLint u;
GLuint tex;
/* Create fragment shader that adds the two textures */
- frag = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderText);
- prog = piglit_link_simple_program(0, frag);
+ prog = piglit_build_simple_program(NULL, fragShaderText);
glUseProgram(prog);
u = glGetUniformLocation(prog, "tex0");
diff --git a/tests/spec/arb_shader_objects/clear-with-deleted.c b/tests/spec/arb_shader_objects/clear-with-deleted.c
index b67d830..fc27023 100644
--- a/tests/spec/arb_shader_objects/clear-with-deleted.c
+++ b/tests/spec/arb_shader_objects/clear-with-deleted.c
@@ -55,7 +55,6 @@ static const char *fs_source =
enum piglit_result
piglit_display(void)
{
- GLuint vs, fs;
bool pass = true;
GLuint prog;
float green[] = {0.0, 1.0, 0.0, 0.0};
@@ -65,15 +64,8 @@ piglit_display(void)
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vs_source, fs_source);
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
-
- glDeleteShader(vs);
- glDeleteShader(fs);
glUseProgram(prog);
glDeleteProgram(prog);
diff --git a/tests/spec/arb_shader_objects/delete-repeat.c b/tests/spec/arb_shader_objects/delete-repeat.c
index 8977914..c37099e 100644
--- a/tests/spec/arb_shader_objects/delete-repeat.c
+++ b/tests/spec/arb_shader_objects/delete-repeat.c
@@ -52,7 +52,6 @@ static const char *fs_source =
enum piglit_result
piglit_display(void)
{
- GLuint vs, fs;
bool pass = true;
GLuint prog;
float green[] = {0.0, 1.0, 0.0, 0.0};
@@ -62,15 +61,8 @@ piglit_display(void)
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vs_source, fs_source);
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
-
- glDeleteShader(vs);
- glDeleteShader(fs);
glUseProgram(prog);
glDeleteProgram(prog);
diff --git a/tests/spec/arb_shader_objects/getactiveuniform-beginend.c b/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
index 55ddb68..a8cc7a0 100644
--- a/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
+++ b/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
@@ -57,18 +57,15 @@ const char *vs_source =
void
piglit_init(int argc, char **argv)
{
- GLuint vs, prog;
+ GLuint prog;
char name[4];
GLint size, len;
GLenum type;
piglit_require_vertex_shader();
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- prog = piglit_link_simple_program(vs, 0);
+ prog = piglit_build_simple_program(vs_source, NULL);
glUseProgram(prog);
- if (!vs || !prog)
- piglit_report_result(PIGLIT_FAIL);
glGetActiveUniformARB(prog, 0, sizeof(name), &len, &size, &type, name);
diff --git a/tests/spec/arb_shader_objects/getuniform.c b/tests/spec/arb_shader_objects/getuniform.c
index 19cfb35..b73af8e 100644
--- a/tests/spec/arb_shader_objects/getuniform.c
+++ b/tests/spec/arb_shader_objects/getuniform.c
@@ -304,20 +304,14 @@ static struct {
void
piglit_init(int argc, char **argv)
{
- GLuint vs;
int i;
bool pass = true;
piglit_require_vertex_shader();
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, source);
- assert(vs);
- prog = piglit_link_simple_program(vs, 0);
+ prog = piglit_build_simple_program(source, NULL);
glUseProgram(prog);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
-
for (i = 0; i < ARRAY_SIZE(uniforms); i++) {
const char *name = uniforms[i].name;
int loc = glGetUniformLocation(prog, name);
diff --git a/tests/spec/arb_shader_objects/getuniformlocation-array-of-struct-of-array.c b/tests/spec/arb_shader_objects/getuniformlocation-array-of-struct-of-array.c
index 8316f72..ccc073f 100644
--- a/tests/spec/arb_shader_objects/getuniformlocation-array-of-struct-of-array.c
+++ b/tests/spec/arb_shader_objects/getuniformlocation-array-of-struct-of-array.c
@@ -54,7 +54,6 @@ piglit_display(void)
void piglit_init(int argc, char **argv)
{
- GLint vert;
GLint prog;
GLint loc;
char name[256];
@@ -63,8 +62,7 @@ void piglit_init(int argc, char **argv)
unsigned j;
piglit_require_vertex_shader();
- vert = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
- prog = piglit_link_simple_program(vert, 0);
+ prog = piglit_build_simple_program(vs_code, NULL);
/* From page 80 of the OpenGL 2.1 spec:
*
diff --git a/tests/spec/arb_shader_texture_lod/execution/texgrad.c b/tests/spec/arb_shader_texture_lod/execution/texgrad.c
index bafefe4..66085e2 100644
--- a/tests/spec/arb_shader_texture_lod/execution/texgrad.c
+++ b/tests/spec/arb_shader_texture_lod/execution/texgrad.c
@@ -79,16 +79,13 @@ void piglit_init(int argc, char **argv)
GLuint tex, fb;
GLenum status;
int i, dim;
- static GLuint fs_tex, fs_texgrad;
piglit_require_GLSL();
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_shader_texture_lod");
- fs_tex = piglit_compile_shader_text(GL_FRAGMENT_SHADER, sh_tex);
- fs_texgrad = piglit_compile_shader_text(GL_FRAGMENT_SHADER, sh_texgrad);
- prog_tex = piglit_link_simple_program(0, fs_tex);
- prog_texgrad = piglit_link_simple_program(0, fs_texgrad);
+ prog_tex = piglit_build_simple_program(NULL, sh_tex);
+ prog_texgrad = piglit_build_simple_program(NULL, sh_texgrad);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
diff --git a/tests/spec/arb_shader_texture_lod/execution/texgradcube.c b/tests/spec/arb_shader_texture_lod/execution/texgradcube.c
index 90f7ddc..5cb7a47 100644
--- a/tests/spec/arb_shader_texture_lod/execution/texgradcube.c
+++ b/tests/spec/arb_shader_texture_lod/execution/texgradcube.c
@@ -78,16 +78,13 @@ void piglit_init(int argc, char **argv)
GLuint tex, fb;
GLenum status;
int i, j, dim;
- static GLuint fs_tex, fs_texgrad;
piglit_require_GLSL();
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_shader_texture_lod");
- fs_tex = piglit_compile_shader_text(GL_FRAGMENT_SHADER, sh_tex);
- fs_texgrad = piglit_compile_shader_text(GL_FRAGMENT_SHADER, sh_texgrad);
- prog_tex = piglit_link_simple_program(0, fs_tex);
- prog_texgrad = piglit_link_simple_program(0, fs_texgrad);
+ prog_tex = piglit_build_simple_program(NULL, sh_tex);
+ prog_texgrad = piglit_build_simple_program(NULL, sh_texgrad);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
diff --git a/tests/spec/arb_texture_buffer_object/fetch-outside-bounds.c b/tests/spec/arb_texture_buffer_object/fetch-outside-bounds.c
index 5860e6a..046d42b 100644
--- a/tests/spec/arb_texture_buffer_object/fetch-outside-bounds.c
+++ b/tests/spec/arb_texture_buffer_object/fetch-outside-bounds.c
@@ -69,16 +69,9 @@ piglit_display(void)
-1, 1
};
int vertex_location;
- GLuint fs, vs, prog;
+ GLuint prog;
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- if (!vs || !fs)
- piglit_report_result(PIGLIT_FAIL);
-
- prog = piglit_link_simple_program(vs, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
vertex_location = glGetAttribLocation(prog, "vertex");
diff --git a/tests/spec/arb_texture_buffer_object/formats.c b/tests/spec/arb_texture_buffer_object/formats.c
index 888a711..4eb395a 100644
--- a/tests/spec/arb_texture_buffer_object/formats.c
+++ b/tests/spec/arb_texture_buffer_object/formats.c
@@ -638,7 +638,7 @@ static void
create_program(struct program *program, const char *type)
{
char *fs_source, *vs_source;
- GLuint vs, fs, prog;
+ GLuint prog;
char *threshold;
if (strcmp(type, "") == 0)
@@ -656,20 +656,7 @@ create_program(struct program *program, const char *type)
threshold);
}
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- if (!vs) {
- printf("VS source:\n%s\n", vs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- if (!fs) {
- printf("FS source:\n%s\n", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(vs, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
program->prog = prog;
program->pos_location = glGetUniformLocation(prog, "pos");
diff --git a/tests/spec/arb_texture_buffer_object/render-no-bo.c b/tests/spec/arb_texture_buffer_object/render-no-bo.c
index 4712624..d2357ce 100644
--- a/tests/spec/arb_texture_buffer_object/render-no-bo.c
+++ b/tests/spec/arb_texture_buffer_object/render-no-bo.c
@@ -65,16 +65,9 @@ piglit_display(void)
-1, 1
};
int vertex_location;
- GLuint fs, vs, prog;
+ GLuint prog;
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- if (!vs || !fs)
- piglit_report_result(PIGLIT_FAIL);
-
- prog = piglit_link_simple_program(vs, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
vertex_location = glGetAttribLocation(prog, "vertex");
diff --git a/tests/spec/arb_texture_buffer_range/ranges.c b/tests/spec/arb_texture_buffer_range/ranges.c
index 62eeb82..ffdad56 100644
--- a/tests/spec/arb_texture_buffer_range/ranges.c
+++ b/tests/spec/arb_texture_buffer_range/ranges.c
@@ -156,22 +156,7 @@ static char *fs_source =
static void
init_program()
{
- GLuint vs, fs;
-
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- if (!vs) {
- printf("VS source:\n%s\n", vs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- if (!fs) {
- printf("FS source:\n%s\n", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(vs, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
vertex_location = glGetAttribLocation(prog, "vertex");
}
diff --git a/tests/spec/arb_texture_cube_map_array/cubemap.c b/tests/spec/arb_texture_cube_map_array/cubemap.c
index db381eb..320f6dc 100644
--- a/tests/spec/arb_texture_cube_map_array/cubemap.c
+++ b/tests/spec/arb_texture_cube_map_array/cubemap.c
@@ -84,7 +84,6 @@ static const char *frag_shader =
" gl_FragColor = texture(tex, gl_TexCoord[0]);\n"
"}\n";
-static GLuint frag_shader_cube_array;
static GLuint program_cube_array;
#if defined(_MSC_VER)
@@ -351,10 +350,8 @@ piglit_init(int argc, char **argv)
}
}
- frag_shader_cube_array = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag_shader);
- piglit_check_gl_error(GL_NO_ERROR);
- program_cube_array = piglit_link_simple_program(0, frag_shader_cube_array);
- piglit_check_gl_error(GL_NO_ERROR);
+ program_cube_array =
+ piglit_build_simple_program(NULL, frag_shader);
setup_texcoords();
}
diff --git a/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c b/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
index 234b7e0..9371a46 100644
--- a/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
+++ b/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
@@ -88,7 +88,6 @@ static const char *frag_shader_cube_array_text =
" gl_FragColor = texture(tex, gl_TexCoord[0]); \n"
"} \n";
-static GLuint frag_shader_cube_array;
static GLuint program_cube_array;
static int
@@ -248,14 +247,8 @@ void piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_ARB_texture_cube_map_array");
- /* Make shader programs */
- frag_shader_cube_array =
- piglit_compile_shader_text(GL_FRAGMENT_SHADER,
- frag_shader_cube_array_text);
- piglit_check_gl_error(GL_NO_ERROR);
-
- program_cube_array = piglit_link_simple_program(0, frag_shader_cube_array);
- piglit_check_gl_error(GL_NO_ERROR);
+ program_cube_array =
+ piglit_build_simple_program(NULL, frag_shader_cube_array_text);
setup_texcoords();
}
diff --git a/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c b/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c
index 7c80ef6..f22e984 100644
--- a/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c
+++ b/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c
@@ -45,8 +45,6 @@ PIGLIT_GL_TEST_CONFIG_END
static GLuint tex;
static GLint prog;
-static GLint fs;
-static GLint vs;
/* grab the coordinates from the main definition, and grab the
compvals from here */
@@ -97,9 +95,7 @@ static const char *fragShaderText =
static void
shaderSetup(void)
{
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vertShaderText);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderText);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vertShaderText, fragShaderText);
glUseProgram(prog);
}
diff --git a/tests/spec/arb_texture_float/texture-float-formats.c b/tests/spec/arb_texture_float/texture-float-formats.c
index 7ea2ed3..0f7c767 100644
--- a/tests/spec/arb_texture_float/texture-float-formats.c
+++ b/tests/spec/arb_texture_float/texture-float-formats.c
@@ -84,7 +84,7 @@ static const char *FragShaderText =
"} \n";
-static GLuint FragShader, Program;
+static GLuint Program;
@@ -370,10 +370,7 @@ piglit_init(int argc, char **argv)
HaveRG = piglit_is_extension_supported("GL_ARB_texture_rg");
- FragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
- assert(FragShader);
-
- Program = piglit_link_simple_program(0, FragShader);
+ Program = piglit_build_simple_program(NULL, FragShaderText);
glUseProgram(Program);
diff --git a/tests/spec/arb_uniform_buffer_object/dlist.c b/tests/spec/arb_uniform_buffer_object/dlist.c
index e207e87..2fb9b25 100644
--- a/tests/spec/arb_uniform_buffer_object/dlist.c
+++ b/tests/spec/arb_uniform_buffer_object/dlist.c
@@ -101,19 +101,14 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLuint fs, prog;
+ GLuint prog;
GLuint bo[2];
GLint current_bo;
GLint list;
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, source);
- prog = piglit_link_simple_program(fs, 0);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, source);
/* Test that glUniformBlockBinding() goes into display lists. */
glUniformBlockBinding(prog, 0, 0);
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
index 0558ec8..397f42a 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
@@ -70,7 +70,7 @@ test_format(const struct uniform_type *type, bool row_major)
" gl_FragColor = vec4(align_test);\n"
"}\n";
char *fs_source;
- GLuint fs, prog;
+ GLuint prog;
GLint data_size;
int expected;
const struct uniform_type *transposed_type;
@@ -83,12 +83,7 @@ test_format(const struct uniform_type *type, bool row_major)
asprintf(&fs_source, fs_template,
row_major ? "layout(row_major) " : "",
type->type);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
free(fs_source);
/* There's only one block, so it's uniform block 0. */
@@ -96,7 +91,6 @@ test_format(const struct uniform_type *type, bool row_major)
GL_UNIFORM_BLOCK_DATA_SIZE,
&data_size);
- glDeleteShader(fs);
glDeleteProgram(prog);
/* "align_test" at the start of the UBO is a float, so our
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockname.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockname.c
index 56a9613..c2fe044 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockname.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockname.c
@@ -80,7 +80,7 @@ void
piglit_init(int argc, char **argv)
{
int i;
- GLuint fs, prog;
+ GLuint prog;
const char *source =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"uniform a { float u1; };\n"
@@ -98,12 +98,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, source);
- prog = piglit_link_simple_program(fs, 0);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, source);
glGetProgramiv(prog, GL_ACTIVE_UNIFORM_BLOCKS, &blocks);
assert(blocks == 3);
@@ -203,7 +198,6 @@ piglit_init(int argc, char **argv)
pass = false;
glDeleteProgram(prog);
- glDeleteShader(fs);
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformname.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformname.c
index 38e209d..79eb015 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformname.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformname.c
@@ -80,7 +80,7 @@ void
piglit_init(int argc, char **argv)
{
unsigned int i;
- GLuint fs, prog;
+ GLuint prog;
const char *source =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"uniform ubo1 { float a; };\n"
@@ -98,12 +98,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, source);
- prog = piglit_link_simple_program(fs, 0);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, source);
glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &uniforms);
assert(uniforms == 4);
@@ -202,7 +197,6 @@ piglit_init(int argc, char **argv)
pass = false;
glDeleteProgram(prog);
- glDeleteShader(fs);
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c
index 61333e0..510f138 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c
@@ -60,7 +60,7 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLuint fs, prog;
+ GLuint prog;
const char *uniform_names[] = { "a", "b", "c", "d", "e", "f" };
int expected_strides[] = { 0, 16, 16, 64, -1, -1 };
GLint strides[ARRAY_SIZE(uniform_names)];
@@ -69,12 +69,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- printf("Failed to compile FS:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
glGetUniformIndices(prog, ARRAY_SIZE(uniform_names), uniform_names,
uniform_indices);
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c
index cd9ed78..be5778f 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c
@@ -65,7 +65,7 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLuint fs, vs, prog;
+ GLuint prog;
const char *uniform_block_names[3] = { "ub_a", "ub_b", "ub_c" };
const char *uniform_names[4] = { "a", "b", "c", "d" };
GLuint block_indices[3];
@@ -75,21 +75,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- if (!vs) {
- printf("Failed to compile VS:\n%s", vs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- if (!fs) {
- printf("Failed to compile FS:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(vs, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
for (i = 0; i < 3; i++) {
block_indices[i] =
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c
index 5320d7d..c139c6b 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c
@@ -65,7 +65,7 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLuint fs, prog;
+ GLuint prog;
const char *uniform_names[] = {
"v4",
"m4",
@@ -90,12 +90,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- printf("Failed to compile FS:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
glGetUniformIndices(prog, ARRAY_SIZE(uniform_names), uniform_names,
uniform_indices);
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
index 7831cb7..89f25af 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
@@ -57,7 +57,7 @@ test_format(const struct uniform_type *type)
" gl_FragColor = vec4(align_test + float(%s));\n"
"}\n";
char *fs_source;
- GLuint fs, prog;
+ GLuint prog;
const char *uniform_name = "u";
GLuint uniform_index;
GLint uniform_type;
@@ -72,21 +72,13 @@ test_format(const struct uniform_type *type)
}
asprintf(&fs_source, fs_template, type->type, deref);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", fs_source);
- free(fs_source);
- piglit_report_result(PIGLIT_FAIL);
- } else {
- free(fs_source);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
+ free(fs_source);
glGetUniformIndices(prog, 1, &uniform_name, &uniform_index);
glGetActiveUniformsiv(prog, 1, &uniform_index,
GL_UNIFORM_TYPE, &uniform_type);
- glDeleteShader(fs);
glDeleteProgram(prog);
printf("%-20s %20s %20s%s\n",
diff --git a/tests/spec/arb_uniform_buffer_object/getprogramiv.c b/tests/spec/arb_uniform_buffer_object/getprogramiv.c
index d635d06..e1ae6a3 100644
--- a/tests/spec/arb_uniform_buffer_object/getprogramiv.c
+++ b/tests/spec/arb_uniform_buffer_object/getprogramiv.c
@@ -90,23 +90,11 @@ struct {
static bool
test_shader(int test)
{
- GLuint fs, prog;
+ GLuint prog;
const char *source = tests[test].source;
int namelen = 9999, blocks = 9999;
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, source);
- if (!fs) {
- fprintf(stderr, "%d: Failed to compile shader:\n%s",
- test, source);
- return false;
- }
-
- prog = piglit_link_simple_program(fs, 0);
- if (!prog) {
- fprintf(stderr, "%d: Failed to link shader:\n%s", test, source);
- glDeleteShader(fs);
- return false;
- }
+ prog = piglit_build_simple_program(NULL, source);
glGetProgramiv(prog, GL_ACTIVE_UNIFORM_BLOCKS, &blocks);
if (blocks != tests[test].blocks) {
@@ -127,7 +115,6 @@ test_shader(int test)
}
glDeleteProgram(prog);
- glDeleteShader(fs);
return true;
}
diff --git a/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c b/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c
index f6f87b3..84a5771 100644
--- a/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c
+++ b/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c
@@ -57,19 +57,10 @@ piglit_init(int argc, char **argv)
bool pass = true;
int expected_ub_b_index;
int index;
- GLuint fs;
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag_shader_text);
- if (!fs) {
- printf("Failed to compile FS:\n%s", frag_shader_text);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(0, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(NULL, frag_shader_text);
index = glGetUniformBlockIndex(prog, "ub_a");
printf("Uniform block \"ub_a\" index: 0x%08x\n", index);
diff --git a/tests/spec/arb_uniform_buffer_object/getuniformindices.c b/tests/spec/arb_uniform_buffer_object/getuniformindices.c
index 894e0d7..900bad5 100644
--- a/tests/spec/arb_uniform_buffer_object/getuniformindices.c
+++ b/tests/spec/arb_uniform_buffer_object/getuniformindices.c
@@ -54,7 +54,6 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLuint fs;
GLuint save_index = 0xaaaaaaaa;
const GLchar *one_uniform = "a";
const GLchar *bad_uniform = "d";
@@ -65,15 +64,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag_shader_text);
- if (!fs) {
- printf("Failed to compile FS:\n%s", frag_shader_text);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(0, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(NULL, frag_shader_text);
/* From the GL_ARB_uniform_buffer_object spec:
*
diff --git a/tests/spec/arb_uniform_buffer_object/getuniformlocation.c b/tests/spec/arb_uniform_buffer_object/getuniformlocation.c
index e6045d8..af29b21 100644
--- a/tests/spec/arb_uniform_buffer_object/getuniformlocation.c
+++ b/tests/spec/arb_uniform_buffer_object/getuniformlocation.c
@@ -64,21 +64,11 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLuint fs;
int location;
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- if (!fs) {
- printf("Failed to compile FS:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(0, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
-
+ prog = piglit_build_simple_program(NULL, fs_source);
location = glGetUniformLocation(prog, "a");
if (location != -1) {
diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c b/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
index 1a4e8fe..15f38b2 100644
--- a/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
+++ b/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
@@ -65,7 +65,7 @@ test_format(const struct uniform_type *type, bool row_major)
" gl_FragColor = vec4(pad) + vec4(%s) + vec4(size_test);\n"
"}\n";
char *fs_source;
- GLuint fs, prog;
+ GLuint prog;
const char *uniform_names[] = { "u", "size_test" };
GLuint uniform_indices[2];
GLint offsets[2];
@@ -90,19 +90,13 @@ test_format(const struct uniform_type *type, bool row_major)
row_major && type->size > 16 ? "layout(row_major) " : "",
type->type,
deref);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
free(fs_source);
glGetUniformIndices(prog, 2, uniform_names, uniform_indices);
glGetActiveUniformsiv(prog, 2, uniform_indices,
GL_UNIFORM_OFFSET, offsets);
- glDeleteShader(fs);
glDeleteProgram(prog);
offset = offsets[0];
diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140.c b/tests/spec/arb_uniform_buffer_object/layout-std140.c
index f10b558..43d0336 100644
--- a/tests/spec/arb_uniform_buffer_object/layout-std140.c
+++ b/tests/spec/arb_uniform_buffer_object/layout-std140.c
@@ -103,20 +103,10 @@ static const char frag_shader_text[] =
static void
init(void)
{
- GLuint fs;
-
piglit_require_GLSL_version(130);
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag_shader_text);
- if (!fs) {
- printf("Failed to compile FS:\n%s", frag_shader_text);
- piglit_report_result(PIGLIT_FAIL);
- }
-
- prog = piglit_link_simple_program(0, fs);
- if (!prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(NULL, frag_shader_text);
glUseProgram(prog);
}
diff --git a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c
index e4ebfac..68f7fdb 100644
--- a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c
+++ b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c
@@ -73,17 +73,12 @@ piglit_init(int argc, char **argv)
"void main() {\n"
" gl_FragColor = vec4(u);\n"
"}\n";
- GLuint fs, prog;
+ GLuint prog;
GLint junk = 0xd0d0, unwritten_junk = junk;
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
/* Test a bad pname (it's one for glActiveUniformsiv). */
glGetActiveUniformBlockiv(prog, 0, GL_UNIFORM_TYPE, &junk);
diff --git a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c
index 4da720e..1c4e49f 100644
--- a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c
+++ b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c
@@ -74,19 +74,14 @@ piglit_init(int argc, char **argv)
"void main() {\n"
" gl_FragColor = vec4(u);\n"
"}\n";
- GLuint fs, prog;
+ GLuint prog;
GLint junk = 0xd0d0;
GLint unwritten_junk = junk;
GLuint good_index = 0, bad_index = 1;
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, fs_source);
/* Test a bad pname (it's one for glActiveUniformBlockiv). */
glGetActiveUniformsiv(prog, 1, &good_index,
diff --git a/tests/spec/arb_uniform_buffer_object/row-major.c b/tests/spec/arb_uniform_buffer_object/row-major.c
index 50cb48a..9489d2e 100644
--- a/tests/spec/arb_uniform_buffer_object/row-major.c
+++ b/tests/spec/arb_uniform_buffer_object/row-major.c
@@ -193,20 +193,10 @@ piglit_init(int argc, char **argv)
{
bool pass = true;
unsigned int i;
- GLuint fs, prog;
+ GLuint prog;
piglit_require_extension("GL_ARB_uniform_buffer_object");
-
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, source);
- if (!fs) {
- fprintf(stderr, "Failed to compile shader:\n%s", source);
- piglit_report_result(PIGLIT_FAIL);
- }
- prog = piglit_link_simple_program(fs, 0);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile/link shader:\n%s", source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, source);
for (i = 0; i < ARRAY_SIZE(uniforms); i++) {
GLuint index;
diff --git a/tests/spec/arb_uniform_buffer_object/uniformblockbinding.c b/tests/spec/arb_uniform_buffer_object/uniformblockbinding.c
index d231bb2..9e426a7 100644
--- a/tests/spec/arb_uniform_buffer_object/uniformblockbinding.c
+++ b/tests/spec/arb_uniform_buffer_object/uniformblockbinding.c
@@ -72,7 +72,7 @@ void
piglit_init(int argc, char **argv)
{
int i;
- GLuint fs, prog;
+ GLuint prog;
const char *source =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"uniform a { float u1; };\n"
@@ -86,12 +86,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_uniform_buffer_object");
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, source);
- prog = piglit_link_simple_program(fs, 0);
- if (!fs || !prog) {
- fprintf(stderr, "Failed to compile shader:\n%s", source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ prog = piglit_build_simple_program(NULL, source);
glGetProgramiv(prog, GL_ACTIVE_UNIFORM_BLOCKS, &blocks);
assert(blocks == 2);
@@ -151,7 +146,6 @@ piglit_init(int argc, char **argv)
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glDeleteProgram(prog);
- glDeleteShader(fs);
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c b/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c
index 357f05b..aae9e8e 100644
--- a/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c
+++ b/tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c
@@ -70,7 +70,7 @@ piglit_display(void)
};
uint32_t index_data[] = { 0, 1, 2, 3 };
uintptr_t index_offset = sizeof(vertex_data);
- GLuint prog, vs;
+ GLuint prog;
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -79,8 +79,7 @@ piglit_display(void)
* color data into a uniform in the fixed function vertex
* shader.
*/
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- prog = piglit_link_simple_program(vs, 0);
+ prog = piglit_build_simple_program(vs_source, NULL);
glUseProgram(prog);
glGenBuffersARB(1, &vbo);
diff --git a/tests/spec/ext_texture_array/maxlayers.c b/tests/spec/ext_texture_array/maxlayers.c
index 9236d56..b0d3f30 100644
--- a/tests/spec/ext_texture_array/maxlayers.c
+++ b/tests/spec/ext_texture_array/maxlayers.c
@@ -132,7 +132,7 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLuint prog, fs;
+ GLuint prog;
piglit_require_extension("GL_EXT_texture_array");
@@ -144,10 +144,7 @@ piglit_init(int argc, char **argv)
printf("Testing %d texture layers\n", max_layers);
/* Make shader programs */
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(0, fs);
- if (!fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(NULL, fs_source);
glUseProgram(prog);
layer_loc = glGetUniformLocation(prog, "layer");
diff --git a/tests/spec/ext_texture_integer/fbo-blending.c b/tests/spec/ext_texture_integer/fbo-blending.c
index ad8e66d..f0c8665 100644
--- a/tests/spec/ext_texture_integer/fbo-blending.c
+++ b/tests/spec/ext_texture_integer/fbo-blending.c
@@ -263,7 +263,7 @@ piglit_init(int argc, char **argv)
"{\n"
" result = color;\n"
"}\n";
- GLuint fs, vs, prog;
+ GLuint prog;
int f, i;
enum piglit_result result = PIGLIT_SKIP;
const struct format_info *test_formats = formats;
@@ -287,11 +287,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_EXT_texture_integer");
piglit_require_GLSL_version(130);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- prog = piglit_link_simple_program(vs, fs);
- if (!prog || !fs || !vs)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
color_loc = glGetUniformLocation(prog, "color");
glUniform4uiv(color_loc, 1, color);
diff --git a/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c b/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c
index a293154..1682253 100644
--- a/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c
+++ b/tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c
@@ -69,7 +69,7 @@ static const char *PassthroughFragShaderText =
" gl_FragColor = gl_Color; \n"
"} \n";
-static GLuint PassthroughFragShader, PassthroughProgram;
+static GLuint PassthroughProgram;
#if 0
@@ -289,10 +289,8 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_EXT_texture_integer");
piglit_require_GLSL_version(130);
- PassthroughFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
- PassthroughFragShaderText);
- assert(PassthroughFragShader);
- PassthroughProgram = piglit_link_simple_program(0, PassthroughFragShader);
+ PassthroughProgram =
+ piglit_build_simple_program(NULL, PassthroughFragShaderText);
(void) check_error(__FILE__, __LINE__);
diff --git a/tests/spec/ext_texture_integer/texture-integer-glsl130.c b/tests/spec/ext_texture_integer/texture-integer-glsl130.c
index 228b837..1fefa5a 100644
--- a/tests/spec/ext_texture_integer/texture-integer-glsl130.c
+++ b/tests/spec/ext_texture_integer/texture-integer-glsl130.c
@@ -141,7 +141,7 @@ static const char *FragShaderText =
" gl_FragColor = t + bias; \n"
"} \n";
-static GLuint FragShader, Program;
+static GLuint Program;
static int
@@ -566,11 +566,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_EXT_texture_integer");
piglit_require_GLSL_version(130);
- FragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
- FragShaderText);
- assert(FragShader);
-
- Program = piglit_link_simple_program(0, FragShader);
+ Program = piglit_build_simple_program(NULL, FragShaderText);
glUseProgram(Program);
diff --git a/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c b/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c
index d0d0270..2665ba1 100644
--- a/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c
+++ b/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c
@@ -153,7 +153,7 @@ setup_texture()
void
setup_shaders()
{
- GLuint vs, fs, prog, tex_location;
+ GLuint prog, tex_location;
static const char *vs_code =
"#version 120\n"
@@ -169,20 +169,7 @@ setup_shaders()
" gl_FragColor = texture2D(tex, vec2(0.5, 0.5));\n"
"}\n";
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
- if (!vs) {
- printf("VS code:\n%s", vs_code);
- piglit_report_result(PIGLIT_FAIL);
- }
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_code);
- if (!fs) {
- printf("FS code:\n%s", fs_code);
- piglit_report_result(PIGLIT_FAIL);
- }
- prog = piglit_link_simple_program(vs, fs);
- if (!piglit_link_check_status(prog))
- piglit_report_result(PIGLIT_FAIL);
-
+ prog = piglit_build_simple_program(vs_code, fs_code);
glUseProgram(prog);
tex_location = glGetUniformLocation(prog, "tex");
diff --git a/tests/spec/ext_timer_query/time-elapsed.c b/tests/spec/ext_timer_query/time-elapsed.c
index a407b87..e0da672 100644
--- a/tests/spec/ext_timer_query/time-elapsed.c
+++ b/tests/spec/ext_timer_query/time-elapsed.c
@@ -310,15 +310,9 @@ retry:
void
piglit_init(int argc, char **argv)
{
- GLint vs, fs;
-
piglit_require_gl_version(20);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- prog = piglit_link_simple_program(vs, fs);
- glDeleteShader(vs);
- glDeleteShader(fs);
+ prog = piglit_build_simple_program(vs_text, fs_text);
iters_loc = glGetUniformLocation(prog, "iters");
piglit_require_extension("GL_EXT_timer_query");
diff --git a/tests/spec/gl-2.0/api/getattriblocation-conventional.c b/tests/spec/gl-2.0/api/getattriblocation-conventional.c
index 5396965..d702784 100644
--- a/tests/spec/gl-2.0/api/getattriblocation-conventional.c
+++ b/tests/spec/gl-2.0/api/getattriblocation-conventional.c
@@ -50,13 +50,11 @@ piglit_display(void)
void piglit_init(int argc, char **argv)
{
- GLint vert;
GLint prog;
GLint loc;
piglit_require_vertex_shader();
- vert = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
- prog = piglit_link_simple_program(vert, 0);
+ prog = piglit_build_simple_program(vs_code, NULL);
loc = glGetAttribLocation(prog, "gl_Vertex");
printf("Attribute location reported for gl_Vertex is %d.\n", loc);
diff --git a/tests/spec/gl-2.0/edgeflag.c b/tests/spec/gl-2.0/edgeflag.c
index 1ffa778..ff46ab1 100644
--- a/tests/spec/gl-2.0/edgeflag.c
+++ b/tests/spec/gl-2.0/edgeflag.c
@@ -112,18 +112,9 @@ const char *fs_source =
void
piglit_init(int argc, char **argv)
{
- GLuint vs, fs, prog;
-
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
-
- if (!prog || !vs || !fs) {
- printf("VS source:\n%s", vs_source);
- printf("FS source:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
+ GLuint prog;
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
color_index = glGetAttribLocation(prog, "in_color");
}
diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c b/tests/spec/gl-2.0/vertex-program-two-side.c
index a24e10a..3075ffd 100644
--- a/tests/spec/gl-2.0/vertex-program-two-side.c
+++ b/tests/spec/gl-2.0/vertex-program-two-side.c
@@ -147,7 +147,6 @@ setup_output(char **out, const char *name, float *values)
void
piglit_init(int argc, char **argv)
{
- GLint vs, fs;
char *vs_outputs[4] = {"", "", "", ""};
char *vs_source;
int i;
@@ -199,16 +198,7 @@ piglit_init(int argc, char **argv)
vs_outputs[2],
vs_outputs[3]);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
-
- if (!prog || !vs || !fs) {
- printf("VS source:\n%s", vs_source);
- printf("FS source:\n%s", fs_source);
- piglit_report_result(PIGLIT_FAIL);
- }
-
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
draw_secondary_loc = glGetUniformLocation(prog, "draw_secondary");
assert(draw_secondary_loc != -1);
diff --git a/tests/spec/gl-3.0/texture-integer.c b/tests/spec/gl-3.0/texture-integer.c
index bb60168..f2a5692 100644
--- a/tests/spec/gl-3.0/texture-integer.c
+++ b/tests/spec/gl-3.0/texture-integer.c
@@ -374,15 +374,13 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLuint fragShader, program;
+ GLuint program;
static GLuint tex;
piglit_require_gl_version(30);
piglit_require_GLSL_version(130);
- fragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, FragShaderText);
-
- program = piglit_link_simple_program(0, fragShader);
+ program = piglit_build_simple_program(NULL, FragShaderText);
glUseProgram(program);
BiasUniform = glGetUniformLocation(program, "bias");
diff --git a/tests/spec/gles-2.0/glsl-fs-pointcoord.c b/tests/spec/gles-2.0/glsl-fs-pointcoord.c
index 9dacf55..4be7b74 100644
--- a/tests/spec/gles-2.0/glsl-fs-pointcoord.c
+++ b/tests/spec/gles-2.0/glsl-fs-pointcoord.c
@@ -122,7 +122,6 @@ piglit_display(void)
void piglit_init(int argc, char**argv)
{
- GLint vs, fs;
GLint point_size_limits[2];
glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_size_limits);
@@ -133,9 +132,7 @@ void piglit_init(int argc, char**argv)
if (point_size > piglit_height)
point_size = piglit_height;
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
}
diff --git a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
index 33537f4..8881432 100644
--- a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
+++ b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
@@ -168,9 +168,6 @@ piglit_init(int argc, char **argv)
0, 1,
};
- GLuint vs;
- GLuint fs;
-
GLint vertex_loc;
GLuint vertex_buf;
GLuint vao;
@@ -246,10 +243,7 @@ piglit_init(int argc, char **argv)
glClearColor(0.3, 0.5, 1.0, 1.0);
glViewport(0, 0, window_width, window_height);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
- assert(prog != 0);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
vertex_loc = glGetAttribLocation(prog, "vertex");
diff --git a/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c b/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c
index 9844bc3..e8ac2f5 100644
--- a/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c
+++ b/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c
@@ -195,8 +195,6 @@ char *setters;
void
setup_glsl_programs()
{
- GLuint vs;
- GLuint fs;
GLuint prog;
char vert[4096];
@@ -234,14 +232,7 @@ setup_glsl_programs()
"}",
version_directive);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
- prog = glCreateProgram();
- glAttachShader(prog, vs);
- glAttachShader(prog, fs);
- glLinkProgram(prog);
- glDeleteShader(vs);
- glDeleteShader(fs);
+ prog = piglit_build_simple_program(vert, frag);
glUseProgram(prog);
position_angle_loc = glGetUniformLocation(prog, "position_angle");
if (use_clip_vertex) {
diff --git a/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.c b/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.c
index d803096..9e5a3ee 100644
--- a/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.c
+++ b/tests/spec/glsl-1.30/execution/clipping/max-clip-distances.c
@@ -157,18 +157,9 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLuint vs;
- GLuint fs;
-
piglit_require_GLSL();
piglit_require_GLSL_version(130);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
- prog = glCreateProgram();
- glAttachShader(prog, vs);
- glAttachShader(prog, fs);
+ prog = piglit_build_simple_program(vert, frag);
glLinkProgram(prog);
- glDeleteShader(vs);
- glDeleteShader(fs);
glUseProgram(prog);
}
diff --git a/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c b/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c
index cdd01be..78ab97d 100644
--- a/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c
+++ b/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c
@@ -145,15 +145,11 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- int vs, fs, prog;
+ int prog;
piglit_require_GLSL_version(130);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_source, fs_source);
coord1_location = glGetUniformLocation(prog, "coord1");
coord2_location = glGetUniformLocation(prog, "coord2");
diff --git a/tests/spec/glsl-1.30/execution/fs-execution-ordering.c b/tests/spec/glsl-1.30/execution/fs-execution-ordering.c
index b7780cd..bf8e66b 100644
--- a/tests/spec/glsl-1.30/execution/fs-execution-ordering.c
+++ b/tests/spec/glsl-1.30/execution/fs-execution-ordering.c
@@ -90,13 +90,9 @@ static const char *fstext =
void
piglit_init(int argc, char **argv)
{
- GLuint vs, fs;
-
piglit_require_GLSL_version(130);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vstext, fstext);
glGenBuffers(1, &vbo_handle);
if (!piglit_check_gl_error(GL_NO_ERROR))
diff --git a/tests/spec/glsl-1.30/execution/fs-texelFetch-2D.c b/tests/spec/glsl-1.30/execution/fs-texelFetch-2D.c
index 5434477..494cfa4 100644
--- a/tests/spec/glsl-1.30/execution/fs-texelFetch-2D.c
+++ b/tests/spec/glsl-1.30/execution/fs-texelFetch-2D.c
@@ -116,7 +116,7 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- int vs, fs, prog;
+ int prog;
int tex_location;
piglit_require_GLSL_version(130);
@@ -127,9 +127,7 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, false);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vert, frag);
tex_location = glGetUniformLocation(prog, "tex");
lod_location = glGetUniformLocation(prog, "lod");
diff --git a/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c b/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
index bfbe406..cf5c1ec 100644
--- a/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
+++ b/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
@@ -137,7 +137,7 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- int vs, fs, prog;
+ int prog;
int tex_location;
piglit_require_GLSL_version(130);
@@ -148,9 +148,7 @@ piglit_init(int argc, char **argv)
piglit_ortho_projection(piglit_width, piglit_height, false);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vert, frag);
tex_location = glGetUniformLocation(prog, "tex");
lod_location = glGetUniformLocation(prog, "lod");
diff --git a/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c b/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
index 4d2f7c5..e796df7 100644
--- a/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
+++ b/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
@@ -132,7 +132,7 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- int vs, fs, prog;
+ int prog;
piglit_require_GLSL_version(130);
@@ -142,9 +142,7 @@ piglit_init(int argc, char **argv)
GL_UNSIGNED_NORMALIZED);
/* TODO: test other texture instructions */
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragtexlodoffset);
- prog = piglit_link_simple_program(vs, fs);
+ prog = piglit_build_simple_program(vert, fragtexlodoffset);
lod_location = glGetUniformLocation(prog, "lod");
pos_location = glGetUniformLocation(prog, "pos");
diff --git a/tests/spec/glsl-1.30/execution/vertexid-beginend.c b/tests/spec/glsl-1.30/execution/vertexid-beginend.c
index 27cf942..366279c 100644
--- a/tests/spec/glsl-1.30/execution/vertexid-beginend.c
+++ b/tests/spec/glsl-1.30/execution/vertexid-beginend.c
@@ -64,16 +64,11 @@ static const char fs_text[] =
void
piglit_init(int argc, char **argv)
{
- GLuint vs, fs, prog;
+ GLuint prog;
piglit_require_GLSL_version(130);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- prog = piglit_link_simple_program(vs, fs);
-
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_text, fs_text);
glUseProgram(prog);
}
diff --git a/tests/spec/glsl-1.30/execution/vertexid-drawarrays.c b/tests/spec/glsl-1.30/execution/vertexid-drawarrays.c
index 6a0db8d..26b3df1 100644
--- a/tests/spec/glsl-1.30/execution/vertexid-drawarrays.c
+++ b/tests/spec/glsl-1.30/execution/vertexid-drawarrays.c
@@ -64,16 +64,11 @@ static const char fs_text[] =
void
piglit_init(int argc, char **argv)
{
- GLuint vs, fs, prog;
+ GLuint prog;
piglit_require_GLSL_version(130);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- prog = piglit_link_simple_program(vs, fs);
-
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_text, fs_text);
glUseProgram(prog);
}
diff --git a/tests/spec/glsl-1.30/execution/vertexid-drawelements.c b/tests/spec/glsl-1.30/execution/vertexid-drawelements.c
index 9a61e64..4193c48 100644
--- a/tests/spec/glsl-1.30/execution/vertexid-drawelements.c
+++ b/tests/spec/glsl-1.30/execution/vertexid-drawelements.c
@@ -64,16 +64,11 @@ static const char fs_text[] =
void
piglit_init(int argc, char **argv)
{
- GLuint vs, fs, prog;
+ GLuint prog;
piglit_require_GLSL_version(130);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
- prog = piglit_link_simple_program(vs, fs);
-
- if (!vs || !fs || !prog)
- piglit_report_result(PIGLIT_FAIL);
+ prog = piglit_build_simple_program(vs_text, fs_text);
glUseProgram(prog);
}
diff --git a/tests/spec/nv_texture_barrier/blending-in-shader.c b/tests/spec/nv_texture_barrier/blending-in-shader.c
index 3281899..7bc8a1b 100644
--- a/tests/spec/nv_texture_barrier/blending-in-shader.c
+++ b/tests/spec/nv_texture_barrier/blending-in-shader.c
@@ -85,7 +85,7 @@ enum piglit_result piglit_display(void)
void piglit_init(int argc, char **argv)
{
- unsigned int i, j, fs;
+ unsigned int i, j;
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_NV_texture_barrier");
@@ -115,8 +115,7 @@ void piglit_init(int argc, char **argv)
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext);
- prog = piglit_link_simple_program(0, fs);
+ prog = piglit_build_simple_program(NULL, fstext);
texloc = glGetUniformLocation(prog, "fb");
}
diff --git a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c
index 717793c..10590f7 100644
--- a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c
+++ b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c
@@ -157,9 +157,6 @@ piglit_init(int argc, char **argv)
0, 1,
};
- GLuint vs;
- GLuint fs;
-
GLint vertex_loc;
GLuint vertex_buf;
@@ -171,10 +168,7 @@ piglit_init(int argc, char **argv)
glClearColor(1.0, 0.0, 0.0, 1.0);
glViewport(0, 0, window_width, window_height);
- vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
- fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
- prog = piglit_link_simple_program(vs, fs);
- assert(prog != 0);
+ prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
vertex_loc = glGetAttribLocation(prog, "vertex");
--
1.8.3.rc0
More information about the Piglit
mailing list