本文整理汇总了C++中piglit_link_check_status函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_link_check_status函数的具体用法?C++ piglit_link_check_status怎么用?C++ piglit_link_check_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_link_check_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: piglit_init
void
piglit_init(int argc, char **argv)
{
GLboolean try_to_render;
GLuint vs;
GLuint fs;
piglit_require_gl_version(20);
piglit_require_extension("GL_EXT_separate_shader_objects");
glClearColor(0.3, 0.3, 0.3, 0.0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
prog[0] = piglit_link_simple_program(vs, 0);
prog[1] = piglit_link_simple_program(0, fs);
glDeleteShader(vs);
glDeleteShader(fs);
/* Don't try to render if either program failed to link, and linking
* had better succeed!
*/
try_to_render = piglit_link_check_status(prog[0]);
try_to_render = piglit_link_check_status(prog[1])
&& try_to_render;
if (!try_to_render)
piglit_report_result(PIGLIT_FAIL);
}
示例2: piglit_init
void piglit_init(int argc, char **argv)
{
unsigned glsl_version;
GLuint vs_prog;
GLuint fs_prog_same_declaration_order;
GLuint fs_prog_same_location_order;
char *source;
piglit_require_vertex_shader();
piglit_require_fragment_shader();
piglit_require_extension("GL_ARB_separate_shader_objects");
piglit_require_extension("GL_ARB_explicit_attrib_location");
glsl_version = pick_a_glsl_version();
(void)!asprintf(&source, vs_code_template, glsl_version);
vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
(const GLchar *const *) &source);
piglit_link_check_status(vs_prog);
free(source);
(void)!asprintf(&source, fs_code_same_declaration_order_template, glsl_version);
fs_prog_same_declaration_order =
glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
(const GLchar *const *) &source);
piglit_link_check_status(fs_prog_same_declaration_order);
free(source);
(void)!asprintf(&source, fs_code_same_location_order_template, glsl_version);
fs_prog_same_location_order =
glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
(const GLchar *const *) &source);
piglit_link_check_status(fs_prog_same_location_order);
free(source);
glGenProgramPipelines(1, &pipeline_same_declaration_order);
glUseProgramStages(pipeline_same_declaration_order,
GL_VERTEX_SHADER_BIT,
vs_prog);
glUseProgramStages(pipeline_same_declaration_order,
GL_FRAGMENT_SHADER_BIT,
fs_prog_same_declaration_order);
piglit_program_pipeline_check_status(pipeline_same_declaration_order);
glGenProgramPipelines(1, &pipeline_same_location_order);
glUseProgramStages(pipeline_same_location_order,
GL_VERTEX_SHADER_BIT,
vs_prog);
glUseProgramStages(pipeline_same_location_order,
GL_FRAGMENT_SHADER_BIT,
fs_prog_same_location_order);
piglit_program_pipeline_check_status(pipeline_same_location_order);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
示例3: run_test
void run_test(struct get_tests *test)
{
GLsizei size;
GLenum type;
GLuint vs;
GLuint prog;
char vstest[1024];
snprintf(vstest, 1024, vstext, test->glsltype, test->glsltype);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstest);
prog = glCreateProgram();
glAttachShader(prog, vs);
glBindAttribLocation(prog, 0, "vertex");
glTransformFeedbackVaryings(prog, ARRAY_SIZE(varyings),
varyings,
GL_INTERLEAVED_ATTRIBS_EXT);
glLinkProgram(prog);
if (!piglit_link_check_status(prog)) {
glDeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
glGetTransformFeedbackVarying(prog, 0, 0, NULL, &size,
&type, NULL);
if (size != test->size) {
printf("For %s, size %d vs %d\n", test->glsltype, size, test->size);
size_and_type_ok = false;
}
if (type != test->type) {
printf("For %s, size %d vs %d\n", test->glsltype, type, test->type);
size_and_type_ok = false;
}
glDeleteProgram(prog);
}
示例4: compile_simple_program
PIGLIT_GL_TEST_CONFIG_END
bool compile_simple_program(const char* vs_text, const char* fs_text)
{
GLuint vs;
GLuint fs;
GLuint prog;
bool status;
prog = glCreateProgram();
vs = piglit_compile_shader_text_nothrow(GL_VERTEX_SHADER, vs_text);
fs = piglit_compile_shader_text_nothrow(GL_FRAGMENT_SHADER, fs_text);
if (!vs || !fs)
return false;
glAttachShader(prog, vs);
glAttachShader(prog, fs);
glLinkProgram(prog);
status = piglit_link_check_status(prog);
glDeleteProgram(prog);
return status;
}
示例5: 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);
}
示例6: 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);
}
示例7: build_and_use_program
static bool
build_and_use_program(GLint gs_invocation_n, const char *gs_template,
const char **gs_varyings, int array_size)
{
GLuint prog;
char *gs_text;
asprintf(&gs_text, gs_template, 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, gs_varyings,
GL_INTERLEAVED_ATTRIBS);
glLinkProgram(prog);
if (!piglit_link_check_status(prog))
return false;
if (!piglit_check_gl_error(GL_NO_ERROR))
return false;
glUseProgram(prog);
return true;
}
示例8: piglit_init
void
piglit_init(int argc, char **argv)
{
GLint ok;
GLuint prog;
GLuint fs[2];
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
piglit_require_extension("GL_ARB_fragment_coord_conventions");
fs[0] = piglit_compile_shader_text(GL_FRAGMENT_SHADER, layout_center);
fs[1] = piglit_compile_shader_text(GL_FRAGMENT_SHADER, layout_upper);
prog = glCreateProgram();
glAttachShader(prog, fs[0]);
glAttachShader(prog, fs[1]);
glLinkProgram(prog);
glDeleteShader(fs[0]);
glDeleteShader(fs[1]);
ok = piglit_link_check_status(prog);
if (!ok) {
fprintf(stderr,
"Linking with gl_FragCoord layouts "
"failed when it should have succeeded.\n");
piglit_report_result(PIGLIT_FAIL);
}
piglit_report_result(PIGLIT_PASS);
}
示例9: piglit_init
void
piglit_init(int argc, char **argv)
{
static const char *varyings[] = { "valOut1", "valOut2" };
GLint inAttrib;
/* Check the driver. */
piglit_require_extension("GL_ARB_transform_feedback3");
piglit_require_extension("GL_ARB_direct_state_access");
/* Create shaders. */
prog = piglit_build_simple_program_unlinked(vstext, NULL);
glTransformFeedbackVaryings(prog, 2, varyings,
GL_SEPARATE_ATTRIBS);
glLinkProgram(prog);
if (!piglit_link_check_status(prog)) {
glDeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
glUseProgram(prog);
/* Set up the Vertex Array Buffer */
glEnable(GL_VERTEX_ARRAY);
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
/* Set up the input data buffer */
glGenBuffers(1, &input_buf);
glBindBuffer(GL_ARRAY_BUFFER, input_buf);
glBufferData(GL_ARRAY_BUFFER, sizeof(inputs), inputs, GL_STATIC_DRAW);
inAttrib = glGetAttribLocation(prog, "valIn");
piglit_check_gl_error(GL_NO_ERROR);
glVertexAttribPointer(inAttrib, 1, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(inAttrib);
}
示例10: draw
void
draw(const float *color, float x_offset)
{
GLuint vs, fs, prog;
GLint color_location;
GLint offset_location;
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
prog = piglit_link_simple_program(vs, fs);
glBindAttribLocation(prog, 0, "vertex");
glLinkProgram(prog);
piglit_link_check_status(prog);
glDeleteShader(vs);
glDeleteShader(fs);
glUseProgram(prog);
color_location = glGetUniformLocation(prog, "color");
offset_location = glGetUniformLocation(prog, "offset");
glUniform4fv(color_location, 1, color);
glUniform4f(offset_location, x_offset, 0.0f, 0.0f, 0.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDeleteProgram(prog);
}
示例11: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs;
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
glClearColor(0.3, 0.3, 0.3, 0.0);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
prog = piglit_link_simple_program(vs, 0);
glDeleteShader(vs);
/* 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);
}
示例12: piglit_init
void
piglit_init(int argc, char *argv[])
{
GLuint prog, array, buf;
glGenVertexArrays(1, &array);
glBindVertexArray(array);
glGenBuffers(1, &buf);
glBindBuffer(GL_ARRAY_BUFFER, buf);
prog = piglit_build_simple_program(vs_src, fs_src);
glVertexAttribPointer(0, /* index */
4, /* size */
GL_FLOAT, /* type */
GL_FALSE, /* normalized */
0, /* stride */
NULL /* pointer */);
glEnableVertexAttribArray(0);
#ifndef DISPLAY
glEnable(GL_RASTERIZER_DISCARD);
#endif
do_query_init(queries, ARRAY_SIZE(queries));
if (!piglit_link_check_status(prog)) {
glDeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
glUseProgram(prog);
}
示例13: piglit_init
void piglit_init(int argc, char **argv)
{
GLuint vs;
GLint maxcomps, maxattrs;
unsigned i;
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
/* Check the driver. */
if (piglit_get_gl_version() < 15) {
fprintf(stderr, "OpenGL 1.5 required.\n");
piglit_report_result(PIGLIT_SKIP);
}
piglit_require_GLSL();
piglit_require_transform_feedback();
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT, &maxattrs);
if (maxattrs < 4) {
fprintf(stderr, "Not enough separate attribs supported by transform feedback.\n");
piglit_report_result(PIGLIT_SKIP);
}
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT, &maxcomps);
if (maxcomps < 4) {
fprintf(stderr, "Not enough separate components supported by transform feedback.\n");
piglit_report_result(PIGLIT_SKIP);
}
/* Create shaders. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
prog = piglit_CreateProgram();
piglit_AttachShader(prog, vs);
piglit_TransformFeedbackVaryings(prog, sizeof(varyings)/sizeof(varyings[0]),
varyings, GL_SEPARATE_ATTRIBS_EXT);
piglit_LinkProgram(prog);
if (!piglit_link_check_status(prog)) {
piglit_DeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
/* Set up the transform feedback buffer. */
glGenBuffers(4, buf);
for (i = 0; i < 4; i++) {
unsigned j;
float *ptr;
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, buf[i]);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
NUM_OUT_VERTICES*4*sizeof(float), NULL, GL_STREAM_READ);
ptr = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, GL_WRITE_ONLY);
for (j = 0; j < NUM_OUT_VERTICES*4; j++) {
ptr[j] = 0.123456;
}
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, i, buf[i]);
}
assert(glGetError() == 0);
glClearColor(0.2, 0.2, 0.2, 1.0);
glEnableClientState(GL_VERTEX_ARRAY);
}
示例14: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs, fs;
if (piglit_get_gl_version() < 20) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
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);
}
示例15: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs;
int num_varyings;
piglit_require_GLSL();
piglit_require_transform_feedback();
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
for (num_varyings = 1; num_varyings <= 2; ++num_varyings) {
GLuint prog = piglit_CreateProgram();
piglit_AttachShader(prog, vs);
piglit_BindAttribLocation(prog, 0, "vertex_num");
piglit_TransformFeedbackVaryings(prog, num_varyings, varyings,
GL_INTERLEAVED_ATTRIBS);
piglit_LinkProgram(prog);
if (!piglit_link_check_status(prog)) {
piglit_DeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
progs[num_varyings - 1] = prog;
}
glGenBuffers(1, &xfb_buf);
glGenQueries(1, &query_prims_generated);
glGenQueries(1, &query_prims_written);
}