本文整理汇总了C++中piglit_link_check_status函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_link_check_status函数的具体用法?C++ piglit_link_check_status怎么用?C++ piglit_link_check_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_link_check_status函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:RAOF,项目名称:piglit,代码行数:33,代码来源:sso-user-varying-01.c
示例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);
}
开发者ID:dcbaker,项目名称:piglit,代码行数:56,代码来源:rendezvous_by_location.c
示例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);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:35,代码来源:double-gettransformfeedbackvarying.c
示例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;
}
开发者ID:chemecse,项目名称:piglit,代码行数:25,代码来源:builtins.c
示例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);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:33,代码来源:pipeline_stats_geom.c
示例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);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:31,代码来源:glsl-explicit-location-01.c
示例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;
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:27,代码来源:xfb-streams.c
示例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);
}
开发者ID:nobled,项目名称:piglit,代码行数:33,代码来源:link-mismatch-layout-03.c
示例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);
}
开发者ID:chemecse,项目名称:piglit,代码行数:35,代码来源:transformfeedback-bufferbase.c
示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:27,代码来源:arb_es2_compatibility-releaseshadercompiler.c
示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:27,代码来源:glsl-vs-user-varying-ff.c
示例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);
}
开发者ID:chemecse,项目名称:piglit,代码行数:33,代码来源:pipeline_stats_vert_adj.c
示例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);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:60,代码来源:separate.c
示例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);
}
开发者ID:nobled,项目名称:piglit,代码行数:28,代码来源:glsl-fs-flat-color.c
示例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);
}
开发者ID:nobled,项目名称:piglit,代码行数:28,代码来源:overflow-edge-cases.c
示例16: piglit_init
void piglit_init(int argc, char **argv)
{
char *endptr;
GLuint vs, fs;
/* Interpret command line args */
if (argc != 2)
print_usage_and_exit(argv[0]);
endptr = argv[1];
additional_offset = strtoul(argv[1], &endptr, 0);
if (*endptr != '\0')
print_usage_and_exit(argv[0]);
if (additional_offset > 12 || additional_offset % 4 != 0)
print_usage_and_exit(argv[0]);
piglit_require_GLSL_version(130);
piglit_require_gl_version(30);
piglit_require_transform_feedback();
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext);
prog = piglit_CreateProgram();
piglit_AttachShader(prog, vs);
piglit_AttachShader(prog, fs);
piglit_TransformFeedbackVaryings(prog, 5, varyings,
GL_INTERLEAVED_ATTRIBS);
piglit_LinkProgram(prog);
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
glGenBuffers(1, &xfb_buf);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
开发者ID:blaztinn,项目名称:piglit,代码行数:32,代码来源:alignment.c
示例17: piglit_init
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
bool pass = true;
GLuint prog;
int i, j;
piglit_require_extension("GL_ARB_geometry_shader4");
/* NV_geometry_shader4 relaxes some restrictions on valid program
* parameters.
*/
piglit_require_not_extension("GL_NV_geometry_shader4");
/* Create shader. */
prog = create_shader(vs_text, gs_text, fs_text);
glProgramParameteri(prog, GL_GEOMETRY_VERTICES_OUT_ARB, 3);
for (i = 0; i < ARRAY_SIZE(primitives_in); i++) {
const struct primitive_geom_info geom = primitives_in[i];
if (geom.error != GL_NO_ERROR)
continue;
glProgramParameteri(prog, GL_GEOMETRY_INPUT_TYPE_ARB,
geom.type);
glLinkProgram(prog);
if (!piglit_link_check_status(prog) ||
!piglit_check_gl_error(GL_NO_ERROR)) {
piglit_report_result(PIGLIT_FAIL);
}
glUseProgram(prog);
glUniform1i(glGetUniformLocation(prog, "vertex_count"), 1);
for (j = 0; j < ARRAY_SIZE(primitives_draw); j++) {
const struct primitive_draw_info draw =
primitives_draw[j];
GLenum e;
printf("Testing drawing type %s, geometry input "
"type %s.\n",
piglit_get_prim_name(draw.type),
piglit_get_prim_name(geom.type));
if (draw.base_type == geom.type)
e = GL_NO_ERROR;
else
e = GL_INVALID_OPERATION;
glDrawArrays(draw.type, 0, 0);
pass = piglit_check_gl_error(e) && pass;
}
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:59,代码来源:input-type-draw.c
示例18: piglit_init
void
piglit_init(int argc, char **argv)
{
int i;
const struct test_set *test = NULL;
GLuint prog, vs, gs, vao, xfb_buf;
char *gs_text;
bool pass = true;
/* Parse params */
if (argc != 2)
print_usage_and_exit(argv[0]);
for (i = 0; i < ARRAY_SIZE(tests); i++) {
if (strcmp(piglit_get_prim_name(tests[i].prim_type),
argv[1]) == 0) {
test = &tests[i];
break;
}
}
if (test == NULL)
print_usage_and_exit(argv[0]);
/* Compile shaders */
prog = glCreateProgram();
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
glAttachShader(prog, vs);
(void)!asprintf(&gs_text, gs_template, test->input_layout,
test->vertices_per_prim);
gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gs_text);
free(gs_text);
glAttachShader(prog, gs);
glTransformFeedbackVaryings(prog, test->vertices_per_prim, varyings,
GL_INTERLEAVED_ATTRIBS);
glLinkProgram(prog);
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
glUseProgram(prog);
/* Set up other GL state */
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(1, &xfb_buf);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, xfb_buf);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER,
MAX_OUTPUT_VERTICES * sizeof(GLint), NULL,
GL_STREAM_READ);
glGenQueries(1, &generated_query);
glEnable(GL_RASTERIZER_DISCARD);
for (i = 0; i < ARRAY_SIZE(test->test_vectors); i++) {
pass = do_test_vector(test, &test->test_vectors[i]) && pass;
}
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:chemecse,项目名称:piglit,代码行数:55,代码来源:primitive-types.c
示例19: piglit_init
void
piglit_init(int argc, char **argv)
{
static const char *varyings[] = { "gl_Position", "gl_FrontColor" };
GLuint vs;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glScalef(0.5, 0.5, 1.0);
/* Check the driver. */
piglit_require_gl_version(15);
piglit_require_GLSL();
piglit_require_transform_feedback();
/* Create shaders. */
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
prog = glCreateProgram();
glAttachShader(prog, vs);
glTransformFeedbackVaryings(prog, 2, varyings,
GL_INTERLEAVED_ATTRIBS_EXT);
glLinkProgram(prog);
if (!piglit_link_check_status(prog)) {
glDeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
glUseProgram(prog);
/* Set up the vertex data buffer */
glGenBuffers(1, &vert_buf);
glBindBuffer(GL_ARRAY_BUFFER, vert_buf);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
/* Set up the transform feedback buffer. */
glGenBuffers(1, &xfb_buf);
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, xfb_buf);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
xfb_buf_size, NULL, GL_STREAM_READ);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, xfb_buf);
glClearColor(0.2, 0.2, 0.2, 1.0);
if (argc > 1 && strcmp(argv[1], "large") == 0) {
GLint range[2];
glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, range);
if (range[1] == 1.0) {
printf("Max point size is %d, can't test large\n",
range[1]);
piglit_report_result(PIGLIT_WARN);
}
printf("Testing large points\n");
glPointSize(10.0);
}
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:54,代码来源:points.c
示例20: piglit_init
void
piglit_init(int argc, char **argv)
{
GLuint vs;
int i;
/* Parse params. */
if (argc != 2)
print_usage_and_exit(argv[0]);
test_to_run = find_matching_test(argv[0], argv[1]);
/* Set up test */
piglit_require_GLSL_version(test_to_run->version);
piglit_require_transform_feedback();
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, test_to_run->vs);
prog = glCreateProgram();
glAttachShader(prog, vs);
glBindAttribLocation(prog, 0, "vertex_pos");
glBindAttribLocation(prog, 1, "vertex_num");
glTransformFeedbackVaryings(prog, test_to_run->num_varyings,
(const char **) test_to_run->varyings,
GL_INTERLEAVED_ATTRIBS_EXT);
glLinkProgram(prog);
if (!piglit_link_check_status(prog)) {
glDeleteProgram(prog);
piglit_report_result(PIGLIT_FAIL);
}
/* Test that GetTransformFeedbackVarying reports the correct
* size and type for all of the varyings.
*/
for (i = 0; i < test_to_run->num_varyings; ++i) {
GLsizei size;
GLenum type;
glGetTransformFeedbackVarying(prog, i, 0, NULL, &size,
&type, NULL);
if (size != test_to_run->expected_size) {
printf("For varying %i, expected size %i, got %i\n",
i, test_to_run->expected_size, size);
size_and_type_ok = GL_FALSE;
}
if (type != test_to_run->expected_type) {
printf("For varying %i, expected type %i, got %i\n",
i, test_to_run->expected_type, type);
size_and_type_ok = GL_FALSE;
}
}
glGenBuffers(1, &xfb_buf);
glGenQueries(1, &query);
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
}
开发者ID:janesma,项目名称:piglit,代码行数:52,代码来源:builtin-varyings.c
注:本文中的piglit_link_check_status函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论