void piglit_init(int argc, char **argv) { piglit_require_gl_version(20); piglit_require_GLSL_version(120); piglit_require_transform_feedback(); init_xfb_varying_array(); glGenBuffers(1, &xfb_buf); printf("Vertical axis: Increasing numbers of varyings captured by " "transform feedback.\n"); printf("Horizontal axis: Offset of first varying captured.\n"); }
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); }
void piglit_init(int argc, char **argv) { const struct test_desc *test; /* Parse params. */ if (argc != 2) print_usage_and_exit(argv[0]); test = find_matching_test(argv[0], argv[1]); piglit_require_GLSL(); piglit_require_transform_feedback(); piglit_report_result(do_test(test) ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { int i; /* Set up test */ piglit_require_GLSL_version(150); piglit_require_transform_feedback(); piglit_require_extension("GL_ARB_gpu_shader_fp64"); for (i = 0; i < ARRAY_SIZE(tests); i++) run_test(&tests[i]); if (size_and_type_ok == false) piglit_report_result(PIGLIT_FAIL); piglit_report_result(PIGLIT_PASS); }
void piglit_init(int argc, char **argv) { GLuint vs, i; GLint maxcomps; float *ptr; /* Check the driver. */ piglit_require_transform_feedback(); piglit_require_extension("GL_ARB_gpu_shader_fp64"); piglit_require_extension("GL_ARB_transform_feedback3"); glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT, &maxcomps); if (maxcomps < 18) { fprintf(stderr, "Not enough interleaved components supported by transform feedback.\n"); piglit_report_result(PIGLIT_SKIP); } /* Create shaders. */ vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); prog = glCreateProgram(); glAttachShader(prog, vs); glTransformFeedbackVaryings(prog, sizeof(varyings)/sizeof(varyings[0]), varyings, GL_INTERLEAVED_ATTRIBS_EXT); glLinkProgram(prog); if (!piglit_link_check_status(prog)) { glDeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } /* Set up the transform feedback buffer. */ glGenBuffers(1, &buf); glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, buf); glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, TOTAL_BUF_COMPONENTS*sizeof(float), NULL, GL_STREAM_READ); ptr = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, GL_WRITE_ONLY); for (i = 0; i < TOTAL_BUF_COMPONENTS; i++) { ptr[i] = 0.123456; } glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT); glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf); if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); glClearColor(0.2, 0.2, 0.2, 1.0); }
void piglit_init(int argc, char **argv) { const struct test_desc *test; /* Parse params. */ if (argc != 2) print_usage_and_exit(argv[0]); test = find_matching_test(argv[0], argv[1]); piglit_require_GLSL(); piglit_require_transform_feedback(); if (test->bind_mode == OFFSET) { /* BindBufferOffset only exists in the EXT specification */ piglit_require_extension("GL_EXT_transform_feedback"); } piglit_report_result(do_test(test) ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { float verts[] = { -1, -1, 1, -1, 1, 1, -1, 1 }; GLuint vbo, xfb, vs, fs, prog; const char *varying = "gl_Position"; piglit_require_extension("GL_EXT_transform_feedback"); piglit_require_gl_version(30); piglit_require_transform_feedback(); glGenBuffersARB(1, &vbo); glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo); glBufferDataARB(GL_ARRAY_BUFFER_ARB, 8 * sizeof(float), verts, GL_DYNAMIC_DRAW); glGenBuffersARB(1, &xfb); glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, xfb); glBufferDataARB(GL_TRANSFORM_FEEDBACK_BUFFER, 4096, NULL, GL_DYNAMIC_DRAW); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source); fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source); prog = glCreateProgram(); glAttachShader(prog, vs); glAttachShader(prog, fs); glTransformFeedbackVaryings(prog, 1, &varying, GL_INTERLEAVED_ATTRIBS); glLinkProgram(prog); if (!fs || !vs || !prog) piglit_report_result(PIGLIT_FAIL); if (!piglit_link_check_status(prog)) piglit_report_result(PIGLIT_FAIL); glUseProgram(prog); glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, xfb, 0, 4096); }
static void initialize_shader_and_xfb() { GLuint prog, vs; const char *varying = "tf"; piglit_require_gl_version(30); piglit_require_GLSL_version(130); piglit_require_transform_feedback(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); prog = piglit_CreateProgram(); piglit_AttachShader(prog, vs); piglit_TransformFeedbackVaryings(prog, 1, &varying, GL_INTERLEAVED_ATTRIBS); piglit_LinkProgram(prog); if (!piglit_link_check_status(prog)) { piglit_DeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } piglit_UseProgram(prog); }
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); }
void piglit_init(int argc, char **argv) { if (argc != 2) print_usage_and_exit(argv[0]); if (strcmp(argv[1], "discard") == 0) discard = GL_TRUE; else if (strcmp(argv[1], "buffer") == 0) buffer = GL_TRUE; else if (strcmp(argv[1], "prims_written") == 0) prims_written = GL_TRUE; else if (strcmp(argv[1], "prims_generated") == 0) prims_generated = GL_TRUE; else print_usage_and_exit(argv[0]); piglit_require_transform_feedback(); if (buffer || prims_written) { GLuint vs; piglit_require_GLSL(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); xfb_prog = glCreateProgram(); glAttachShader(xfb_prog, vs); glTransformFeedbackVaryings(xfb_prog, 1, xfb_varyings, GL_INTERLEAVED_ATTRIBS); glLinkProgram(xfb_prog); if (!piglit_link_check_status(xfb_prog)) { piglit_report_result(PIGLIT_FAIL); } glGenBuffers(1, &xfb_buf); } if (prims_written) { glGenQueries(1, &prims_written_query); } if (prims_generated) { glGenQueries(1, &prims_generated_query); } }
void piglit_init(int argc, char **argv) { GLuint vs, fs; /* Interpret command line args */ if (argc != 2) print_usage_and_exit(argv[0]); if (strcmp(argv[1], "output") == 0) test_mode = TEST_MODE_OUTPUT; else if (strcmp(argv[1], "prims_generated") == 0) test_mode = TEST_MODE_PRIMS_GENERATED; else if (strcmp(argv[1], "prims_written") == 0) test_mode = TEST_MODE_PRIMS_WRITTEN; else print_usage_and_exit(argv[0]); piglit_require_GLSL(); piglit_require_transform_feedback(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext); prog = glCreateProgram(); glAttachShader(prog, vs); glAttachShader(prog, fs); glBindAttribLocation(prog, 0, "in_position"); glBindAttribLocation(prog, 1, "in_color"); glTransformFeedbackVaryings(prog, 2, varyings, GL_INTERLEAVED_ATTRIBS); glLinkProgram(prog); if (!piglit_link_check_status(prog)) { glDeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } glGenBuffers(1, &xfb_buf); glGenQueries(1, &query); }
void piglit_init(int argc, char **argv) { GLuint vs, fs; piglit_require_GLSL(); piglit_require_transform_feedback(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext); prog = glCreateProgram(); glAttachShader(prog, vs); glAttachShader(prog, fs); glBindAttribLocation(prog, 0, "in_position"); glBindAttribLocation(prog, 1, "in_color"); glTransformFeedbackVaryings(prog, 2, varyings, GL_INTERLEAVED_ATTRIBS); glLinkProgram(prog); if (!piglit_link_check_status(prog)) { glDeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } glGenBuffers(2, bufs); }
void piglit_init(int argc, char **argv) { piglit_require_transform_feedback(); }
void piglit_init(int argc, char **argv) { GLuint vs; GLuint *readback; GLuint buffer[BUFFER_SIZE]; GLuint expected[BUFFER_SIZE]; int i; bool pass = true; GLint input_index; GLuint prog; GLuint xfb_buf, vbo; GLuint verts[4] = { 0, 1, 2, 3 }; const char *varying = "o"; piglit_require_GLSL_version(140); piglit_require_gl_version(30); piglit_require_transform_feedback(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source); prog = glCreateProgram(); glAttachShader(prog, vs); glTransformFeedbackVaryings(prog, 1, &varying, GL_INTERLEAVED_ATTRIBS); glLinkProgram(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); input_index = glGetAttribLocation(prog, "i"); glUseProgram(prog); if (piglit_get_gl_version() >= 31) { GLuint vao; glGenVertexArrays(1, &vao); glBindVertexArray(vao); } glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(GLuint), verts, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, vbo); glVertexAttribIPointer(input_index, 1, GL_UNSIGNED_INT, sizeof(GLuint), 0); glEnableVertexAttribArray(input_index); pass = piglit_check_gl_error(0) && pass; glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, xfb_buf); memset(buffer, 0xd0, sizeof(buffer)); glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, sizeof(buffer), buffer, GL_STREAM_READ); glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, xfb_buf, 0, sizeof(buffer)); glBeginTransformFeedback(GL_POINTS); glDrawArrays(GL_POINTS, 0, ARRAY_SIZE(verts)); glEndTransformFeedback(); readback = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, GL_READ_ONLY); /* Check output */ for (i = 0; i < BUFFER_SIZE; ++i) { if (verts[i] != readback[i]) { printf("readback[%u]: %u, expected: %u\n", i, readback[i], expected[i]); pass = false; } } /* Note that rasterization occurred, but the results were * undefined due to gl_Position not being written. We do want * to have rasterization occur (as opposed to just transform * feedback) just to make sure the GPU didn't wedge or * anything. */ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLuint vs; unsigned i,j; int maxcomps; float *data; /* Parse params. */ for (i = 1; i < argc; i++) { struct test_desc *t; for (t = tests; t->name; t++) { if (!strcmp(argv[i], t->name)) { test = t; goto test_ready; } } fprintf(stderr, "Unknown test name.\n"); exit(1); } test = &tests[0]; test_ready: printf("Testing type: %s\n", test->name); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); /* Check the driver. */ piglit_require_gl_version(15); piglit_require_GLSL(); piglit_require_transform_feedback(); if (!test->is_floating_point) piglit_require_GLSL_version(130); if (test->is_transform_feedback3) piglit_require_extension("GL_ARB_transform_feedback3"); glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, &maxcomps); for (i = 0; i < MAX_BUFFERS; i++) { if (maxcomps < test->num_elements[i]) { piglit_report_result(PIGLIT_SKIP); } } /* Create shaders. */ vs = piglit_compile_shader_text(GL_VERTEX_SHADER, test->vs); prog = glCreateProgram(); glAttachShader(prog, vs); glTransformFeedbackVaryings(prog, test->num_varyings, test->varyings, GL_INTERLEAVED_ATTRIBS_EXT); glLinkProgram(prog); if (!piglit_link_check_status(prog)) { glDeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } glGenBuffers(MAX_BUFFERS, buf); for (j = 0; j < MAX_BUFFERS; j++) { if (!test->num_elements[j]) { continue; } if (test->is_transform_feedback3) { GLint maxbufs; glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, &maxbufs); if (j >= maxbufs) { piglit_report_result(PIGLIT_SKIP); } } /* Set up the transform feedback buffer. */ data = malloc(test->num_elements[j]*NUM_VERTICES*sizeof(float)); for (i = 0; i < test->num_elements[j]*NUM_VERTICES; i++) { data[i] = DEFAULT_VALUE; } glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, buf[j]); glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, test->num_elements[j]*NUM_VERTICES*sizeof(float), data, GL_STREAM_READ); if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, j, buf[j]); if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); free(data); } glClearColor(0.2, 0.2, 0.2, 1.0); glEnableClientState(GL_VERTEX_ARRAY); }
void piglit_init(int argc, char **argv) { static const char *varyings[] = {"x"}; GLuint buffers[3]; GLuint vao; GLuint prog; GLuint queries[4]; GLuint xfb[2]; bool pass = true; #ifdef PIGLIT_USE_OPENGL piglit_require_transform_feedback(); piglit_require_GLSL_version(130); piglit_require_extension("GL_ARB_vertex_array_object"); piglit_require_extension("GL_ARB_transform_feedback2"); #endif /* This is all just the boot-strap work for the test. */ glGenTransformFeedbacks(ARRAY_SIZE(xfb), xfb); glGenBuffers(ARRAY_SIZE(buffers), buffers); glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buffers[0]); glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 1024, NULL, GL_STREAM_READ); glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buffers[1]); glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 1024, NULL, GL_STREAM_READ); glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0); glGenVertexArrays(1, &vao); glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, buffers[2]); glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW); glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 1 * sizeof(GLfloat), 0); glEnableVertexAttribArray(0); glGenQueries(ARRAY_SIZE(queries), queries); prog = piglit_build_simple_program_unlinked(vstext, fstext); glTransformFeedbackVaryings(prog, 1, varyings, GL_INTERLEAVED_ATTRIBS); glLinkProgram(prog); if (!piglit_link_check_status(prog)) { pass = false; goto done; } glUseProgram(prog); glEnable(GL_RASTERIZER_DISCARD); /* Here's the actual test. */ glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, xfb[0]); glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buffers[0]); glBeginTransformFeedback(GL_POINTS); glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, queries[0]); glDrawArrays(GL_POINTS, 0, 4); glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); glPauseTransformFeedback(); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, xfb[1]); glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buffers[1]); glBeginTransformFeedback(GL_POINTS); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, queries[1]); glDrawArrays(GL_POINTS, 4, 2); glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); glPauseTransformFeedback(); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, xfb[0]); glResumeTransformFeedback(); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, queries[2]); glDrawArrays(GL_POINTS, 6, 4); glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); glEndTransformFeedback(); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, xfb[1]); glResumeTransformFeedback(); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, queries[3]); glDrawArrays(GL_POINTS, 10, 2); glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); glEndTransformFeedback(); pass = piglit_check_gl_error(GL_NO_ERROR) && pass; glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0); glBindVertexArray(0); /* The first XFB should have 8 primitives generated, and the buffer * object should contain the values {1.0, 2.0, 3.0, 4.0, 7.0, 8.0, * 9.0, 10.0}. */ { static const float expected_xfb_data[] = { 1.0, 2.0, 3.0, 4.0, 7.0, 8.0, 9.0, 10.0 }; glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); pass = check_results(1, ARRAY_SIZE(expected_xfb_data), expected_xfb_data, queries[0], queries[2]) && pass; } /* The second XFB should have 4 primitives generated, and the buffer * object should contain the values {5.0, 6.0, 11.0, 12.0}. */ { static const float expected_xfb_data[] = { 5.0, 6.0, 11.0, 12.0 }; glBindBuffer(GL_ARRAY_BUFFER, buffers[1]); pass = check_results(2, ARRAY_SIZE(expected_xfb_data), expected_xfb_data, queries[1], queries[3]) && pass; } glBindBuffer(GL_ARRAY_BUFFER, 0); done: glBindVertexArray(0); glDeleteVertexArrays(1, &vao); glDeleteBuffers(ARRAY_SIZE(buffers), buffers); glDeleteQueries(ARRAY_SIZE(queries), queries); glDeleteTransformFeedbacks(ARRAY_SIZE(xfb), xfb); glUseProgram(0); glDeleteProgram(prog); piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLuint vs; unsigned i; float data[BUF_FLOATS]; for (i = 0; i < BUF_FLOATS; i++) { data[i] = DEFAULT_VALUE; } /* Parse params. */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "discard")) { discard = GL_TRUE; } else if (!strcmp(argv[i], "offset")) { /* BindBufferOffset only exists in the EXT specification */ piglit_require_extension("GL_EXT_transform_feedback"); offset = OFFSET; } else if (!strcmp(argv[i], "range")) { offset = OFFSET; range = MAX_RANGE-7; } else if (!strcmp(argv[i], "render")) { test = RENDER; } else if (!strcmp(argv[i], "primgen")) { test = PRIMGEN; } else if (!strcmp(argv[i], "primwritten")) { test = PRIMWRITTEN; } } 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(); /* Create shaders. */ vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); prog = piglit_CreateProgram(); piglit_AttachShader(prog, vs); piglit_TransformFeedbackVaryings(prog, 1, varyings, GL_INTERLEAVED_ATTRIBS_EXT); piglit_LinkProgram(prog); if (!piglit_link_check_status(prog)) { piglit_DeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vspassthrough); prog_passthrough = piglit_CreateProgram(); piglit_AttachShader(prog_passthrough, vs); piglit_TransformFeedbackVaryings(prog_passthrough, 1, varyings, GL_INTERLEAVED_ATTRIBS_EXT); piglit_LinkProgram(prog_passthrough); if (!piglit_link_check_status(prog_passthrough)) { piglit_DeleteProgram(prog_passthrough); piglit_report_result(PIGLIT_FAIL); } /* Set up the transform feedback buffer. */ glGenBuffers(1, &buf); glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, buf); glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, BUF_FLOATS*sizeof(float), data, GL_STREAM_READ); assert(glGetError() == 0); if (range) { puts("Testing BindBufferRange."); piglit_BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf, offset*sizeof(float), range*sizeof(float)); } else if (offset) { puts("Testing BindBufferOffset."); glBindBufferOffsetEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf, offset*sizeof(float)); } else { puts("Testing BindBufferBase."); piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf); } if (!range) { range = MAX_RANGE; } else { range = MAX_RANGE/2; /* just one primitive is going to be written */ } assert(glGetError() == 0); glClearColor(0.2, 0.2, 0.2, 1.0); glEnableClientState(GL_VERTEX_ARRAY); }