Example #1
0
void
piglit_init(int argc, char **argv)
{
	GLboolean try_to_render;
	GLuint vs;
	GLuint fs;

	piglit_require_gl_version(20);

	piglit_require_extension("GL_EXT_separate_shader_objects");

	glClearColor(0.3, 0.3, 0.3, 0.0);
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);

	prog[0] = piglit_link_simple_program(vs, 0);
	prog[1] = piglit_link_simple_program(0,  fs);

	glDeleteShader(vs);
	glDeleteShader(fs);

	/* Don't try to render if either program failed to link, and linking
	 * had better succeed!
	 */
	try_to_render = piglit_link_check_status(prog[0]);
	try_to_render = piglit_link_check_status(prog[1])
		&& try_to_render;

	if (!try_to_render)
		piglit_report_result(PIGLIT_FAIL);
}
void
piglit_init(int argc, char **argv)
{
	GLint fsr;
	GLint fsg;
	GLint vs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	glClearColor(0.2, 0.2, 0.2, 1.0);

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vertShaderText);
	fsr = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderTextRed);
	fsg =
	  piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderTextGreen);

	progr = piglit_link_simple_program(vs, fsr);
	progg = piglit_link_simple_program(vs, fsg);

	list = glGenLists(1);
	glNewList(list, GL_COMPILE);
		glUseProgram(progg);
	glEndList();
}
Example #3
0
void
piglit_init(int argc, char **argv)
{
	GLuint vs;
	GLuint fs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	piglit_require_extension("GL_EXT_separate_shader_objects");

	glClearColor(0.3, 0.3, 0.3, 0.0);

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, bad_fs_text);

	prog[0] = piglit_link_simple_program(vs, 0);
	prog[1] = glCreateShaderProgramEXT(GL_FRAGMENT_SHADER, good_fs_text);
	prog[2] = piglit_link_simple_program(vs, fs);

	glDeleteShader(vs);
	glDeleteShader(fs);
}
Example #4
0
void
piglit_init(int argc, char **argv)
{
   piglit_require_extension("GL_ARB_framebuffer_object");
   piglit_require_extension("GL_EXT_texture_integer");
   piglit_require_extension("GL_EXT_gpu_shader4");

   piglit_require_GLSL_version(130);

   PassthroughFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
                                                      PassthroughFragShaderText);
   assert(PassthroughFragShader);
   PassthroughProgram = piglit_link_simple_program(0, PassthroughFragShader);


   SimpleFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
                                                 SimpleFragShaderText);
   assert(SimpleFragShader);
   SimpleProgram = piglit_link_simple_program(0, SimpleFragShader);


   (void) check_error(__FILE__, __LINE__);

   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
void
piglit_init(int argc, char **argv)
{
	GLint vs, fs1, fs2;
	const char *vs_source =
		"void main()\n"
		"{\n"
		"	gl_Position = gl_Vertex;\n"
		"}\n";
	const char *fs1_source =
		"void main()\n"
		"{\n"
		"	gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
		"}\n";
	const char *fs2_source =
		"void main()\n"
		"{\n"
		"	gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);\n"
		"}\n";

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
	fs1 = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs1_source);
	fs2 = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs2_source);
	prog1 = piglit_link_simple_program(vs, fs1);
	prog2 = piglit_link_simple_program(vs, fs2);
}
Example #6
0
void piglit_init(int argc, char **argv)
{
	GLint vert[3];
	GLint prog_a;
	GLint prog_b;
	GLint prog_c;
	GLint prog_d;

	piglit_require_gl_version(20);

	vert[0] =
		piglit_compile_shader(GL_VERTEX_SHADER,
				      "shaders/glsl-link-initializer-01a.vert");
	vert[1] =
		piglit_compile_shader(GL_VERTEX_SHADER,
				      "shaders/glsl-link-initializer-01b.vert");
	vert[2] =
		piglit_compile_shader(GL_VERTEX_SHADER,
				      "shaders/glsl-link-initializer-01c.vert");
	prog_a = piglit_link_simple_program(vert[0], vert[1]);
	prog_b = piglit_link_simple_program(vert[1], vert[0]);
	prog_c = piglit_link_simple_program(vert[0], vert[2]);
	prog_d = piglit_link_simple_program(vert[2], vert[0]);

	/* piglit_link_simple_program() returns 0 on link failure.  So
	 * verify that there was no link failure by simply checking
	 * that two programs were returned.
	 */
	piglit_report_result((prog_a && prog_b && prog_c && prog_d)
			     ? PIGLIT_PASS : PIGLIT_FAIL);
}
Example #7
0
void
piglit_init(int argc, char **argv)
{
	int vs, fs, prog;
	int tex_location;

	piglit_require_GLSL_version(130);

	glActiveTexture(GL_TEXTURE0);
	piglit_rgbw_texture(GL_RGBA, tex_size, tex_size / 2, true, false,
			    GL_UNSIGNED_NORMALIZED);

	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);

	tex_location = piglit_GetUniformLocation(prog, "tex");
	lod_location = piglit_GetUniformLocation(prog, "lod");
	pos_location = piglit_GetUniformLocation(prog, "pos");

	piglit_UseProgram(prog);
	piglit_Uniform1i(tex_location, 0);
}
/**
 * Section 3.11.2 of the GL 2.1 spec says:
 *    If a fragment shader uses a sampler whose associated texture object is
 *    not complete, as defined in section 3.8.10, the texture image unit will
 *    return (R, G, B, A) = (0, 0, 0, 1).
 *
 * In this test we swizzle RGBA->ABGR so we don't need to worry if the
 * framebuffer has an alpha channel.
 */
GLboolean
test_glsl(void)
{
	static const char *fragShaderText =
		"uniform sampler2D tex;\n"
		"void main()\n"
		"{\n"
		"   gl_FragColor = texture2D(tex, gl_TexCoord[0].xy).abgr;\n"
		"}\n";
	static const GLfloat expected[4] = { 1.0, 0.0, 0.0, 0.0 };
	int pos = 2;
	GLboolean p;
	GLuint frag, prog;
	GLint tex;

	frag = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderText);
	prog = piglit_link_simple_program(0, frag);

	glUseProgram(prog);
	tex = glGetUniformLocation(prog, "tex");
	glUniform1i(tex, 0);

	glColor3f(0, 1, 0);
	draw_rect(2);

	glUseProgram(0);
	glDeleteShader(frag);
	glDeleteProgram(prog);

	p = probe_pos(pos, expected);
	if (!p)
		printf("  Testing GLSL\n");
	return p;
}
void
piglit_init(int argc, char **argv)
{
	int i;
	GLuint vs;

	/* Parse params */
	if (argc != 2)
		print_usage_and_exit(argv[0]);
	for (i = 0; i < ARRAY_SIZE(tests); i++) {
		if (strcmp(argv[1], tests[i].name) == 0) {
			test = &tests[i];
			break;
		}
	}
	if (test == NULL)
		print_usage_and_exit(argv[0]);

	piglit_require_GLSL_version(110);
	if (!piglit_is_extension_supported("GL_NV_primitive_restart") &&
	    piglit_get_gl_version() < 31) {
		printf("GL_NV_primitive_restart or GL 3.1 required\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
	prog = piglit_link_simple_program(vs, 0);
	if (!prog)
		piglit_report_result(PIGLIT_FAIL);
	glDeleteShader(vs);
	vertex_attr = glGetAttribLocation(prog, "vertex");
	window_size_loc = glGetUniformLocation(prog, "window_size");
	offset_loc = glGetUniformLocation(prog, "offset");
	color_loc = glGetUniformLocation(prog, "color");
}
Example #10
0
void
piglit_init(int argc, char **argv)
{
    GLint vs;
    GLint point_size_range[2];

    if (piglit_get_gl_version() < 20) {
        printf("Requires OpenGL 2.0\n");
        piglit_report_result(PIGLIT_SKIP);
    }
    /* If the driver doesn't claim to support the point size the
       shader is going to set then we should skip the test */
    glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_size_range);
    if (POINT_SIZE < point_size_range[0] ||
            POINT_SIZE > point_size_range[1]) {
        printf("Point size %i not supported\n", POINT_SIZE);
        piglit_report_result(PIGLIT_SKIP);
    }

    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
    glClearColor(0.0, 0.0, 0.0, 1.0);

    vs = piglit_compile_shader(GL_VERTEX_SHADER,
                               "shaders/glsl-vs-point-size.vert");

    prog = piglit_link_simple_program(vs, 0);

    glUseProgram(prog);

    glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
}
Example #11
0
void
piglit_init(int argc, char **argv)
{
    GLuint Texture;

    piglit_require_extension("GL_ARB_texture_float");
    piglit_require_extension("GL_ARB_fragment_shader");

    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);

    glUseProgram(Program);

    BiasUniform = glGetUniformLocation(Program, "bias");
    ScaleUniform = glGetUniformLocation(Program, "scale");
    TexUniform = glGetUniformLocation(Program, "tex");

    glUniform1f(BiasUniform, Bias);
    glUniform1f(ScaleUniform, Scale);
    glUniform1i(TexUniform, 0);  /* tex unit zero */

    (void) check_error(__FILE__, __LINE__);

    glGenTextures(1, &Texture);
    glBindTexture(GL_TEXTURE_2D, Texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Example #12
0
void
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);

   glUseProgram(Program);

   PosAttrib = glGetAttribLocation(Program, "Pos");
   ColorAttrib = glGetAttribLocation(Program, "Color");

   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glFrustum(-5, 5, -5, 5, 10, 20);

   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   glTranslatef(0, 0, -11.0);
   glScalef(0.5, 0.5, 1.0);
}
Example #13
0
void
piglit_init(int argc, char **argv)
{
    GLint vs, fs;

    if (piglit_get_gl_version() < 20) {
        printf("Requires OpenGL 2.0\n");
        piglit_report_result(PIGLIT_SKIP);
    }

    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

    vs = piglit_compile_shader(GL_VERTEX_SHADER,
                               "shaders/glsl-mvp.vert");
    fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
                               "shaders/glsl-fs-mix.frag");

    prog = piglit_link_simple_program(vs, fs);

    glUseProgram(prog);

    args1_location = glGetUniformLocation(prog, "args1");
    args2_location = glGetUniformLocation(prog, "args2");
    args3_location = glGetUniformLocation(prog, "args3");
}
void
draw(const float *color, float x_offset)
{
	GLuint vs, fs, 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);

	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");

	glUniform4fv(color_location, 1, color);
	glUniform4f(offset_location, x_offset, 0.0f, 0.0f, 0.0f);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
	glDeleteProgram(prog);
}
Example #15
0
void
piglit_init(int argc, char **argv)
{
	GLuint vs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	glClearColor(0.3, 0.3, 0.3, 0.0);
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);

	prog = piglit_link_simple_program(vs, 0);

	glDeleteShader(vs);

	/* Don't try to render if the program failed to link, and linking
	 * had better succeed!
	 */
	if (!piglit_link_check_status(prog))
		piglit_report_result(PIGLIT_FAIL);

	glUseProgram(prog);
}
Example #16
0
void
piglit_init(int argc, char **argv)
{
	GLuint vs, fs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader(GL_VERTEX_SHADER,
				   "shaders/glsl-color-mvp.vert");
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-color.frag");

	prog = piglit_link_simple_program(vs, fs);

	glDeleteShader(vs);
	glDeleteShader(fs);

	/* Don't try to render if the program failed to link, and linking
	 * had better succeed!
	 */
	if (!piglit_link_check_status(prog))
		piglit_report_result(PIGLIT_FAIL);

	glUseProgram(prog);
}
Example #17
0
void piglit_init(int argc, char **argv)
{
	GLuint fs, vs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	piglit_require_extension("GL_EXT_framebuffer_object");

	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) {
		piglit_report_result(PIGLIT_SKIP);
	}

	color_location = glGetUniformLocation(prog, "color");
	if (color_location == -1) {
		fprintf(stderr, "Failed to get uniform location");
		piglit_report_result(PIGLIT_FAIL);
	}
}
Example #18
0
void
piglit_init(int argc, char **argv)
{
	GLint vs, fs;

	/* Set up projection matrix so we can just draw using window
	 * coordinates.
	 */
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader(GL_VERTEX_SHADER,
				   "shaders/glsl-mvp.vert");
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-fs-loop-nested.frag");

	prog = piglit_link_simple_program(vs, fs);

	glUseProgram(prog);

	color_location = glGetUniformLocation(prog, "color");
}
Example #19
0
void
piglit_init(int argc, char **argv)
{
	GLboolean pass = GL_TRUE;
	GLint vs, fs, num;
	GLint expect;

	if (argc < 3) {
		printf("Usage: %s <vertex shader file> "
		       "<expected uniform count>\n", argv[0]);
		piglit_report_result(PIGLIT_FAIL);
	}

	expect = (int) strtol(argv[2], NULL, 0);

	piglit_require_GLSL();
	vs = piglit_compile_shader(GL_VERTEX_SHADER, argv[1]);
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-color.frag");

	prog = piglit_link_simple_program(vs, fs);

	glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &num);
	if (num != expect) {
		printf("Unexpected active uniform count "
		       "(saw %d, expected %d)\n", num, expect);
		pass = GL_FALSE;
	}

	if (pass)
		piglit_report_result(PIGLIT_PASS);
	else
		piglit_report_result(PIGLIT_FAIL);
}
Example #20
0
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);
	glUseProgram(prog);
}
void
piglit_init(int argc, char **argv)
{
	bool piglit_pass = true;
	GLuint vs, fs, prog;
	GLint loc;
	float vf[] = { 1.0, 2.0, 3.0 };
	double vd[] = { 1.0, 2.0, 3.0, 4.0, 5.0};

	piglit_require_extension("GL_ARB_gpu_shader_fp64");

	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);

	glUseProgram(prog);

	// Setting different type should fail
	loc = glGetUniformLocation(prog, "d");
	glUniform1i(loc, 3);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_INVALID_OPERATION);
	glUniform1f(loc, 3.0);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_INVALID_OPERATION);
	glUniform1d(loc, 3.0);
	piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);

	loc = glGetUniformLocation(prog, "v");
	glUniform3fv(loc, 1, vf);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_INVALID_OPERATION);
	glUniform3d(loc, vd[0], vd[1], vd[2]);
	piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);

	// Setting different size should fail
	loc = glGetUniformLocation(prog, "v");
	glUniform2d(loc, vd[0], vd[1]);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_INVALID_OPERATION);
	glUniform4d(loc, vd[0], vd[1], vd[2], vd[3]);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_INVALID_OPERATION);
	glUniform3d(loc, vd[0], vd[1], vd[2]);
	piglit_pass = piglit_pass && piglit_check_gl_error(GL_NO_ERROR);

	// Special case for booleans
	loc = glGetUniformLocation(prog, "b");
	glUniform1d(loc, 1.0);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_INVALID_OPERATION);
	glUniform1f(loc, 1.0);
	piglit_pass = piglit_pass
		&& piglit_check_gl_error(GL_NO_ERROR);

	piglit_report_result(piglit_pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Example #22
0
enum piglit_result
piglit_display(void)
{
	GLuint vs, fs;
	bool pass = true;
	GLuint prog;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	GLint status;

	/* Initial buffer clear. */
	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);

	if (!vs || !fs || !prog)
		piglit_report_result(PIGLIT_FAIL);

	piglit_DeleteShader(vs);
	piglit_DeleteShader(fs);
	piglit_UseProgram(prog);
	piglit_DeleteProgram(prog);

	/* Try to blow out the refcount */
	piglit_DeleteProgram(prog);
	piglit_DeleteProgram(prog);
	piglit_DeleteProgram(prog);

	/* Sanity check: deleting didn't already unbind our shader program. */
	piglit_draw_rect(-1, -1, 2, 2);
	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
				      green) && pass;

	/* The program should still report being deleted. */
	piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
	if (!piglit_check_gl_error(0))
		piglit_report_result(PIGLIT_FAIL);
	if (status != GL_TRUE) {
		fprintf(stderr,
			"GL_DELETE_STATUS after a clear reported non-true %d\n",
			status);
		pass = false;
	}

	/* Now, disable the program and it should be finally deleted. */
	piglit_UseProgram(0);

	piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
	pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
void piglit_init(int argc, char **argv)
{
	int i;

	piglit_require_extension("GL_EXT_framebuffer_object");
	piglit_require_extension("GL_EXT_texture_array");

	format = GL_RGBA8;

	for (i = 1; i < argc; i++) {
		if (strcmp(argv[i], "RGB9_E5") == 0) {
			/* Test a non-renderable format. */
			piglit_require_extension("GL_EXT_texture_shared_exponent");
			format = GL_RGB9_E5;
		}
		else if (strcmp(argv[i], "S3TC_DXT1") == 0) {
			/* Test a compressed format. */
			piglit_require_extension("GL_EXT_texture_compression_s3tc");
			format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
		}
		else {
			assert(0);
		}
	}

	/* Make shader programs */
	frag_shader_2d_array =
		piglit_compile_shader_text(GL_FRAGMENT_SHADER,
					   frag_shader_2d_array_text);
	check_error(__LINE__);

	program_2d_array = piglit_link_simple_program(0, frag_shader_2d_array);
	check_error(__LINE__);

	frag_shader_1d_array =
		piglit_compile_shader_text(GL_FRAGMENT_SHADER,
					   frag_shader_1d_array_text);
	check_error(__LINE__);

	program_1d_array = piglit_link_simple_program(0, frag_shader_1d_array);
	check_error(__LINE__);

}
void
piglit_init(int argc, char **argv)
{
	GLboolean pass = GL_TRUE;
	GLint vs, fs, len, ret_len;
	GLenum type;
	char *name;
	GLsizei size;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader(GL_VERTEX_SHADER,
				   "shaders/glsl-getactiveuniform-length.vert");
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-color.frag");

	prog = piglit_link_simple_program(vs, fs);

	/* From page 261 (page 275 of the PDF) of the OpenGL 2.1 specification:
	 *
	 *     If pname is ACTIVE UNIFORM MAX LENGTH, the length of
	 *     the longest active uniform name, including a null
	 *     terminator, is returned.
	 */

	glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
	if (len != strlen("color") + 1) {
		printf("Unexpected max active uniform length "
		       "(saw %d, expected %lu)\n", len, (unsigned long) strlen("color") + 1);
		pass = GL_FALSE;
	}

	/* From page 80 (page 88 of the PDF) of the OpenGL 2.1 specification:
	 *
	 *     The actual number of characters written into name,
	 *     excluding the null terminator, is returned in length.
	 */
	name = malloc(len);
	glGetActiveUniform(prog, 0, len + 20, &ret_len, &size, &type, name);
	if (ret_len != strlen("color")) {
		printf("Unexpected active uniform length "
		       "(saw %d, expected %lu) for \"%s\"\n",
		       ret_len, (unsigned long) strlen("color"), name);
		pass = GL_FALSE;
	}


	if (pass)
		piglit_report_result(PIGLIT_PASS);
	else
		piglit_report_result(PIGLIT_FAIL);
}
Example #25
0
static GLuint setup_shaders()
{
    GLuint vs, fs, prog;

    vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_code);
    fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_code);
    prog = piglit_link_simple_program(vs, fs);

    glUseProgram(prog);
    return prog;
}
Example #26
0
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);
	glUseProgram(prog);
	glVertexPointer(3, GL_FLOAT, 0, vertices);
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
Example #27
0
void piglit_init(int argc, char **argv)
{
	piglit_require_extension("GL_EXT_framebuffer_object");
	piglit_require_extension("GL_EXT_texture_array");

	/* Make shader programs */
	frag_shader_2d_array =
		piglit_compile_shader_text(GL_FRAGMENT_SHADER,
					   frag_shader_2d_array_text);
	check_error(__LINE__);

	frag_shader_depth_output =
		piglit_compile_shader_text(GL_FRAGMENT_SHADER,
					   frag_shader_depth_output_text);
	check_error(__LINE__);

	program_2d_array = piglit_link_simple_program(0, frag_shader_2d_array);
	check_error(__LINE__);

	program_depth_output = piglit_link_simple_program(0,
						  frag_shader_depth_output);
	check_error(__LINE__);
}
Example #28
0
void
piglit_init(int argc, char **argv)
{
	GLint vs, fs;

	piglit_require_gl_version(20);
	piglit_require_extension("GL_EXT_framebuffer_object");

	vs = piglit_compile_shader(GL_VERTEX_SHADER,
				   "shaders/glsl-mvp.vert");
	fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
				   "shaders/glsl-fs-fragcoord.frag");

	prog = piglit_link_simple_program(vs, fs);
}
Example #29
0
void
piglit_init(int argc, char **argv)
{
	GLint vs;

	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);

	prog = piglit_link_simple_program(vs, 0);

	glDeleteShader(vs);
}
Example #30
0
void
piglit_init(int argc, char **argv)
{
	GLuint vs, fs, 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);

	glUseProgram(prog);
}