JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL41_nglProgramUniform4d(JNIEnv *env, jclass clazz, jint program, jint location, jdouble v0, jdouble v1, jdouble v2, jdouble v3, jlong function_pointer) {
	glProgramUniform4dPROC glProgramUniform4d = (glProgramUniform4dPROC)((intptr_t)function_pointer);
	glProgramUniform4d(program, location, v0, v1, v2, v3);
}
Example #2
0
static bool
test_double(const char *version_string)
{
	GLint loc;
	bool pass = true;
	double values[4];
	double got[ARRAY_SIZE(values)];
	GLuint prog;
	static const char subtest_name[] = "double scalar and vectors";
	const char *const shader_strings[] = {
		version_string,
		double_code,
		common_body
	};

	BUILD_SHADER(version_string == NULL);

	/* Try double
	 */
	random_doubles(values, ARRAY_SIZE(values));
	loc = glGetUniformLocation(prog, "v1");
	glProgramUniform1d(prog, loc,
			   values[0]);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 1) && pass;

	random_doubles(values, ARRAY_SIZE(values));
	glProgramUniform1dv(prog, loc, 1, values);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 1) && pass;

	/* Try dvec2
	 */
	random_doubles(values, ARRAY_SIZE(values));
	loc = glGetUniformLocation(prog, "v2");
	glProgramUniform2d(prog, loc,
			   values[0], values[1]);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 2) && pass;

	random_doubles(values, ARRAY_SIZE(values));
	glProgramUniform2dv(prog, loc, 1, values);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 2) && pass;

	/* Try dvec3
	 */
	random_doubles(values, ARRAY_SIZE(values));
	loc = glGetUniformLocation(prog, "v3");
	glProgramUniform3d(prog, loc,
			   values[0], values[1], values[2]);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 3) && pass;

	random_doubles(values, ARRAY_SIZE(values));
	glProgramUniform3dv(prog, loc, 1, values);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 3) && pass;

	/* Try dvec4
	 */
	random_doubles(values, ARRAY_SIZE(values));
	loc = glGetUniformLocation(prog, "v4");
	glProgramUniform4d(prog, loc,
			   values[0], values[1], values[2], values[3]);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 4) && pass;

	random_doubles(values, ARRAY_SIZE(values));
	glProgramUniform4dv(prog, loc, 1, values);
	pass = piglit_check_gl_error(0) && pass;

	glGetUniformdv(prog, loc, got);
	pass = piglit_check_gl_error(0) && pass;

	pass = check_double_values(values, got, 4) && pass;

	piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
				     subtest_name);

	glDeleteProgram(prog);
	return pass;
}