本文整理汇总了C++中piglit_check_gl_error函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_check_gl_error函数的具体用法?C++ piglit_check_gl_error怎么用?C++ piglit_check_gl_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_check_gl_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
int x0 = piglit_width / 4;
int x1 = piglit_width * 3 / 4;
int y0 = piglit_height / 4;
int y1 = piglit_height * 3 / 4;
int i;
glViewport(0, 0, piglit_width, piglit_height);
glClear(GL_COLOR_BUFFER_BIT);
for (i = 0; i < NUM_SQUARES; i++) {
/* Load UBO data, at offset=alignment */
glNamedBufferSubData(buffers[0], alignment, sizeof(pos_size[0]),
pos_size[i]);
glNamedBufferSubData(buffers[1], alignment, sizeof(color[0]),
color[i]);
glNamedBufferSubData(buffers[2], alignment, sizeof(rotation[0]),
&rotation[i]);
if (!piglit_check_gl_error(GL_NO_ERROR))
return PIGLIT_FAIL;
piglit_draw_rect(-1, -1, 2, 2);
}
pass = probe(x0, y0, 0) && pass;
pass = probe(x1, y0, 1) && pass;
pass = probe(x0, y1, 2) && pass;
pass = probe(x1, y1, 3) && pass;
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chemecse,项目名称:piglit,代码行数:38,代码来源:rendering-dsa.c
示例2: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs;
const char *varying_name = "output_value";
/* Parse args */
if (argc != 2)
print_usage_and_exit(argv[0]);
selected_test = interpret_test_case_arg(argv[1]);
if (selected_test == NULL)
print_usage_and_exit(argv[0]);
/* Make sure required GL features are present */
piglit_require_GLSL_version(120);
piglit_require_transform_feedback();
if (selected_test->bind_offset != 0 && selected_test->bind_size == 0) {
/* Test requires glBindBufferOffsetEXT, which is in
* EXT_transform_feedback, but was never adopted into
* OpenGL.
*/
piglit_require_extension("GL_EXT_transform_feedback");
}
/* Create program and buffer */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
prog = glCreateProgram();
glAttachShader(prog, vs);
glTransformFeedbackVaryings(prog, 1, &varying_name,
GL_INTERLEAVED_ATTRIBS);
glLinkProgram(prog);
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
glGenBuffers(1, &xfb_buf);
glGenQueries(1, &query);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
}
开发者ID:dervishxgit,项目名称:piglit,代码行数:38,代码来源:change-size.c
示例3: query_work_group_size_expect_error
static enum piglit_result
query_work_group_size_expect_error(GLint prog)
{
const GLint orig_query_result[3] = { 1234, 2345, 3456 };
GLint query_result[3];
int i;
for (i = 0; i < 3; i++)
query_result[i] = orig_query_result[i];
glGetProgramiv(prog, GL_COMPUTE_WORK_GROUP_SIZE, query_result);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
return PIGLIT_FAIL;
for (i = 0; i < 3; i++) {
if (query_result[i] != orig_query_result[i]) {
printf("Error was generated, but query returned a "
"result anyway.");
return PIGLIT_FAIL;
}
}
return PIGLIT_PASS;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:23,代码来源:api_errors.c
示例4: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
GLint objID = glCreateProgram();
/* Check the link status is set to false */
glLinkProgram(objID);
if (piglit_link_check_status(objID))
piglit_report_result(PIGLIT_FAIL);
/* UseProgram should throw an error when the program has not been
* successfully linked.
*/
glUseProgram(objID);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
glDeleteProgram(objID);
piglit_report_result(PIGLIT_PASS);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:23,代码来源:glsl-link-empty-prog.c
示例5: piglit_init
void
piglit_init(int argc, char **argv)
{
bool pass = true;
/* The first 5 indices should be ignored */
const unsigned indices[6] = {0, 0, 0, 0, 0, 1};
piglit_require_extension("GL_ARB_shader_subroutine");
piglit_require_extension("GL_ARB_explicit_uniform_location");
piglit_require_extension("GL_ARB_explicit_attrib_location");
prog = piglit_build_simple_program(NULL, frag_shader_text);
glUseProgram(prog);
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 6, indices);
if (!piglit_check_gl_error(0)) {
pass = false;
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:23,代码来源:uniformsubroutinesuiv.c
示例6: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint buffer;
double ssbo_values[SSBO_SIZE] = {0};
piglit_require_extension("GL_ARB_shader_storage_buffer_object");
piglit_require_GLSL_version(400);
prog = piglit_build_simple_program(vs_pass_thru_text, fs_source);
glUseProgram(prog);
glClearColor(0, 0, 0, 1);
glGenBuffers(1, &buffer);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, buffer);
glBufferData(GL_SHADER_STORAGE_BUFFER, SSBO_SIZE*sizeof(GLdouble),
&ssbo_values[0], GL_DYNAMIC_DRAW);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
}
开发者ID:dcbaker,项目名称:piglit,代码行数:23,代码来源:fs-non-uniform-control-flow-ssbo.c
示例7: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLuint bo;
uint8_t in_data[1] = {0xaa};
uint8_t out_data[1] = {0xd0};
void *ptr1, *ptr2;
piglit_require_extension("GL_ARB_uniform_buffer_object");
glGenBuffers(1, &bo);
glBindBuffer(GL_UNIFORM_BUFFER, bo);
pass = pass && piglit_check_gl_error(0);
glBufferData(GL_UNIFORM_BUFFER, 1, NULL, GL_STATIC_READ);
pass = pass && piglit_check_gl_error(0);
glBufferSubData(GL_UNIFORM_BUFFER, 0, 1, in_data);
pass = pass && piglit_check_gl_error(0);
ptr1 = glMapBuffer(GL_UNIFORM_BUFFER, GL_READ_ONLY);
pass = pass && piglit_check_gl_error(0);
glGetBufferPointerv(GL_UNIFORM_BUFFER, GL_BUFFER_MAP_POINTER, &ptr2);
pass = pass && piglit_check_gl_error(0);
assert(ptr1 == ptr2);
glUnmapBuffer(GL_UNIFORM_BUFFER);
pass = pass && piglit_check_gl_error(0);
glGetBufferSubData(GL_UNIFORM_BUFFER, 0, 1, out_data);
pass = pass && piglit_check_gl_error(0);
assert(memcmp(in_data, out_data, sizeof(in_data)) == 0);
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:40,代码来源:buffer-targets.c
示例8: piglit_display
enum piglit_result
piglit_display()
{
bool pass = true;
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
allocate_data_arrays();
/* Set sample_alpha_to_one = false to generate the reference image */
draw_reference_image(false /* sample_alpha_to_coverage */,
false /* sample_alpha_to_one */);
/* Test multisample fbo with GL_SAMPLE_ALPHA_TO_ONE enabled but
* GL_MULTISAMPLE disabled */
glDisable(GL_MULTISAMPLE);
draw_test_image(false /* sample_alpha_to_coverage */,
true /* sample_alpha_to_one */);
glEnable(GL_MULTISAMPLE);
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
pass = piglit_probe_rect_halves_equal_rgba(0, 0,
piglit_width,
piglit_height)
&& pass;
/* Free the memory allocated for data arrays */
free_data_arrays();
if (!piglit_automatic)
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chemecse,项目名称:piglit,代码行数:37,代码来源:alpha-to-one-msaa-disabled.cpp
示例9: piglit_init
void
piglit_init(int argc, char **argv)
{
bool pass = true;
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");
X(test_target_errors(GL_TEXTURE_1D), "1D tex target validity");
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");
X(test_target_errors(GL_TEXTURE_RECTANGLE),
"Rectangle tex target validity");
X(test_target_errors(GL_TEXTURE_1D_ARRAY),
"1D Array tex target validity");
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")) {
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);
}
开发者ID:RAOF,项目名称:piglit,代码行数:37,代码来源:targets.c
示例10: piglit_init
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLint box[9 * 4] = {0};
int max;
piglit_require_extension("GL_EXT_window_rectangles");
glGetIntegerv(GL_MAX_WINDOW_RECTANGLES_EXT, &max);
glWindowRectanglesEXT(0, 0, NULL);
if (!piglit_check_gl_error(GL_INVALID_ENUM))
pass = false;
glWindowRectanglesEXT(GL_EXCLUSIVE_EXT, -1, NULL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
if (max < 9) {
GLint t[4];
glWindowRectanglesEXT(GL_EXCLUSIVE_EXT, max + 1, box);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
glGetIntegeri_v(GL_WINDOW_RECTANGLE_EXT, max + 1, t);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
}
if (max > 9)
max = 9;
box[2] = -1;
glWindowRectanglesEXT(GL_EXCLUSIVE_EXT, max, box);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
box[2] = 0;
box[3] = -1;
glWindowRectanglesEXT(GL_EXCLUSIVE_EXT, max, box);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:chemecse,项目名称:piglit,代码行数:44,代码来源:errors.c
示例11: piglit_init
void
piglit_init(int argc, char **argv)
{
GLenum targets[] = {
0,
GL_TEXTURE_2D,
GL_TEXTURE_BUFFER + 1,
};
GLuint tex;
int i;
piglit_require_extension("GL_ARB_texture_buffer_object");
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_BUFFER, tex);
for (i = 0; i < ARRAY_SIZE(targets); i++) {
glTexBufferARB(targets[i], GL_RGBA8, 0);
if (!piglit_check_gl_error(GL_INVALID_ENUM))
piglit_report_result(PIGLIT_FAIL);
}
piglit_report_result(PIGLIT_PASS);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:24,代码来源:negative-bad-target.c
示例12: attach_texture
static GLuint
attach_texture(int i)
{
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
32, 32, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT + i,
GL_TEXTURE_2D,
tex,
0);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
return tex;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:24,代码来源:fbo-drawbuffers-maxtargets.c
示例13: draw_multi_scissor_rect
/**
* Draws a single quad full window size, with different scissor rectangles.
* Scissor rectangles restrict drawing to sub-area of full window.
* Geometry shader is responsible for expanding primitives to cover all
* divX * divY viewport/scissor indices. The function reads back the expected
* color to test if the scissored drawing was correct.
*/
static bool
draw_multi_scissor_rect(void)
{
bool pass = true;
int i, j;
GLfloat w = (GLfloat) piglit_width / (GLfloat) divX;
GLfloat h = (GLfloat) piglit_height / (GLfloat) divY;
glViewport(0, 0, piglit_width, piglit_height);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
/* setup scissor rectangles for viewport indices */
for (i = 0; i < divX; i++) {
for (j = 0; j < divY; j++) {
glScissorIndexed(j + i*divY, i * w, j * h, w, h);
}
}
/* draw full viewport sized quads scissored down and check results */
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
pass = draw_check_pixels() & pass;
glDisable(GL_SCISSOR_TEST);
return pass;
}
开发者ID:rib,项目名称:piglit,代码行数:31,代码来源:render_scissor.c
示例14: incomplete_0_by_0_renderbuffer
/**
* Verify that attaching a 0x0 renderbuffer results in incompleteness.
*/
bool
incomplete_0_by_0_renderbuffer(void)
{
incomplete_fbo_test t("0x0 renderbuffer", GL_RENDERBUFFER);
/* Attach a 0x0 renderbuffer to the framebuffer. That should make it
* incomplete.
*/
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 0, 0);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, t.rb);
if (!piglit_check_gl_error(GL_NO_ERROR))
return t.fail();
if (!t.check_fbo_status(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
return t.fail();
/* Allocate some storage for the renderbuffer and verify that
* the FBO is now complete.
*/
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 4, 4);
if (!t.check_fbo_status(GL_FRAMEBUFFER_COMPLETE))
return t.fail();
/* Verify that simple rendering can occur to the FBO.
*/
glClearColor(0.f, 1.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_READ_FRAMEBUFFER, t.fbo);
if (!piglit_probe_rect_rgba(0, 0, 4, 4, green))
return t.fail();
return t.pass();
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:39,代码来源:fbo-incomplete.cpp
示例15: test_bindtexture
/* Page 156 */
static bool
test_bindtexture()
{
GLenum targets[] = {
GL_TEXTURE_1D,
GL_TEXTURE_1D_ARRAY,
GL_TEXTURE_2D,
GL_TEXTURE_2D_ARRAY,
GL_TEXTURE_3D,
GL_TEXTURE_CUBE_MAP,
GL_TEXTURE_RECTANGLE,
GL_TEXTURE_BUFFER,
};
int i;
bool pass = true;
for (i = 0; i < ARRAY_SIZE(targets); i++) {
glBindTexture(targets[i], 400 + i);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
pass = false;
}
return pass;
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:25,代码来源:genned-names.c
示例16: generate_grid_arrays
bool
generate_grid_arrays(GLuint *vao, GLuint *vbo,
float x, float y, float dx, float dy,
unsigned nx, unsigned ny)
{
float (*verts)[4] = malloc(sizeof(*verts) * nx * ny);
int i, j;
for (i = 0; i < nx; ++i) {
for (j = 0; j < ny; ++j) {
const unsigned k = (nx * (j & ~1) + 2 * (i & ~1) +
(i & 1) + 2 * (j & 1));
verts[k][0] = x + i * dx;
verts[k][1] = y + j * dy;
verts[k][2] = 0.0;
verts[k][3] = 1.0;
}
}
if (!*vao) {
glGenVertexArrays(1, vao);
glGenBuffers(1, vbo);
}
glBindVertexArray(*vao);
glBindBuffer(GL_ARRAY_BUFFER, *vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(*verts) * nx * ny,
verts, GL_STATIC_DRAW);
glVertexAttribPointer(PIGLIT_ATTRIB_POS, 4, GL_FLOAT,
GL_FALSE, 0, 0);
glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
free(verts);
return piglit_check_gl_error(GL_NO_ERROR);
}
开发者ID:Jul13t,项目名称:piglit,代码行数:36,代码来源:grid.c
示例17: check_subtest
static void
check_subtest(struct subtest *t)
{
int limit;
glGetIntegerv(t->limit, &limit);
if (t->use_texture) {
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, texture);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, limit+1,
t->internalformat, 64, 64, GL_TRUE);
} else {
GLuint rb;
glGenRenderbuffers(1, &rb);
glBindRenderbuffer(GL_RENDERBUFFER, rb);
glRenderbufferStorageMultisample(GL_RENDERBUFFER,
limit + 1, t->internalformat, 64, 64);
}
piglit_report_subtest_result(
piglit_check_gl_error(t->error) ? PIGLIT_PASS : PIGLIT_FAIL,
"%s", t->name);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:24,代码来源:negative-max-samples.c
示例18: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLuint prog;
int i;
piglit_require_extension("GL_ARB_geometry_shader4");
/* Create shader. */
prog = create_shader(vs_text, gs_text, fs_text);
for (i = 0; i < ARRAY_SIZE(primitives_out); i++) {
const struct primitive_geom_info p = primitives_out[i];
printf("Testing %s.\n", piglit_get_prim_name(p.type));
glProgramParameteri(prog, GL_GEOMETRY_OUTPUT_TYPE_ARB, p.type);
pass = piglit_check_gl_error(p.error) && pass;
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:24,代码来源:output-type.c
示例19: build_and_use_program
static void
build_and_use_program(GLint gs_invocation_n)
{
GLuint prog;
char *gs_text;
asprintf(&gs_text, gs_tmpl, gs_invocation_n);
prog = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_pass_thru_text,
GL_GEOMETRY_SHADER, gs_text, 0);
free(gs_text);
glTransformFeedbackVaryings(prog, ARRAY_SIZE(varyings), varyings,
GL_INTERLEAVED_ATTRIBS);
glLinkProgram(prog);
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
glUseProgram(prog);
}
开发者ID:Jul13t,项目名称:piglit,代码行数:24,代码来源:xfb-streams.c
示例20: build_and_use_program
static void
build_and_use_program(unsigned gs_invocation_n)
{
GLuint prog;
if (gs_invocation_n == 0) {
prog = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_two_sets_text, 0);
} else {
char *gs_text;
asprintf(&gs_text, gs_text_two_sets_tmpl, gs_invocation_n);
prog = piglit_build_simple_program_multiple_shaders(
GL_VERTEX_SHADER, vs_pass_thru_text,
GL_GEOMETRY_SHADER, gs_text, 0);
free(gs_text);
}
/**
* In the EXT-style the recorded varyings need to be set before linking.
*
* Also it should be noticed that when mixed mode is used, i.e., where
* one records multiple attributes per buffer but also uses separate
* buffers, the mode must be set to interleaved.
*/
glTransformFeedbackVaryings(prog, ARRAY_SIZE(varyings), varyings,
GL_INTERLEAVED_ATTRIBS);
glLinkProgram(prog);
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
glUseProgram(prog);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:36,代码来源:ext_interleaved_two_bufs.c
注:本文中的piglit_check_gl_error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论