Ejemplo n.º 1
0
void
piglit_init(int argc, char **argv)
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(-1.25, 1.25, -1.25, 1.25, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glShadeModel(GL_FLAT);
	glPixelStorei(GL_PACK_ALIGNMENT, 1);

	glFrontFace(GL_CW);
	glCullFace(GL_FRONT);
	glEnable(GL_CULL_FACE);

	if (piglit_is_extension_supported("GL_ARB_provoking_vertex")) {
		provoking_vertex_first = true;
	}
	else if (piglit_is_extension_supported("GL_EXT_provoking_vertex")) {
		provoking_vertex_first = true;
	}

	if (provoking_vertex_first) {
		GLboolean k;
		glGetBooleanv(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT, &k);
		quads_follows_pv_convention = k;
	}
}
Ejemplo n.º 2
0
void
piglit_init(int argc, char **argv)
{
	GLint max_samples;
	GLuint rb;

	piglit_require_extension("GL_EXT_framebuffer_multisample");

	if (piglit_is_extension_supported("GL_ARB_internalformat_query")) {
		printf("ARB_internalformat_query is supported and "
		       "redefines this behavior; skipping\n");
		piglit_report_result(PIGLIT_SKIP);
	}
	if (piglit_is_extension_supported("GL_ARB_texture_multisample")) {
		printf("ARB_texture_multisample is supposed and "
		       "redefines this behavior; skipping\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	glGetIntegerv(GL_MAX_SAMPLES, &max_samples);

	glGenRenderbuffersEXT(1, &rb);
	glBindRenderbufferEXT(GL_RENDERBUFFER, rb);

	glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER,
					    max_samples + 1,
					    GL_RGBA,
					    1, 1);
	if (!piglit_check_gl_error(GL_INVALID_VALUE))
		piglit_report_result(PIGLIT_FAIL);

	glDeleteRenderbuffersEXT(1, &rb);

	piglit_report_result(PIGLIT_PASS);
}
Ejemplo n.º 3
0
bool
atomic_counters_supported(GLenum shader_stage)
{
        int n = 0;

        switch (shader_stage) {
        case GL_NONE:
        case GL_FRAGMENT_SHADER:
                return true;

        case GL_VERTEX_SHADER:
                glGetIntegerv(GL_MAX_VERTEX_ATOMIC_COUNTERS, &n);
                return n;

        case GL_GEOMETRY_SHADER:
                if (piglit_get_gl_version() >= 32)
                        glGetIntegerv(GL_MAX_GEOMETRY_ATOMIC_COUNTERS, &n);
                return n;

        case GL_TESS_CONTROL_SHADER:
                if (piglit_is_extension_supported("GL_ARB_tessellation_shader"))
                        glGetIntegerv(GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS, &n);
                return n;

        case GL_TESS_EVALUATION_SHADER:
                if (piglit_is_extension_supported("GL_ARB_tessellation_shader"))
                        glGetIntegerv(GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS,
                                      &n);
                return n;

        default:
                assert(!"Unreachable");
                abort();
        }
}
Ejemplo n.º 4
0
Archivo: common.c Proyecto: RAOF/piglit
/**
 * Ensures the driver supports the required extensions, GL, and GLSL versions.
 * If it doesn't, report PIGLIT_SKIP and exit the test.
 */
void
require_GL_features(enum shader_target test_stage)
{
	int tex_units;

	piglit_require_GLSL_version(shader_version);

	if (swizzling)
		piglit_require_extension("GL_EXT_texture_swizzle");

	switch (sampler.internal_format) {
	case GL_RGBA32I:
	case GL_RGBA16I:
		piglit_require_extension("GL_EXT_texture_integer");
		break;
	case GL_RGBA32UI:
	case GL_RGBA16UI:
		if (piglit_is_extension_supported("GL_EXT_gpu_shader4"))
			piglit_require_gl_version(21);
		else
			piglit_require_gl_version(30);
		break;
	case GL_RGBA32F:
	case GL_RGBA16F:
		piglit_require_extension("GL_ARB_texture_float");
		break;
	}

	switch (sampler.target) {
	case GL_TEXTURE_CUBE_MAP_ARRAY:
		piglit_require_extension("GL_ARB_texture_cube_map_array");
		break;
	case GL_TEXTURE_1D_ARRAY:
	case GL_TEXTURE_2D_ARRAY:
		piglit_require_extension("GL_EXT_texture_array");
		break;
	case GL_TEXTURE_CUBE_MAP:
		if (is_shadow_sampler()) {
			if (piglit_is_extension_supported("GL_EXT_gpu_shader4"))
				piglit_require_gl_version(21);
			else
				piglit_require_gl_version(30);
		}
		break;
	case GL_TEXTURE_RECTANGLE:
		piglit_require_extension("GL_ARB_texture_rectangle");
		break;
	case GL_TEXTURE_BUFFER:
		piglit_require_extension("GL_ARB_texture_buffer_object");
		break;
	case GL_TEXTURE_2D_MULTISAMPLE:
	case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
		piglit_require_extension("GL_ARB_texture_multisample");
	}

	/* If testing in the VS, check for VS texture units */
	glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &tex_units);
	if (test_stage == VS && tex_units <= 0)
		piglit_report_result(PIGLIT_SKIP);
}
Ejemplo n.º 5
0
/* Test subroutine uniform location query with compute. */
static bool
test_subroutine_stages_compute()
{
	GLuint prog, i;

	if (!piglit_is_extension_supported("GL_ARB_shader_subroutine")) {
		piglit_report_subtest_result(PIGLIT_SKIP, __func__);
		return true;
	}

	if (!piglit_is_extension_supported("GL_ARB_compute_shader")) {
		piglit_report_subtest_result(PIGLIT_SKIP, __func__);
		return true;
	}

        prog = piglit_build_simple_program_multiple_shaders(
                     GL_COMPUTE_SHADER, compute_subroutine_text,
                     0);

	glUseProgram(prog);

	/* Iterate through all valid subroutine enums passing invalid name. */
	for (i = 0; i < (sizeof(valid_enums_sub_com)/sizeof(GLenum)); i++) {
		glGetProgramResourceLocation(prog, valid_enums_sub_com[i],
                                             "name");
			if (!piglit_check_gl_error(GL_NO_ERROR))
				piglit_report_result(PIGLIT_FAIL);
	}

	CHECK_SUB(COMPUTE);

	piglit_report_subtest_result(PIGLIT_PASS, __func__);
	return true;
}
Ejemplo n.º 6
0
PIGLIT_GL_TEST_CONFIG_END

void
piglit_init(int argc, char **argv)
{
	bool pass;

        /* We can create depth/stencil textures if either:
         * 1. We have GL 3.0 or later
         * 2. We have GL_EXT_packed_depth_stencil and GL_ARB_depth_texture
         */
	if (piglit_get_gl_version() < 30
	    && !(piglit_is_extension_supported("GL_EXT_packed_depth_stencil") &&
		 piglit_is_extension_supported("GL_ARB_depth_texture"))) {
		printf("OpenGL 3.0 or GL_EXT_packed_depth_stencil + "
		       "GL_ARB_depth_texture is required.\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	pass = test_format(GL_DEPTH24_STENCIL8_EXT,
			   GL_DEPTH_STENCIL_EXT,
			   GL_UNSIGNED_INT_24_8_EXT,
			   4);

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Ejemplo n.º 7
0
void
piglit_init(int argc, char **argv)
{
	if (!piglit_is_extension_supported("GL_ARB_shader_objects") || !piglit_is_extension_supported("GL_ARB_vertex_shader") || !piglit_is_extension_supported("GL_ARB_fragment_shader")) {
		printf("Requires ARB_shader_objects and ARB_{vertex,fragment}_shader\n");
		piglit_report_result(PIGLIT_SKIP);
	}
}
Ejemplo n.º 8
0
void
piglit_init(int argc, char**argv)
{
	piglit_require_extension("GL_EXT_framebuffer_object");

	have_extension[0] = GL_TRUE;
	have_extension[EXT_packed_depth_stencil] = piglit_is_extension_supported("GL_EXT_packed_depth_stencil");
	have_extension[ARB_framebuffer_object] = piglit_is_extension_supported("GL_ARB_framebuffer_object");
	have_extension[ARB_texture_rg] = piglit_is_extension_supported("GL_ARB_texture_rg");

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Ejemplo n.º 9
0
void
piglit_require_fragment_shader(void)
{
	if (piglit_get_gl_version() >= 20) {
		init_functions_from_core();
	} else if (piglit_is_extension_supported("GL_ARB_shader_objects") && piglit_is_extension_supported("GL_ARB_fragment_shader")) {
		init_functions_from_extension();
	} else {
		printf("GLSL vertex shaders are not supported.\n");
		piglit_report_result(PIGLIT_SKIP);
		exit(1);
	}
}
Ejemplo n.º 10
0
void
piglit_require_GLSL(void)
{
	if (piglit_get_gl_version() >= 20) {
		init_functions_from_core();
	} else if (piglit_is_extension_supported("GL_ARB_shader_objects") && piglit_is_extension_supported("GL_ARB_shading_language_100")) {
		init_functions_from_extension();
	} else {
		printf("GLSL not supported.\n");
		piglit_report_result(PIGLIT_SKIP);
		exit(1);
	}
}
Ejemplo n.º 11
0
void
piglit_init(int argc, char **argv)
{
	if (!piglit_is_extension_supported("GL_ARB_imaging") && !piglit_is_extension_supported("GL_EXT_blend_minmax")) {
		printf("Sorry, this program requires either GL_ARB_imaging or "
		       "GL_EXT_blend_minmax.\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	piglit_require_gl_version(14);

	printf("\nAll 4 quads should be the same color.\n");
	glEnable(GL_BLEND);
}
Ejemplo n.º 12
0
static bool
supported_target(unsigned i)
{
	/* Array targets are only supported if GLSL is available.
	 */
	if ((target[i].target == GL_TEXTURE_1D_ARRAY
	     || target[i].target == GL_TEXTURE_2D_ARRAY)
	    && (piglit_get_gl_version() < 20
		&& !piglit_is_extension_supported("GL_ARB_fragment_shader")))
		return false;

	return piglit_get_gl_version() >= target[i].gl_version ||
		(target[i].extension &&
		 piglit_is_extension_supported(target[i].extension));
}
Ejemplo n.º 13
0
static bool
check_extensions(GLuint prog, GLenum programInterface)
{
	/* First check the availability of the extensions */
	if ((programInterface == GL_BUFFER_VARIABLE ||
	    programInterface == GL_SHADER_STORAGE_BLOCK ||
	    prog == prog_stor) &&
	    !piglit_is_extension_supported("GL_ARB_shader_storage_buffer_object")) {
		return false;
	}

	if ((programInterface == GL_VERTEX_SUBROUTINE ||
	     programInterface == GL_GEOMETRY_SUBROUTINE ||
	     programInterface == GL_FRAGMENT_SUBROUTINE ||
	     programInterface == GL_COMPUTE_SUBROUTINE ||
	     programInterface == GL_VERTEX_SUBROUTINE_UNIFORM ||
	     programInterface == GL_GEOMETRY_SUBROUTINE_UNIFORM ||
	     programInterface == GL_FRAGMENT_SUBROUTINE_UNIFORM ||
	     programInterface == GL_COMPUTE_SUBROUTINE_UNIFORM ||
	     programInterface == GL_TESS_CONTROL_SUBROUTINE ||
	     programInterface == GL_TESS_EVALUATION_SUBROUTINE ||
	     programInterface == GL_TESS_CONTROL_SUBROUTINE_UNIFORM ||
	     programInterface == GL_TESS_EVALUATION_SUBROUTINE_UNIFORM ||
	     programInterface == GL_COMPUTE_SUBROUTINE_UNIFORM ||
	     prog == prog_sub || prog == prog_sub_tess) &&
	     !piglit_is_extension_supported("GL_ARB_shader_subroutine")) {
		 return false;
	}

	if ((programInterface == GL_TESS_CONTROL_SUBROUTINE ||
	     programInterface == GL_TESS_EVALUATION_SUBROUTINE ||
	     programInterface == GL_TESS_CONTROL_SUBROUTINE_UNIFORM ||
	     programInterface == GL_TESS_EVALUATION_SUBROUTINE_UNIFORM ||
	     prog == prog_sub_tess) &&
	     !piglit_is_extension_supported("GL_ARB_tessellation_shader")) {
		 return false;
	}

	if ((programInterface == GL_COMPUTE_SUBROUTINE ||
	     programInterface == GL_COMPUTE_SUBROUTINE_UNIFORM ||
	     prog == prog_cs) &&
	     !piglit_is_extension_supported("GL_ARB_compute_shader") &&
	     !piglit_is_extension_supported("GL_ARB_shader_image_load_store")) {
		 return false;
	}

	return true;
}
Ejemplo n.º 14
0
GLboolean test(void)
{
	GLboolean all_pass = GL_TRUE;
	int npass = 0, total = 0;
	unsigned semantic, blend, logicop, vpmode, fpmode;
	unsigned vpmodes = 1 + !!piglit_is_extension_supported("GL_ARB_vertex_program");
	unsigned fpmodes = 1 + !!piglit_is_extension_supported("GL_ARB_fragment_program");
	unsigned vert_clamp, frag_clamp;

	glFogi(GL_FOG_MODE, GL_LINEAR);

	for (vert_clamp = 0; vert_clamp < (sanity ? 1 : 3); ++vert_clamp)
	for (frag_clamp = sanity ? 1 : 0; frag_clamp < (sanity ? 2 : 3); ++frag_clamp)
	for (semantic = 0; semantic < 2; ++semantic)
	for (blend = 0; blend < 4; ++blend)
	for (logicop = 0; logicop < 2; ++logicop)
	for (vpmode = 0; vpmode < vpmodes; ++vpmode)
	for (fpmode = 0; fpmode < fpmodes; ++fpmode)
	{
		GLboolean pass;

		if (!fpmode && semantic)
			continue;

		pass = test_one(vert_clamp, frag_clamp, semantic,
				blend, logicop, vpmode, fpmode);

		if (pass) {
			npass++;
		}
		else {
#if 0
			/* Enable this code to re-run the failed test.
			 * It's easy to set a breakpoint here to start debugging.
			 */
			pass = test_one(vert_clamp, frag_clamp, semantic,
					blend, logicop, vpmode, fpmode);
#endif
		}

		total++;

		all_pass = all_pass && pass;
	}

	printf("Summary: %i/%i passed.\n", npass, total);
	return all_pass;
}
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");
}
Ejemplo n.º 16
0
void
piglit_init(int argc, char **argv)
{
   Have_NV = piglit_is_extension_supported("GL_NV_primitive_restart");
   Have_31 = piglit_get_gl_version() >= 31;

   if (argc >= 2) {
      VBO_CFG vbo_cfg;
      for (vbo_cfg = 0; vbo_cfg < ARRAY_SIZE(vbo_cfg_names); vbo_cfg++) {
         if (strcmp(argv[1], vbo_cfg_names[vbo_cfg]) == 0) {
            vbo_init_cfg = vbo_cfg;
            break;
         }
      }
   }

   /* Debug */
   if (0) {
      printf("Have NV: %d\n", Have_NV);
      printf("Have 31: %d\n", Have_31);
   }

   if (!Have_NV && !Have_31) {
      piglit_report_result(PIGLIT_SKIP);
      exit(1);
   }

   glClearColor(0, 0, 0, 0);
}
Ejemplo n.º 17
0
void
piglit_init(int argc, char **argv)
{
   Have_NV = piglit_is_extension_supported("GL_NV_primitive_restart");
   Have_31 = piglit_get_gl_version() >= 31;

   if (argc >= 2) {
      VBO_CFG vbo_cfg;
      for (vbo_cfg = 0; vbo_cfg < ARRAY_SIZE(vbo_cfg_names); vbo_cfg++) {
         if (strcmp(argv[1], vbo_cfg_names[vbo_cfg]) == 0) {
            vbo_init_cfg = vbo_cfg;
            break;
         }
      }
   }

   /* Debug */
   /* NOTE!  glew 1.5.2's OpenGL 3.1 detection is broken.  You'll need
    * to upgrade to a newer version if you want to test the GL 3.1
    * primitive restart feature!
    */
   if (0) {
      printf("Have NV: %d\n", Have_NV);
      printf("Have 31: %d\n", Have_31);
   }

   if (!Have_NV && !Have_31) {
      piglit_report_result(PIGLIT_SKIP);
      exit(1);
   }

   glClearColor(0, 0, 0, 0);
}
Ejemplo n.º 18
0
void piglit_init(int argc, char **argv)
{
	bool pass = true;

	ObjectPtrLabel = GET_FUNC(glObjectPtrLabel);
	GetObjectPtrLabel = GET_FUNC(glGetObjectPtrLabel);
	ObjectLabel = GET_FUNC(glObjectLabel);
	GetObjectLabel = GET_FUNC(glGetObjectLabel);

#ifdef PIGLIT_USE_OPENGL
	piglit_require_gl_version(15);
#endif
	piglit_require_extension("GL_KHR_debug");

	pass = test_object_label_types() && pass;
	pass = test_object_label() && pass;
	pass = test_get_object_label() && pass;

	/* Test only if is GLES 3.0 or GL 3.2 or has ARB_sync */
	if ((piglit_is_gles() && piglit_get_gl_version() >= 30) ||
	    piglit_get_gl_version() >= 32 ||
	    piglit_is_extension_supported("GL_ARB_sync"))
		pass = test_object_ptr_label() && pass;

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Ejemplo n.º 19
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);
}
Ejemplo n.º 20
0
/* Test subroutine uniform location query with vs, fs and gs. */
static bool
test_subroutine_stages_vs_fs_gs()
{
	GLuint prog, i;

	if (!piglit_is_extension_supported("GL_ARB_shader_subroutine")) {
		piglit_report_subtest_result(PIGLIT_SKIP, __func__);
		return true;
	}

        prog = piglit_build_simple_program_multiple_shaders(
                     GL_VERTEX_SHADER, vs_subroutine_text,
                     GL_GEOMETRY_SHADER, gs_subroutine_text,
                     GL_FRAGMENT_SHADER, fs_subroutine_text,
                     0);

	glUseProgram(prog);

	/* Iterate through all valid subroutine enums passing invalid name. */
	for (i = 0; i < (sizeof(valid_enums_sub)/sizeof(GLenum)); i++) {
		glGetProgramResourceLocation(prog, valid_enums_sub[i], "name");
			if (!piglit_check_gl_error(GL_NO_ERROR))
				piglit_report_result(PIGLIT_FAIL);
	}

	CHECK_SUB(VERTEX);
	CHECK_SUB(FRAGMENT);
	CHECK_SUB(GEOMETRY);

	piglit_report_subtest_result(PIGLIT_PASS, __func__);
	return true;
}
void
piglit_init(int argc, char **argv)
{
#ifdef GL_ARB_ES2_compatibility
	static const float verts[] = {
		-1.0,  1.0, 0.0, 1.0,
		-1.0, -1.0, 0.0, 1.0,
		+0.0,  1.0, 0.0, 1.0,
		+0.0, -1.0, 0.0, 1.0,
	};

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

	if (!piglit_is_extension_supported("GL_ARB_ES2_compatibility")) {
		printf("Requires ARB_ES2_compatibility\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4,
			      verts);
	glEnableVertexAttribArray(0);
#endif
}
Ejemplo n.º 22
0
void
piglit_init(int argc, char **argv)
{
	GLint maxColorTextureSamples;

	/* glClearTexture is either in the GL_ARB_clear_texture
	 * extension or in core in GL 4.4
	 */
	if (piglit_get_gl_version() < 44 &&
	    !piglit_is_extension_supported("GL_ARB_clear_texture")) {
		printf("OpenGL 4.4 or GL_ARB_clear_texture is required.\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	piglit_require_extension("GL_ARB_texture_multisample");
	piglit_require_GLSL_version(130);

	/* We need to support multisample textures with at least 4
	 * samples */
	glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &maxColorTextureSamples);
	if (maxColorTextureSamples < TEX_SAMPLES) {
		printf("At least %i texture samples are required\n",
		       TEX_SAMPLES);
		piglit_report_result(PIGLIT_SKIP);
	}

	init_program();
}
Ejemplo n.º 23
0
void
piglit_init(int argc, char **argv)
{
	bool pass = true;

#ifdef PIGLIT_USE_OPENGL
	piglit_require_extension("GL_ARB_texture_storage");
	piglit_require_extension("GL_ARB_texture_view");
	piglit_require_extension("GL_ARB_texture_cube_map_array");
	piglit_require_extension("GL_EXT_texture_array");
	piglit_require_extension("GL_ARB_texture_rectangle");

	if (piglit_get_gl_version() < 31)
	    piglit_require_extension("GL_ARB_texture_cube_map");
#else
	piglit_require_extension("GL_OES_texture_view");
	piglit_require_extension("GL_OES_texture_cube_map_array");
#endif

#ifdef PIGLIT_USE_OPENGL
	X(test_target_errors(GL_TEXTURE_1D), "1D tex target validity");
#endif
	X(test_target_errors(GL_TEXTURE_2D), "2D tex target validity");
	X(test_target_errors(GL_TEXTURE_3D), "3D tex target validity");
	X(test_target_errors(GL_TEXTURE_CUBE_MAP),
		"Cubemap tex target validity");
#ifdef PIGLIT_USE_OPENGL
	X(test_target_errors(GL_TEXTURE_RECTANGLE),
		"Rectangle tex target validity");
	X(test_target_errors(GL_TEXTURE_1D_ARRAY),
		"1D Array tex target validity");
#endif
	X(test_target_errors(GL_TEXTURE_2D_ARRAY),
		"2D Array tex target validity");
	X(test_target_errors(GL_TEXTURE_CUBE_MAP_ARRAY),
		"Cubemap Array tex target validity");
	if (piglit_is_extension_supported("GL_ARB_texture_storage_multisample") ||
	    piglit_is_extension_supported("GL_OES_texture_storage_multisample_2d_array")) {
		X(test_target_errors(GL_TEXTURE_2D_MULTISAMPLE),
		  "Multisample 2D tex target validity");
		X(test_target_errors(GL_TEXTURE_2D_MULTISAMPLE_ARRAY),
		  "Multisample 2D array tex target validity");
	}
#undef X
    pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Ejemplo n.º 24
0
static bool
test_non_power_of_two(void)
{
	bool pass = true;

	if (piglit_is_extension_supported("GL_ARB_texture_non_power_of_two")) {
		GLuint tex;
		GLubyte buf[800];
		int width = 11, height = 14;
		int format = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;

		memset(buf, 0, sizeof(buf));

		/* Setup initial texture */
		glGenTextures(1, &tex);
		glBindTexture(GL_TEXTURE_2D, tex);
		glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0,
			     GL_RGBA, GL_UNSIGNED_BYTE, buf);

		pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

		/* Try TexSubImage of partial block on right edge */
		glTexSubImage2D(GL_TEXTURE_2D, 0,
				width-3, 0,  /* position */
				3, 4,        /* size */
				GL_RGBA, GL_UNSIGNED_BYTE, buf);

		pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

		/* Try TexSubImage of partial block on top edge */
		glTexSubImage2D(GL_TEXTURE_2D, 0,
				0, height-2,  /* position */
				4, 2,         /* size */
				GL_RGBA, GL_UNSIGNED_BYTE, buf);

		pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

		/* Try TexSubImage of larger partial block on right edge */
		glTexSubImage2D(GL_TEXTURE_2D, 0,
				width-3-4, 0,  /* position */
				3+4, 4,        /* size */
				GL_RGBA, GL_UNSIGNED_BYTE, buf);

		pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

		/* Try TexSubImage of larger partial block on top edge */
		glTexSubImage2D(GL_TEXTURE_2D, 0,
				0, height-2-4,  /* position */
				4, 2+4,         /* size */
				GL_RGBA, GL_UNSIGNED_BYTE, buf);

		pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

		glDeleteTextures(1, &tex);

	}

	return pass;
}
Ejemplo n.º 25
0
/** is the given texture internal format supported? */
static bool
supported_format(GLenum format)
{
	switch (format) {
	case GL_RGBA16F:
	case GL_RGBA32F:
	case GL_RGB16F:
	case GL_RGB32F:
		return piglit_is_extension_supported("GL_ARB_texture_float");
	case GL_RG:
		return piglit_is_extension_supported("GL_ARB_texture_rg");
	case GL_DEPTH_COMPONENT32F:
		return piglit_is_extension_supported("GL_ARB_depth_buffer_float");
	default:
		return true;
	}
}
Ejemplo n.º 26
0
/**
 * Handle the special case when a test requests GL 3.1.
 */
static bool
special_case_gl_31(const struct piglit_gl_test_config *test_config,
                   enum context_flavor flavor,
		   const char *context_description)
{
	int gl_version;

	if (flavor == CONTEXT_GL_CORE
	    && test_config->supports_gl_core_version == 31) {

		gl_version = piglit_get_gl_version();
		assert(gl_version >= 31);

		if (gl_version == 31
		    && piglit_is_extension_supported("GL_ARB_compatibility")) {
			printf("piglit: info: Requested a %s, but the actual "
			       "context is a 3.1 context that exposes the "
			       "GL_ARB_compatibility extension\n",
			       context_description);
			return false;
		} else {
			return true;
		}

	} else if (flavor == CONTEXT_GL_COMPAT
	           && test_config->supports_gl_compat_version == 31) {

		gl_version = piglit_get_gl_version();
		assert(gl_version >= 31);

		if (gl_version == 31
		    && !piglit_is_extension_supported("GL_ARB_compatibility")) {
			printf("piglit: info: Requested a %s, but the actual "
			       "context is a 3.1 context that lacks the "
			       "GL_ARB_compatibility extension\n",
			       context_description);
			return false;
		} else {
			return true;
		}
	} else {
		/* No need to check the special case. */
		return true;
	}
}
Ejemplo n.º 27
0
void
piglit_init(int argc, char **argv)
{
	bool pass = true;

	piglit_require_extension("GL_ARB_get_texture_sub_image");
	piglit_require_extension("GL_ARB_compressed_texture_pixel_storage");
	piglit_require_extension("GL_EXT_texture_compression_s3tc");
	piglit_require_extension("GL_ARB_texture_non_power_of_two");

	pass = test_getsubimage(GL_TEXTURE_2D, 256, 128, 1,
				GL_COMPRESSED_RGB_S3TC_DXT1_EXT) && pass;

	pass = test_getsubimage(GL_TEXTURE_2D, 80, 40, 1,
				GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) && pass;

	pass = test_getsubimage(GL_TEXTURE_2D, 32, 32, 1,
				GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) && pass;

	pass = test_getsubimage(GL_TEXTURE_2D, 32, 32, 1,
				GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) && pass;

	/* NOTE: texture rectangle not supported with S3TC */

	pass = test_getsubimage(GL_TEXTURE_CUBE_MAP, 16, 16, 6,
				GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) && pass;

	if (piglit_is_extension_supported("GL_EXT_texture_array")) {
		pass = test_getsubimage(GL_TEXTURE_2D_ARRAY, 16, 32, 10,
					GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
			&& pass;

		pass = test_getsubimage(GL_TEXTURE_2D_ARRAY, 32, 16, 1,
					GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
			&& pass;
	}

	if (piglit_is_extension_supported("GL_ARB_texture_cube_map_array")) {
		pass = test_getsubimage(GL_TEXTURE_CUBE_MAP_ARRAY, 16, 16, 18,
					GL_COMPRESSED_RGBA_S3TC_DXT3_EXT)
			&& pass;
	}

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Ejemplo n.º 28
0
void
piglit_init(int argc, char **argv)
{
	int vuniforms = 0, vblocks = 0;
	int guniforms = 0, gblocks = 0;
	int funiforms = 0, fblocks = 0;
	int blocksize = 0;
	bool gs = piglit_is_extension_supported("GL_ARB_geometry_shader4");

	piglit_require_extension("GL_ARB_uniform_buffer_object");

	piglit_print_minmax_header();

	piglit_test_min_int(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 1024);

	piglit_test_min_int(GL_MAX_VERTEX_UNIFORM_BLOCKS, 12);
	piglit_test_min_int(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, 12);
	if (gs)
		piglit_test_min_int(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, 12);

	piglit_test_min_int(GL_MAX_COMBINED_UNIFORM_BLOCKS, gs ? 36 : 24);
	piglit_test_min_int(GL_MAX_UNIFORM_BUFFER_BINDINGS, gs ? 36 : 24);
	piglit_test_min_int(GL_MAX_UNIFORM_BLOCK_SIZE, 16384);

	/* Minimum value for OpenGL 3.1 is
	 * (MAX_<stage>_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE) +
	 * MAX_<stage>_UNIFORM_COMPONENTS. Minimum value prior to
	 * OpenGL 3.1 is MAX_<stage>_UNIFORM_COMPONENTS.
	 */
	if (piglit_get_gl_version() >= 31) {
		glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &vblocks);
		glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &fblocks);
	}
	glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &vuniforms);
	glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &funiforms);
	glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &blocksize);
	piglit_test_min_int(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS,
			 vblocks * blocksize + vuniforms);
	piglit_test_min_int(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
			 fblocks * blocksize + funiforms);
	if (gs) {
		if (piglit_get_gl_version() >= 31) {
			glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, &gblocks);
		}
		glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, &guniforms);

		piglit_test_min_int(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS,
				    gblocks * blocksize + guniforms);
	}

	piglit_test_min_int(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, 1);

	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Ejemplo n.º 29
0
void
piglit_init(int argc, char **argv)
{
	if ((piglit_get_gl_version() < 14) &&
	    !piglit_is_extension_supported("GL_ARB_window_pos")) {
		printf("Requires GL 1.4 or GL_ARB_window_pos");
		piglit_report_result(PIGLIT_SKIP);
	}
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Ejemplo n.º 30
0
unsigned
init(void)
{
	if (piglit_is_extension_supported("GL_ARB_vertex_program"))
	{
		unsigned i;
		for (i = 0; i < 2; ++i)
			vps[i] = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, vp_strings[i]);
	}

	if (piglit_is_extension_supported("GL_ARB_fragment_program"))
	{
		unsigned i;
		for (i = 0; i < 4; ++i)
			fps[i] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, fp_strings[i]);
	}

	return TEST_SRT;
}