本文整理汇总了C++中piglit_require_extension函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_require_extension函数的具体用法?C++ piglit_require_extension怎么用?C++ piglit_require_extension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_require_extension函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_ARB_vertex_buffer_object");
piglit_require_GLSL();
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:6,代码来源:mixed-immediate-and-vbo.c
示例2: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
const char *source =
"!!ARBvp1.0\n"
"OPTION ARB_position_invariant;\n"
"MOV result.color, program.local[3];\n"
"END\n";
GLuint prog;
GLint max_local;
GLint i;
piglit_require_extension("GL_ARB_vertex_program");
prog = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, source);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &max_local);
/* Limit the test to blowing through 256MB of memory. */
max_local = MIN2(max_local, 1024 * 1024 * 16);
for (i = 0; i < max_local; i++) {
float values[4];
values[0] = i * 4;
values[1] = i * 4 + 1;
values[2] = i * 4 + 2;
values[3] = i * 4 + 3;
glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, values);
}
for (i = 0; i < max_local; i++) {
float values[4], get_values[4];
glGetProgramLocalParameterfvARB(GL_VERTEX_PROGRAM_ARB, i,
get_values);
values[0] = i * 4;
values[1] = i * 4 + 1;
values[2] = i * 4 + 2;
values[3] = i * 4 + 3;
if (memcmp(values, get_values, sizeof(values)) != 0) {
fprintf(stderr, "Difference on "
"glGetProgramLocalParameterfvARB(%d):\n", i);
fprintf(stderr, "expected: %f %f %f %f\n",
values[0],
values[1],
values[2],
values[3]);
fprintf(stderr, "found: %f %f %f %f\n",
get_values[0],
get_values[1],
get_values[2],
get_values[3]);
piglit_report_result(PIGLIT_FAIL);
}
}
piglit_report_result(PIGLIT_PASS);
}
开发者ID:RAOF,项目名称:piglit,代码行数:66,代码来源:getlocal4f-max.c
示例3: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_ARB_pixel_buffer_object");
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:5,代码来源:pbo-drawpixels.c
示例4: piglit_init
void
piglit_init(int argc, char **argv)
{
unsigned r;
unsigned c;
unsigned i;
(void) argc;
(void) argv;
piglit_require_vertex_program();
piglit_require_fragment_program();
piglit_require_extension("GL_NV_fragment_program_option");
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vert_prog = piglit_compile_program(GL_VERTEX_PROGRAM_ARB,
vert_shader_source);
frag_prog = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB,
frag_shader_source);
glClearColor(0.5, 0.5, 0.5, 1.0);
i = 0;
for (r = 0; r < TEST_ROWS; r++) {
for (c = 0; c < TEST_COLS; c++) {
position[i + 0] = (float)((BOX_SIZE / 2) + c *
(BOX_SIZE + 1) + 1);
position[i + 1] = (float)((BOX_SIZE / 2) + r *
(BOX_SIZE + 1) + 1);
position[i + 2] = 0.0f;
position[i + 3] = 1.0f;
i += 4;
}
}
/* Generate a bunch of random direction vectors. Based on the random
* direction vector, generate an axis such that the reflection of the
* random vector across the axis is { 0, 1, 0 }.
*/
srand(time(NULL));
for (i = 0; i < (ARRAY_SIZE(direction) / 4); i++) {
const double d[3] = {
random_float(),
random_float(),
random_float()
};
const double inv_mag_d = 1.0 /
sqrt((d[0] * d[0]) + (d[1] * d[1]) + (d[2] * d[2]));
double a[3];
double mag_a;
direction[(i * 4) + 0] = d[0] * inv_mag_d;
direction[(i * 4) + 1] = d[1] * inv_mag_d;
direction[(i * 4) + 2] = d[2] * inv_mag_d;
direction[(i * 4) + 3] = 0.0;
a[0] = direction[(i * 4) + 0] + 0.0;
a[1] = direction[(i * 4) + 1] + 1.0;
a[2] = direction[(i * 4) + 2] + 0.0;
mag_a = sqrt((a[0] * a[0]) + (a[1] * a[1]) + (a[2] * a[2]));
axis[(i * 4) + 0] = a[0] / mag_a;
axis[(i * 4) + 1] = a[1] / mag_a;
axis[(i * 4) + 2] = a[2] / mag_a;
axis[(i * 4) + 3] = 0.0;
}
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:70,代码来源:fp-rfl.c
示例5: piglit_init
void piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_EXT_framebuffer_object");
}
开发者ID:aphogat,项目名称:piglit,代码行数:4,代码来源:fbo-readpixels.c
示例6: piglit_display
enum piglit_result
piglit_display(void)
{
const char *vs_ubo_template =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"\n"
"varying vec4 vary;"
"\n"
"layout(std140) uniform ubo {\n"
" vec4 v[%d];\n"
"};\n"
"uniform int i;\n"
"\n"
"void main() {\n"
" gl_Position = gl_Vertex;\n"
" vary = v[i];\n"
"}\n";
const char *fs_template =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"\n"
"varying vec4 vary;"
"\n"
"void main() {\n"
" gl_FragColor = vary;\n"
"}\n";
const char *vs_template =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"\n"
"void main() {\n"
" gl_Position = gl_Vertex;\n"
"}\n";
const char *fs_ubo_template =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"\n"
"layout(std140) uniform ubo {\n"
" vec4 v[%d];\n"
"};\n"
"uniform int i;\n"
"\n"
"void main() {\n"
" gl_FragColor = v[i];\n"
"}\n";
char *vs_source, *fs_source;
GLint max_size, vec4s, i_location;
GLuint vs, fs, prog, bo;
GLenum target;
float *data;
size_t size;
bool pass = true;
bool may_link_fail;
const float green[4] = { 0, 1, 0, 0 };
int test_index;
piglit_require_extension("GL_ARB_uniform_buffer_object");
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_size);
printf("Max uniform block size: %d\n", max_size);
vec4s = max_size / 4 / 4;
switch (mode) {
case VS:
target = GL_VERTEX_SHADER;
may_link_fail = false;
test_index = vec4s - 1;
break;
case VS_EXCEED:
target = GL_VERTEX_SHADER;
may_link_fail = true;
vec4s++;
test_index = vec4s - 2;
break;
case FS:
target = GL_FRAGMENT_SHADER;
may_link_fail = false;
test_index = vec4s - 1;
break;
case FS_EXCEED:
target = GL_FRAGMENT_SHADER;
may_link_fail = true;
vec4s++;
test_index = vec4s - 2;
break;
default:
assert(false);
target = GL_NONE;
may_link_fail = false;
}
switch (target) {
case GL_VERTEX_SHADER:
(void)!asprintf(&vs_source, vs_ubo_template, vec4s);
(void)!asprintf(&fs_source, "%s", fs_template);
printf("Testing VS with uniform block vec4 v[%d]\n", vec4s);
break;
case GL_FRAGMENT_SHADER:
(void)!asprintf(&vs_source, "%s", vs_template);
//.........这里部分代码省略.........
开发者ID:chemecse,项目名称:piglit,代码行数:101,代码来源:maxuniformblocksize.c
示例7: render_and_check_textures
static GLboolean
render_and_check_textures(GLenum internal_format)
{
GLuint rgba_fb;
GLuint other_fb;
float rgba_image[4 * 64 * 64];
float other_image[4 * 64 * 64];
GLboolean has_green;
GLuint vs;
GLuint fs;
GLint scale_loc;
GLint bias_loc;
float scale;
float bias;
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_texture_rg");
has_green = GL_FALSE;
scale = 1.0;
bias = 0.0;
switch (internal_format) {
case GL_RG:
case GL_RG8:
case GL_RG16:
has_green = GL_TRUE;
/* FALLTHROUGH */
case GL_RED:
case GL_R8:
case GL_R16:
break;
case GL_RG16F:
has_green = GL_TRUE;
/* FALLTHROUGH */
case GL_R16F:
piglit_require_extension("GL_ARB_half_float_pixel");
/* FALLTHROUGH */
case GL_RG32F:
has_green = GL_TRUE;
/* FALLTHROUGH */
case GL_R32F:
scale = 511.0;
piglit_require_extension("GL_ARB_texture_float");
break;
case GL_RG_INTEGER:
case GL_RG8I:
case GL_RG16I:
case GL_RG32I:
has_green = GL_TRUE;
/* FALLTHROUGH */
case GL_R8I:
case GL_R16I:
case GL_R32I:
bias = -100.0;
scale = 511.0;
piglit_require_extension("GL_EXT_texture_integer");
break;
case GL_RG8UI:
case GL_RG16UI:
case GL_RG32UI:
has_green = GL_TRUE;
/* FALLTHROUGH */
case GL_R16UI:
case GL_R32UI:
scale = 511.0;
piglit_require_extension("GL_EXT_texture_integer");
break;
case GL_RG_SNORM:
case GL_RG8_SNORM:
case GL_RG16_SNORM:
has_green = GL_TRUE;
/* FALLTHROUGH */
case GL_RED_SNORM:
case GL_R8_SNORM:
case GL_R16_SNORM:
scale = 0.5;
bias = -0.5;
piglit_require_extension("GL_EXT_texture_snorm");
break;
default:
fprintf(stderr, "invalid format 0x%04x\n", internal_format);
piglit_report_result(PIGLIT_FAIL);
break;
}
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE,
2 * sizeof(GLfloat), positions);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE,
4 * sizeof(GLfloat), colors);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert_code);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag_code);
fbo_program = piglit_link_simple_program(vs, fs);
//.........这里部分代码省略.........
开发者ID:Zoxc,项目名称:piglit,代码行数:101,代码来源:fbo-rg.c
示例8: piglit_init
void
piglit_init(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "coherent")) {
coherent = GL_TRUE;
continue;
}
if (!strcmp(argv[i], "read")) {
test = READ;
continue;
}
if (!strcmp(argv[i], "draw")) {
test = DRAW;
continue;
}
if (!strcmp(argv[i], "client-storage")) {
client_storage = GL_TRUE;
continue;
}
printf("Unknown param: %s\n", argv[i]);
piglit_report_result(PIGLIT_FAIL);
}
if (test == NONE) {
puts("Wrong parameters.");
piglit_report_result(PIGLIT_FAIL);
}
#ifdef PIGLIT_USE_OPENGL
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
piglit_require_gl_version(15);
piglit_require_extension("GL_ARB_buffer_storage");
piglit_require_extension("GL_ARB_map_buffer_range");
if (test == READ) {
piglit_require_extension("GL_ARB_copy_buffer");
piglit_require_extension("GL_ARB_sync");
}
if (!coherent) { /* for MemoryBarrier */
piglit_require_extension("GL_ARB_shader_image_load_store");
}
#else // PIGLIT_USE_OPENGL_ES3
GLuint program;
GLuint vertex_index;
piglit_require_extension("GL_EXT_buffer_storage");
/* Create program */
program = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(program);
#endif
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferStorage(GL_ARRAY_BUFFER, BUF_SIZE, NULL,
GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT |
(coherent ? GL_MAP_COHERENT_BIT : 0) |
GL_DYNAMIC_STORAGE_BIT |
(client_storage ? GL_CLIENT_STORAGE_BIT : 0));
piglit_check_gl_error(GL_NO_ERROR);
map = glMapBufferRange(GL_ARRAY_BUFFER, 0, BUF_SIZE,
GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT |
(coherent ? GL_MAP_COHERENT_BIT : 0));
piglit_check_gl_error(GL_NO_ERROR);
if (!map)
piglit_report_result(PIGLIT_FAIL);
#ifdef PIGLIT_USE_OPENGL_ES3
/* Gen VAO */
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
/* Retrieve indices from vs */
vertex_index = glGetAttribLocation(program, "vertex");
/* Enable vertex attrib array */
glEnableVertexAttribArray(vertex_index);
glVertexAttribPointer(vertex_index, 3, GL_FLOAT, GL_FALSE, 0, 0);
piglit_check_gl_error(GL_NO_ERROR);
#endif
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
开发者ID:chemecse,项目名称:piglit,代码行数:93,代码来源:bufferstorage.c
示例9: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
unsigned int i;
GLuint prog;
const char *source =
"#extension GL_ARB_uniform_buffer_object : enable\n"
"uniform ubo1 { float a; };\n"
"uniform ubo2 { float bb; float c; };\n"
"uniform float dddd;\n"
"void main() {\n"
" gl_FragColor = vec4(a + bb + c + dddd);\n"
"}\n";
int uniforms;
bool pass = true;
const char *names[4] = {"a", "bb", "c", "dddd"};
bool found[4] = {false, false, false, false};
char no_write;
char fill_char = 0xd0;
piglit_require_extension("GL_ARB_uniform_buffer_object");
prog = piglit_build_simple_program(NULL, source);
glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &uniforms);
assert(uniforms == 4);
for (i = 0; i < uniforms; i++) {
GLint written_strlen = 0;
GLint namelen = 9999;
char name[1000];
int name_index;
/* This is the size including null terminator. */
glGetActiveUniformsiv(prog, 1, &i,
GL_UNIFORM_NAME_LENGTH, &namelen);
memset(name, 0xd0, sizeof(name));
glGetActiveUniformName(prog, i, sizeof(name),
&written_strlen, name);
if (written_strlen >= sizeof(name) - 1) {
fprintf(stderr,
"return strlen %d, longer than the buffer size\n",
written_strlen);
pass = false;
continue;
} else if (name[written_strlen] != 0) {
fprintf(stderr, "return name[%d] was %d, expected 0\n",
written_strlen, name[written_strlen]);
pass = false;
continue;
} else if (strlen(name) != written_strlen) {
fprintf(stderr, "return strlen was %d, but \"%s\" "
"has strlen %d\n", written_strlen, name,
(int)strlen(name));
pass = false;
continue;
}
for (name_index = 0; name_index < ARRAY_SIZE(names); name_index++) {
if (strcmp(names[name_index], name) == 0) {
if (found[name_index]) {
fprintf(stderr,
"Uniform name \"%s\" "
"returned twice.\n", name);
pass = false;
}
found[name_index] = true;
break;
}
}
if (name_index == ARRAY_SIZE(names)) {
fprintf(stderr,
"uniform \"%s\" is not a known name\n", name);
pass = false;
continue;
}
if (namelen != written_strlen + 1) {
fprintf(stderr,
"uniform \"%s\" had "
"GL_UNIFORM_NAME_LENGTH %d, expected %d\n",
name, namelen, written_strlen + 1);
pass = false;
continue;
}
/* Test for overflow by writing to a bufSize equal to
* strlen and checking if a null terminator or
* something landed past that.
*/
memset(name, fill_char, sizeof(name));
glGetActiveUniformName(prog, i, written_strlen, NULL, name);
if (name[written_strlen] != fill_char) {
fprintf(stderr, "glGetActiveUniformName overflowed: "
"name[%d] = 0x%02x instead of 0x%02x\n",
written_strlen, name[written_strlen],
fill_char);
//.........这里部分代码省略.........
开发者ID:chemecse,项目名称:piglit,代码行数:101,代码来源:getactiveuniformname.c
示例10: piglit_init
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLuint pipe;
GLuint vs_prog;
GLuint active_prog;
GLuint unlinked_prog;
GLuint shader;
unsigned glsl_version;
char *source;
piglit_require_extension("GL_ARB_separate_shader_objects");
glsl_version = pick_a_glsl_version();
glGenProgramPipelines(1, &pipe);
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
glBindProgramPipeline(pipe);
(void)!asprintf(&source, vs_code_template, glsl_version);
vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
(const GLchar *const *) &source);
pass = piglit_link_check_status(vs_prog) && pass;
/* First, make a valid program active.
*/
glActiveShaderProgram(pipe, vs_prog);
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
/* Next, try to make an invalid program active and verify that the
* correct error is generated. Also make sure the old program is
* still active.
*
* Section 7.4 (Program Pipeline Objects) under ActiveShaderProgram of
* the OpenGL 4.4 spec says:
*
* "An INVALID_VALUE error is generated if program is not zero and
* is not the name of either a program or shader object."
*/
glActiveShaderProgram(pipe, ~vs_prog);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glGetProgramPipelineiv(pipe, GL_ACTIVE_PROGRAM, (GLint *) &active_prog);
if (active_prog != vs_prog) {
printf("glActiveShaderProgram with an invalid program name "
"changed the active program state.\n");
pass = false;
} else {
glActiveShaderProgram(pipe, vs_prog);
}
/* Try the same thing with a valid shader object (that is not part of
* a linked program). Verify that the correct error is generated, and
* make sure the old program is still active.
*
* Section 7.4 (Program Pipeline Objects) under ActiveShaderProgram of
* the OpenGL 4.4 spec says:
*
* "An INVALID_OPERATION error is generated if program is the name
* of a shader object."
*/
shader = piglit_compile_shader_text(GL_VERTEX_SHADER, source);
glActiveShaderProgram(pipe, shader);
pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glGetProgramPipelineiv(pipe, GL_ACTIVE_PROGRAM, (GLint *) &active_prog);
if (active_prog != vs_prog) {
printf("glActiveShaderProgram with a shader object "
"changed the active program state.\n");
pass = false;
} else {
glActiveShaderProgram(pipe, vs_prog);
}
/* Finally, try the same thing with a valid program that is not
* linked. Verify that the correct error is generated, and make sure
* the old program is still active.
*
* Section 7.4 (Program Pipeline Objects) under ActiveShaderProgram of
* the OpenGL 4.4 spec says:
*
* "An INVALID_OPERATION error is generated if program is not zero
* and has not been linked, or was last linked unsuccessfully."
*/
unlinked_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
(const GLchar *const *) &invalid_code);
glActiveShaderProgram(pipe, unlinked_prog);
pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glGetProgramPipelineiv(pipe, GL_ACTIVE_PROGRAM, (GLint *) &active_prog);
if (active_prog != vs_prog) {
printf("glActiveShaderProgram with an unlinked program "
"changed the active program state.\n");
pass = false;
} else {
glActiveShaderProgram(pipe, vs_prog);
}
//.........这里部分代码省略.........
开发者ID:chemecse,项目名称:piglit,代码行数:101,代码来源:ActiveShaderProgram-invalid-program.c
示例11: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
bool pass = true;
int i;
static const GLenum invalidWrapParams[] = {
GL_REPEAT,
GL_MIRRORED_REPEAT,
GL_MIRROR_CLAMP_EXT,
GL_MIRROR_CLAMP_TO_BORDER_EXT,
/* This has the same value as GL_MIRROR_CLAMP_TO_EDGE, but
* glext.h may not be new enough. Just use the _EXT version.
*/
GL_MIRROR_CLAMP_TO_EDGE_EXT,
};
static const GLenum invalidFilterParams[] = {
GL_NEAREST_MIPMAP_NEAREST,
GL_NEAREST_MIPMAP_LINEAR,
GL_LINEAR_MIPMAP_NEAREST,
GL_LINEAR_MIPMAP_LINEAR
};
if (piglit_get_gl_version() < 33)
piglit_require_extension("ARB_texture_rectangle");
/* "...the error INVALID_ENUM is generated if the TEXTURE_WRAP_S,
* TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set to REPEAT or
* MIRRORED_REPEAT."
*/
for(i = 0; i < ARRAY_SIZE(invalidWrapParams); i++) {
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S,
invalidWrapParams[i]);
pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T,
invalidWrapParams[i]);
pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_R,
invalidWrapParams[i]);
pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
}
/* "The error INVALID_ENUM is generated if TEXTURE_MIN_FILTER is set
* to a value other than NEAREST or LINEAR."
*/
for (i = 0; i < ARRAY_SIZE(invalidFilterParams); i++) {
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER,
invalidFilterParams[i]);
pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
}
/* "The error INVALID_VALUE is generated if TEXTURE_BASE_LEVEL is set
* to any value other than zero."
*/
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_BASE_LEVEL, 37);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:63,代码来源:texture-base-level-error.c
示例12: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLuint bo[2];
GLint binding;
piglit_require_extension("GL_ARB_uniform_buffer_object");
glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, 0, &binding);
if (binding != 0) {
fprintf(stderr, "Default UBO binding should be 0, was %d\n",
binding);
piglit_report_result(PIGLIT_FAIL);
}
glGenBuffers(2, bo);
glBindBuffer(GL_UNIFORM_BUFFER, bo[0]);
glBufferData(GL_UNIFORM_BUFFER, 4, NULL, GL_STATIC_DRAW);
glBindBufferBase(GL_UNIFORM_BUFFER, 0, bo[0]);
glBindBuffer(GL_UNIFORM_BUFFER, bo[1]);
glBufferData(GL_UNIFORM_BUFFER, 4, NULL, GL_STATIC_DRAW);
glBindBufferRange(GL_UNIFORM_BUFFER, 1, bo[1], 0, 4);
glDeleteBuffers(2, bo);
if (glIsBuffer(bo[0]) || glIsBuffer(bo[1])) {
fprintf(stderr, "Failed to delete buffers\n");
pass = false;
}
glGetIntegerv(GL_UNIFORM_BUFFER_BINDING, &binding);
if (binding != 0) {
printf("Failed to unbind glBindBuffer() buffer %d:\n"
" binding set to %d, should be 0\n",
bo[1], binding);
pass = false;
}
glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, 0, &binding);
if (binding != 0) {
printf("Failed to unbind glBindBufferBase() buffer %d:\n"
" binding set to %d, should be 0\n",
bo[0], binding);
pass = false;
}
glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, 1, &binding);
if (binding != 0) {
printf("Failed to unbind glBindBufferRange() buffer %d:\n"
" binding set to %d, should be 0\n",
bo[1], binding);
pass = false;
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:61,代码来源:deletebuffers.c
示例13: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint align, value[2];
GLuint tex, bo;
piglit_require_gl_version(20);
piglit_require_extension("GL_ARB_texture_buffer_range");
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_BUFFER, tex);
glGenBuffers(1, &bo);
glBindBuffer(GL_TEXTURE_BUFFER, bo);
glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, &align);
if (align < 1) {
fprintf(stderr, "GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT == %i, "
"should be >= 1\n", align);
piglit_report_result(PIGLIT_FAIL);
}
/* If <offset> is negative or if <size> is
* less than or equal to zero or if <offset> + <size> is greater than
* the value of BUFFER_SIZE for the buffer bound to <target>, of if
* <offset> is not an integer multiple of
* TEXTURE_BUFFER_OFFSET_ALIGNMENT, then the error INVALID_VALUE
* is generated.
*/
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, 0, 4);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
glBufferData(GL_TEXTURE_BUFFER, TBO_SIZE, NULL, GL_STATIC_DRAW);
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, -align, 4);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, 0, 0);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, 0, -16);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
if (align > 1) {
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, align / 2, 16);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
}
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo,
align, TBO_SIZE - align);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr, "glTexBufferRange failed\n");
piglit_report_result(PIGLIT_FAIL);
}
glGetTexLevelParameteriv(GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_OFFSET,
&value[0]);
glGetTexLevelParameteriv(GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_SIZE,
&value[1]);
if (value[0] != align || value[1] != TBO_SIZE - align) {
fprintf(stderr, "GL_TEXTURE_BUFFER_OFFSET/SIZE returned %i/%i, "
"expected %i/%i\n",
value[0], value[1], align, TBO_SIZE - align);
piglit_report_result(PIGLIT_FAIL);
}
/* If <buffer> is zero, then any buffer object attached to the
* buffer texture is detached, the values <offset> and <size> are
* ignored and the state for <offset> and <size> for the
* buffer texture are reset to zero.
*/
glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, 0, -align, TBO_SIZE * 2);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
glGetTexLevelParameteriv(GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_OFFSET,
&value[0]);
glGetTexLevelParameteriv(GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_SIZE,
&value[1]);
if (value[0] || value[1]) {
fprintf(stderr, "buffer detached but "
"GL_TEXTURE_BUFFER_OFFSET/SIZE "
"not reset to 0\n");
piglit_report_result(PIGLIT_FAIL);
}
piglit_report_result(PIGLIT_PASS);
}
开发者ID:RAOF,项目名称:piglit,代码行数:93,代码来源:errors.c
示例14: piglit_init
void
piglit_init(int argc, char **argv)
{
static const char *st_r_tf_varying[] = {"gs_output0", NULL};
piglit_require_extension("GL_ARB_program_interface_query");
piglit_require_extension("GL_ARB_separate_shader_objects");
/* Allocate the different programs */
prog_std = piglit_build_simple_program_unlinked_multiple_shaders(
GL_VERTEX_SHADER, vs_std,
GL_GEOMETRY_SHADER, gs_std,
GL_FRAGMENT_SHADER, fs_std,
0);
glTransformFeedbackVaryings(prog_std, 1, st_r_tf_varying,
GL_INTERLEAVED_ATTRIBS);
piglit_check_gl_error(GL_NO_ERROR);
/* force the compiler not to optimise away inputs/outputs */
glProgramParameteri(prog_std, GL_PROGRAM_SEPARABLE, GL_TRUE);
piglit_check_gl_error(GL_NO_ERROR);
glLinkProgram(prog_std);
if (!piglit_link_check_status(prog_std)) {
glDeleteProgram(prog_std);
piglit_report_result(PIGLIT_FAIL);
}
if (piglit_is_extension_supported("GL_ARB_shader_storage_buffer_object")) {
prog_stor = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_stor,
GL_GEOMETRY_SHADER, gs_stor,
GL_FRAGMENT_SHADER, fs_stor,
0);
prog_buff_blks = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_buff_blks,
GL_FRAGMENT_SHADER, fs_buff_blks,
0);
}
if (piglit_is_extension_supported("GL_ARB_explicit_attrib_location") &&
piglit_is_extension_supported("GL_ARB_explicit_uniform_location")) {
prog_loc = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_loc,
GL_FRAGMENT_SHADER, fs_loc,
0);
}
if (piglit_is_extension_supported("GL_ARB_shader_atomic_counters")) {
prog_atom = piglit_build_simple_program_unlinked_multiple_shaders(
GL_FRAGMENT_SHADER, fs_atom,
0);
/* force the compiler not to optimise away inputs/outputs */
glProgramParameteri(prog_atom, GL_PROGRAM_SEPARABLE,
GL_TRUE);
piglit_check_gl_error(GL_NO_ERROR);
glLinkProgram(prog_atom);
if (!piglit_link_check_status(prog_atom)) {
glDeleteProgram(prog_atom);
piglit_report_result(PIGLIT_FAIL);
}
}
if (!piglit_is_extension_supported("GL_ARB_shader_subroutine")) {
return;
}
prog_sub = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_sub,
GL_GEOMETRY_SHADER, gs_sub,
GL_FRAGMENT_SHADER, fs_sub,
0);
if (piglit_is_extension_supported("GL_ARB_tessellation_shader")) {
prog_sub_tess =
piglit_build_simple_program_unlinked_multiple_shaders(
GL_TESS_CONTROL_SHADER, tcs_sub,
0);
/* force the compiler not to optimise away inputs/outputs */
glProgramParameteri(prog_sub_tess, GL_PROGRAM_SEPARABLE,
GL_TRUE);
piglit_check_gl_error(GL_NO_ERROR);
glLinkProgram(prog_sub_tess);
if (!piglit_link_check_status(prog_sub_tess)) {
glDeleteProgram(prog_sub_tess);
piglit_report_result(PIGLIT_FAIL);
}
}
if (piglit_is_extension_supported("GL_ARB_compute_shader")) {
prog_cs = piglit_build_simple_program_multiple_shaders(
GL_COMPUTE_SHADER, cs_sub,
0);
}
}
开发者ID:chemecse,项目名称:piglit,代码行数:99,代码来源:getprogramresourceiv.c
示例15: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_ARB_framebuffer_object");
glClearColor(0.2, 0.2, 0.2, 0.0);
}
开发者ID:aphogat,项目名称:piglit,代码行数:6,代码来源:fbo-viewport.c
示例16: piglit_init
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLuint fs;
GLuint save_index = 0xaaaaaaaa;
const GLchar *one_uniform = "a";
const GLchar *uniform_names[] = {"a", "b", "c"};
bool found_index[3] = {false, false, false};
GLuint indices[3], index;
int i;
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);
/* From the GL_ARB_uniform_buffer_object spec:
*
* "The error INVALID_VALUE is generated by GetUniformIndices,
* GetActiveUniformsiv, GetActiveUniformName, GetUniformBlockIndex,
* GetActiveUniformBlockiv, GetActiveUniformBlockName, and
* UniformBlockBinding if <program> is not a value generated by GL.
*
* ...
*
* The error INVALID_VALUE is generated by GetUniformIndices and
* GetActiveUniformsiv if <uniformCount> is less than zero.
*
* ...
*
* "If an error occurs, nothing is written to <uniformIndices>."
*/
index = save_index;
glGetUniformIndices(prog, -1, &one_uniform, &index);
if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
pass = false;
} else if (index != save_index) {
printf("Bad program uniform index: 0x%08x\n", index);
printf(" Expected 0x%08x\n", save_index);
pass = false;
}
index = save_index;
glGetUniformIndices(0xd0d0, 1, &one_uniform, &index);
if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
pass = false;
} else if (index != save_index) {
printf("Bad program uniform index: 0x%08x\n", index);
printf(" Expected 0x%08x\n", save_index);
pass = false;
}
glGetUniformIndices(prog, 3, uniform_names, indices);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
for (i = 0; i < 3; i++) {
printf("%s: index %d\n", uniform_names[i], indices[i]);
if (indices[i] < 0 || indices[i] > 2 ||
found_index[indices[i]]) {
printf("Expected consecutive numbers starting from 0\n");
pass = false;
}
found_index[indices[i]] = true;
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:76,代码来源:getuniformindices.c
示例17: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_EXT_texture_sRGB");
reshape(piglit_width, piglit_height);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:6,代码来源:tex-srgb.c
示例18: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_ARB_direct_state_access");
piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:6,代码来源:gettextureimage-luminance.c
示例19: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint num_compressed_formats;
GLenum *compressed_formats = NULL;
unsigned i;
bool pass = true;
piglit_require_extension("GL_ARB_texture_compression");
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS,
&num_compressed_formats);
if (num_compressed_formats == 0) {
printf("No compressed formats supported.\n");
} else if (num_compressed_formats < 0) {
fprintf(stderr,
"Invalid number of compressed formats (%d) reported\n",
num_compressed_formats);
piglit_report_result(PIGLIT_FAIL);
} else {
compressed_formats = calloc(num_compressed_formats,
sizeof(GLenum));
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS,
(GLint *) compressed_formats);
printf("Driver reported the following compressed formats:\n");
for (i = 0; i < num_compressed_formats; i++) {
printf(" 0x%04x %s\n",
compressed_formats[i],
piglit_get_gl_enum_name(compressed_formats[i]));
}
printf("\n");
fflush(stdout);
}
/* There are some specific formats that are valid for certain generic
* formats that are not returned by the GL_COMRPESSED_TEXTURE_FORMATS
* query. That query only returns formats that have no restrictions or
* caveats for RGB or RGBA base formats. We have to add these formats
* to the list of possible formats by hand.
*/
if (piglit_is_extension_supported("GL_EXT_texture_compression_latc")) {
compressed_formats =
add_formats(compressed_formats,
&num_compressed_formats,
4,
GL_COMPRESSED_LUMINANCE_LATC1_EXT,
GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT,
GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,
GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT);
}
if (piglit_is_extension_supported("GL_ATI_texture_compression_3dc")) {
compressed_formats =
add_formats(compressed_formats,
&num_compressed_formats,
1,
0x8837);
}
pass = try_formats(arb_texture_compression_formats,
ARRAY_SIZE(arb_texture_compression_formats),
compressed_formats,
num_compressed_formats);
/* Remove the various luminance and luminance-alpha formats from the
* list since they cannot be used for the later tests.
*/
if (piglit_is_extension_supported("GL_ATI_texture_compression_3dc")) {
num_compressed_formats--;
}
if (piglit_is_extension_supported("GL_EXT_texture_compression_latc")) {
num_compressed_formats -= 4;
}
/* Add the RGTC formats, then check them.
*/
if (piglit_is_extension_supported("GL_ARB_texture_rg")) {
if (piglit_is_extension_supported("GL_ARB_texture_compression_rgtc")
|| piglit_is_extension_supported("GL_EXT_texture_compression_rgtc")) {
compressed_formats =
add_formats(compressed_formats,
&num_compressed_formats,
4,
GL_COMPRESSED_RED_RGTC1,
GL_COMPRESSED_SIGNED_RED_RGTC1,
GL_COMPRESSED_RG_RGTC2,
GL_COMPRESSED_SIGNED_RG_RGTC2);
}
pass = try_formats(arb_texture_rg_formats,
ARRAY_SIZE(arb_texture_rg_formats),
compressed_formats,
num_compressed_formats)
&& pass;
/* Remove the RGTC formats from the list since they cannot be
* used for the later tests.
*/
//.........这里部分代码省略.........
开发者ID:ThirteenFish,项目名称:piglit,代码行数:101,代码来源:internal-format-query.c
示例20: piglit_init
void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_AMD_framebuffer_multisample_advanced");
/* Check enums. */
int num_modes, *modes;
glGetIntegerv(GL_NUM_SUPPORTED_MULTISAMPLE_MODES_AMD, &num_modes);
piglit_check_gl_error(GL_NO_ERROR);
if (num_modes < 1)
piglit_fail("GL_NUM_SUPPORTED_MULTISAMPLED_MODES_AMD expected > 0, got %u\n", num_modes);
int max_color_samples, max_color_storage_samples, max_depthstencil_samples;
glGetIntegerv(GL_MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD, &max_color_samples);
glGetIntegerv(GL_MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD, &max_color_storage_samples);
glGetIntegerv(GL_MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD, &max_depthstencil_samples);
if (max_color_samples < 4 ||
max_color_storage_samples < 4 ||
max_depthstencil_samples < 4) {
piglit_fail("GL_MAX_xxx_SAMPLES_AMD expected >= 4, got %u,%u,%u\n",
max_color_samples, max_color_storage_samples,
max_depthstencil_samples);
}
if (max_color_samples < max_color_storage_samples)
piglit_fail("GL_MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD < GL_MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD\n");
modes = malloc(num_modes * 3 * 4);
glGetIntegerv(GL_SUPPORTED_MULTISAMPLE_MODES_AMD, modes);
piglit_check_gl_error(GL_NO_ERROR);
bool found_max_color = false, found_max_zs
|
请发表评论