本文整理汇总了C++中piglit_require_gl_version函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_require_gl_version函数的具体用法?C++ piglit_require_gl_version怎么用?C++ piglit_require_gl_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_require_gl_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: require_GL_features
/**
* 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);
}
示例2: piglit_init
void piglit_init(int argc, char **argv)
{
int a,i;
piglit_require_gl_version(20);
piglit_require_extension("GL_ARB_explicit_attrib_location");
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
snorm_equation_23 = piglit_get_gl_version() >= 42;
glClearColor(0.2, 0.2, 0.2, 1.0);
for (a = 1; a < argc; a++) {
for (i = 0; i < ARRAY_SIZE(test_sets); i++) {
if (strcmp(argv[a], test_sets[i].name) == 0) {
if (test_sets[i].gl_version)
piglit_require_gl_version(test_sets[i].gl_version);
if (test_sets[i].extension)
piglit_require_extension(test_sets[i].extension);
test_set = &test_sets[i];
return;
}
}
}
}
示例3: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_gl_version(20);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
示例4: piglit_init
void
piglit_init(int argc, char **argv)
{
int num_samples;
if (argc < 2)
print_usage_and_exit(argv[0]);
{
char *endptr = NULL;
num_samples = strtol(argv[1], &endptr, 0);
if (endptr != argv[1] + strlen(argv[1]))
print_usage_and_exit(argv[0]);
}
piglit_require_gl_version(30);
glClear(GL_COLOR_BUFFER_BIT);
/* Skip the test if num_samples > GL_MAX_SAMPLES */
GLint max_samples;
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
buffer_to_test = GL_COLOR_BUFFER_BIT;
test_pattern = new Lines();
test_pattern->compile();
test_fbo.setup(FboConfig(num_samples, pattern_width, pattern_height));
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
}
示例5: piglit_init
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);
}
示例6: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint max_attachments;
printf("The result should be increasing lengths of rows of green\n"
"boxes as the test increases the number of drawbuffers \n"
"targets used.\n");
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
piglit_require_gl_version(20);
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_draw_buffers");
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_targets);
if (max_targets < 2)
piglit_report_result(PIGLIT_SKIP);
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_attachments);
if (max_targets > max_attachments)
max_targets = max_attachments;
if (max_targets > 16)
max_targets = 16;
}
示例7: piglit_init
void
piglit_init(int argc, char **argv)
{
GLubyte pixels[TEX_SIZE][TEX_SIZE][4];
GLuint tex;
int i, j;
piglit_require_gl_version(13);
/* solid red texture */
for (i = 0; i < TEX_SIZE; i++) {
for (j = 0; j < TEX_SIZE; j++) {
pixels[i][j][0] = 255;
pixels[i][j][1] = 0;
pixels[i][j][2] = 0;
pixels[i][j][3] = 255;
}
}
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_3D, tex);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
glTexParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, green);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, TEX_SIZE, TEX_SIZE, 1,
0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glEnable(GL_TEXTURE_3D);
}
示例8: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint id;
piglit_require_gl_version(15);
piglit_require_GLSL();
piglit_require_extension("GL_EXT_transform_feedback");
piglit_require_extension("GL_ARB_transform_feedback2");
glGenTransformFeedbacks(1, &id);
if (glIsTransformFeedback(id)) {
fprintf(stderr, "id recognized incorrectly as a transform feedback object.\n");
piglit_report_result(PIGLIT_FAIL);
}
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
if (!glIsTransformFeedback(id)) {
fprintf(stderr, "id not recognized correctly as a transform feedback object.\n");
piglit_report_result(PIGLIT_FAIL);
}
piglit_report_result(PIGLIT_PASS);
}
示例9: piglit_init
void
piglit_init(int argc, char **argv)
{
GLboolean pass = GL_TRUE;
GLint count;
GLuint prog;
GLenum err;
piglit_require_gl_version(20);
piglit_require_extension("GL_EXT_separate_shader_objects");
prog = glCreateShaderProgramEXT(GL_VERTEX_SHADER, vs_text);
err = glGetError();
if (err != 0) {
printf("Unexpected OpenGL error state 0x%04x for "
"glCreateShaderProgramEXT\n", err);
pass = GL_FALSE;
}
count = -1;
glGetProgramiv(prog, GL_ATTACHED_SHADERS, &count);
if (count != 0) {
printf("Expected attached shader count of 0, got %d.\n", count);
pass = GL_FALSE;
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
示例10: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs, fs;
piglit_require_gl_version(20);
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);
}
示例11: piglit_init
void
piglit_init(int argc, char **argv)
{
if (argc < 2)
print_usage_and_exit(argv[0]);
{
char *endptr = NULL;
num_samples = strtol(argv[1], &endptr, 0);
if (endptr != argv[1] + strlen(argv[1]))
print_usage_and_exit(argv[0]);
}
piglit_require_gl_version(30);
piglit_ortho_projection(pattern_width, pattern_height, GL_TRUE);
/* Skip the test if num_samples > GL_MAX_SAMPLES */
GLint max_samples;
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
if (num_samples > max_samples)
piglit_report_result(PIGLIT_SKIP);
ms_fbo.setup(FboConfig(num_samples, pattern_width, pattern_height));
resolve_fbo.setup(FboConfig(0, pattern_width, pattern_height));
buffer_to_test = GL_COLOR_BUFFER_BIT;
shader_compile();
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(stipple_pattern);
}
示例12: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint ok;
GLuint prog;
GLuint vs;
piglit_require_gl_version(20);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, bad_vs_text);
prog = glCreateProgram();
glAttachShader(prog, vs);
glLinkProgram(prog);
glDeleteShader(vs);
ok = piglit_link_check_status_quiet(prog);
if (ok) {
fprintf(stderr,
"Linking with unresolved symbol succeeded when it "
"should have failed.\n");
piglit_report_result(PIGLIT_FAIL);
}
piglit_report_result(PIGLIT_PASS);
}
示例13: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
piglit_require_gl_version(14);
}
示例14: piglit_init
void
piglit_init(int argc, char *argv[])
{
GLuint vs, gs, prog;
piglit_require_gl_version(15);
piglit_require_GLSL();
do_query_init(queries, ARRAY_SIZE(queries));
prog = glCreateProgram();
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_src);
gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gs_src);
#ifndef DISPLAY
glEnable(GL_RASTERIZER_DISCARD);
#else
glAttachShader(prog,
piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_src));
#endif
glAttachShader(prog, vs);
glAttachShader(prog, gs);
glLinkProgram(prog);
if (!piglit_link_check_status(prog)) {
glDeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
glUseProgram(prog);
}
示例15: piglit_init
void piglit_init(int argc, char **argv)
{
GLint vert;
GLint prog;
GLboolean ok;
piglit_require_gl_version(20);
piglit_require_extension("GL_ARB_explicit_attrib_location");
vert = piglit_compile_shader(GL_VERTEX_SHADER,
"shaders/glsl-explicit-location-01.vert");
prog = glCreateProgram();
glAttachShader(prog, vert);
glLinkProgram(prog);
ok = piglit_link_check_status(prog);
if (ok) {
GLint loc = glGetAttribLocation(prog, "vertex");
if (loc != 0) {
fprintf(stderr,
"Expected location of 'vertex' to be 0, got "
"%d instead.\n", loc);
ok = GL_FALSE;
}
}
piglit_report_result(ok ? PIGLIT_PASS : PIGLIT_FAIL);
}