summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-05-20 13:15:48 -0700
committerEric Anholt <eric@anholt.net>2013-06-04 11:30:11 -0700
commit6665b86e1d7917af7c4fd633844b672bc42fd4e5 (patch)
tree0fb19d091cd6754ec569ce3cc38598c19a88783f
parent8317faccfec90caacae01be7525abb2097c898b9 (diff)
piglit: Switch a bunch of tests over to piglit_build_simple_program.
Since I was about to clean up some piglit_compile_shader_text calls, I was looking at all these anyway. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-explicit.c12
-rw-r--r--tests/spec/arb_draw_elements_base_vertex/draw-elements-instanced-base-vertex.c10
-rw-r--r--tests/spec/arb_draw_instanced/execution/elements.c13
-rw-r--r--tests/spec/arb_es2_compatibility/arb_es2_compatibility-fixed-type.c5
-rw-r--r--tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c9
-rw-r--r--tests/spec/arb_framebuffer_srgb/blit.c8
-rw-r--r--tests/spec/arb_instanced_arrays/instanced_arrays.c10
-rw-r--r--tests/spec/arb_sampler_objects/sampler-incomplete.c5
-rw-r--r--tests/spec/arb_shader_objects/clear-with-deleted.c10
-rw-r--r--tests/spec/arb_shader_objects/delete-repeat.c10
-rw-r--r--tests/spec/arb_shader_objects/getactiveuniform-beginend.c7
-rw-r--r--tests/spec/arb_shader_objects/getuniform.c8
-rw-r--r--tests/spec/arb_shader_objects/getuniformlocation-array-of-struct-of-array.c4
-rw-r--r--tests/spec/arb_shader_texture_lod/execution/texgrad.c7
-rw-r--r--tests/spec/arb_shader_texture_lod/execution/texgradcube.c7
-rw-r--r--tests/spec/arb_texture_buffer_object/fetch-outside-bounds.c11
-rw-r--r--tests/spec/arb_texture_buffer_object/formats.c17
-rw-r--r--tests/spec/arb_texture_buffer_object/render-no-bo.c11
-rw-r--r--tests/spec/arb_texture_buffer_range/ranges.c17
-rw-r--r--tests/spec/arb_texture_cube_map_array/cubemap.c7
-rw-r--r--tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c11
-rw-r--r--tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c6
-rw-r--r--tests/spec/arb_texture_float/texture-float-formats.c7
-rw-r--r--tests/spec/arb_uniform_buffer_object/dlist.c9
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c10
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformblockname.c10
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformname.c10
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c9
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c18
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c9
-rw-r--r--tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c14
-rw-r--r--tests/spec/arb_uniform_buffer_object/getprogramiv.c17
-rw-r--r--tests/spec/arb_uniform_buffer_object/getuniformblockindex.c11
-rw-r--r--tests/spec/arb_uniform_buffer_object/getuniformindices.c11
-rw-r--r--tests/spec/arb_uniform_buffer_object/getuniformlocation.c12
-rw-r--r--tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c10
-rw-r--r--tests/spec/arb_uniform_buffer_object/layout-std140.c12
-rw-r--r--tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c9
-rw-r--r--tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c9
-rw-r--r--tests/spec/arb_uniform_buffer_object/row-major.c14
-rw-r--r--tests/spec/arb_uniform_buffer_object/uniformblockbinding.c10
-rw-r--r--tests/spec/arb_vertex_buffer_object/mixed-immediate-and-vbo.c5
-rw-r--r--tests/spec/ext_texture_array/maxlayers.c7
-rw-r--r--tests/spec/ext_texture_integer/fbo-blending.c8
-rw-r--r--tests/spec/ext_texture_integer/fbo-integer-readpixels-sint-uint.c8
-rw-r--r--tests/spec/ext_texture_integer/texture-integer-glsl130.c8
-rw-r--r--tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c17
-rw-r--r--tests/spec/ext_timer_query/time-elapsed.c8
-rw-r--r--tests/spec/gl-2.0/api/getattriblocation-conventional.c4
-rw-r--r--tests/spec/gl-2.0/edgeflag.c13
-rw-r--r--tests/spec/gl-2.0/vertex-program-two-side.c12
-rw-r--r--tests/spec/gl-3.0/texture-integer.c6
-rw-r--r--tests/spec/gles-2.0/glsl-fs-pointcoord.c5
-rw-r--r--tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c8
-rw-r--r--tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c11
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/max-clip-distances.c12
-rw-r--r--tests/spec/glsl-1.30/execution/fs-discard-exit-2.c8
-rw-r--r--tests/spec/glsl-1.30/execution/fs-execution-ordering.c6
-rw-r--r--tests/spec/glsl-1.30/execution/fs-texelFetch-2D.c6
-rw-r--r--tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c6
-rw-r--r--tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c6
-rw-r--r--tests/spec/glsl-1.30/execution/vertexid-beginend.c9
-rw-r--r--tests/spec/glsl-1.30/execution/vertexid-drawarrays.c9
-rw-r--r--tests/spec/glsl-1.30/execution/vertexid-drawelements.c9
-rw-r--r--tests/spec/nv_texture_barrier/blending-in-shader.c5
-rw-r--r--tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-miptree.c8
66 files changed, 114 insertions, 506 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 ff8414b5d..1605961f6 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 fdb21fa98..e8399a987 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 e5998ab08..7cb418ba7 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 eda5e7162..2f5927943 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 d0af980e9..0550bd608 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 cd8aecd7b..679178932 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 d349b2280..083ae9425 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 505887ea4..7ac930e11 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 b67d830e0..fc27023e5 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 897791435..c37099eb4 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 55ddb68b0..a8cc7a0db 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 19cfb3576..b73af8e03 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 8316f7232..ccc073f1a 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 bafefe42a..66085e22e 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 90f7ddcc7..5cb7a4788 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 5860e6ac5..046d42b08 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 888a71148..4eb395aaa 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 4712624ff..d2357cece 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 62eeb8222..ffdad565a 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 db381eba6..320f6dc94 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 234b7e0c6..9371a466d 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 7c80ef637..f22e984be 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 7ea2ed301..0f7c767bb 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 e207e8720..2fb9b25df 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 0558ec8cb..397f42a18 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 56a961312..c2fe0443c 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 38e209d6f..79eb015d2 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 61333e0f7..510f138e4 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 cd9ed780a..be5778f02 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 5320d7db4..c139c6b29 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 7831cb726..89f25afda 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 d635d0627..e1ae6a3f9 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 f6f87b38f..84a5771d5 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 894e0d7e6..900bad528 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 e6045d85a..af29b2179 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 1a4e8fe58..15f38b207 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 f10b558e8..43d033606 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 e4ebfac37..68f7fdbde 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 4da720e74..1c4e49f02 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 50cb48a40..9489d2e0f 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 d231bb20a..9e426a748 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 357f05bad..aae9e8e72 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 9236d5600..b0d3f3028 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 ad8e66df1..f0c86651d 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 a29315413..1682253d0 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 228b8379a..1fefa5ab6 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 d0d02700a..2665ba10f 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 a407b8719..e0da6725b 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 53969652d..d7027844a 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 1ffa77802..ff46ab1ae 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 a24e10a18..3075ffd02 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 bb60168d4..f2a5692b6 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 9dacf5585..4be7b7401 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 33537f411..88814329d 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 9844bc3a1..e8ac2f52f 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 d803096c8..d8769370e 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,8 @@ 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);
- glLinkProgram(prog);
- glDeleteShader(vs);
- glDeleteShader(fs);
+ prog = piglit_build_simple_program(vert, frag);
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 cdd01be11..78ab97de7 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 b7780cde8..bf8e66b2a 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 543447747..494cfa49a 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 bfbe406c6..cf5c1ec20 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 4d2f7c5bc..e796df7c2 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 27cf942d2..366279cf9 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 6a0db8d28..26b3df1b0 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 9a61e6495..4193c4884 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 328189925..7bc8a1bd1 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 717793c6c..10590f7d1 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");