[Piglit] [PATCH v3 5/5] arb_transform_feedback2: Misc. API error checks
Paul Berry
stereotype441 at gmail.com
Mon Oct 21 20:46:11 CEST 2013
On 15 October 2013 17:32, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This covers most of the errors mentioned in the spec that aren't
> already covered in cannot-bind-when-active.c and gen-names-only.c.
> Most of the other errors should be covered by existing
> EXT_transform_feedback tests.
>
> Mesa currently passes all of these tests.
>
> NVIDIA (304.64 on GTX 260) fails several subtests.
>
> Pause active feedback only: Incorrectly generates error in
> glEndTransformFeedback.
>
> TransformFeedbackVaryings only when inactive: Doesn't generate any
> errors when it should.
>
> Draw only from "ended" object: Generates GL_INVALID_VALUE instead
> of GL_INVALID_OPERATION.
>
> AMD has not been tested.
>
> v2: Convert to use piglit subtest reporting. Fix fs_only_prog to
> actually only have a fragment shader attached.
>
> v3: Quite significant re-write. Per Paul's suggestion, each of the
> tests is no a subtest that can be individually selected from the command
> line. This uses infrastructure in piglit-framework-gl to handle the
> subtests. This also eliminates the work-around for NVIDIA's
> glEndTransformFeedback-while-paused bug.
>
> The code currently in all.tests for getting the list of subtests is
> just a place holder. We'll want to refactor this out somewhere else
> before pushing.
>
Agreed.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: Paul Berry <stereotype441 at gmail.com>
> Cc: Dylan Baker <baker.dylan.c at gmail.com>
> ---
> tests/all.tests | 9 +
> .../spec/arb_transform_feedback2/CMakeLists.gl.txt | 1 +
> tests/spec/arb_transform_feedback2/api-errors.c | 685
> +++++++++++++++++++++
> 3 files changed, 695 insertions(+)
> create mode 100644 tests/spec/arb_transform_feedback2/api-errors.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 952b0c9..6763bfe 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -6,6 +6,7 @@ import os
> import os.path as path
> import platform
> import shlex
> +import subprocess
>
> from framework.core import Group, TestProfile
> from framework.exectest import PlainExecTest
> @@ -2332,6 +2333,14 @@ arb_transform_feedback2['draw-auto'] =
> PlainExecTest(['arb_transform_feedback2-d
> arb_transform_feedback2['istranformfeedback'] =
> PlainExecTest(['arb_transform_feedback2-istransformfeedback', '-auto'])
> arb_transform_feedback2['glGenTransformFeedbacks names only'] =
> concurrent_test('arb_transform_feedback2-gen-names-only')
> arb_transform_feedback2['cannot bind when another object is active'] =
> concurrent_test('arb_transform_feedback2-cannot-bind-when-active')
> +
> +process = subprocess.Popen([path.join(testBinDir,
> 'arb_transform_feedback2-api-errors'), '-list-subtests'],
> stdout=subprocess.PIPE)
> +
> +arb_transform_feedback2['misc. API error checks'] = {}
> +for line in process.stdout:
> + [option, name] = line.split(":")
> + arb_transform_feedback2['misc. API error checks'][name.strip()] =
> concurrent_test('arb_transform_feedback2-api-errors -subtest
> {0}'.format(option.strip()))
>
Assuming this is going to get refactored into some more general-purpose
code: if someone ever creates a subtest whose name contains a whitespace
character, this will die in a not-very-obvious-to-debug fire. Can we add
something like this to make debugging easier?
[option, name] = line.split(":")
option = option.strip()
if any(x.isspace() for x in option):
raise Exception('Subtest must not contain a space:
{0!r}'.format(option))
> +
> arb_transform_feedback2['misc. API queries'] =
> concurrent_test('arb_transform_feedback2-api-queries')
> arb_transform_feedback2['counting with pause'] =
> concurrent_test('arb_transform_feedback2-pause-counting')
>
> diff --git a/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt
> b/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt
> index c6287a1..3d74f91 100644
> --- a/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt
> @@ -9,6 +9,7 @@ link_libraries (
> ${OPENGL_glu_LIBRARY}
> )
>
> +piglit_add_executable (arb_transform_feedback2-api-errors api-errors.c)
> piglit_add_executable (arb_transform_feedback2-api-queries api-queries.c)
> piglit_add_executable (arb_transform_feedback2-cannot-bind-when-active
> cannot-bind-when-active.c)
> piglit_add_executable
> (arb_transform_feedback2-change-objects-while-paused
> change-objects-while-paused.c)
> diff --git a/tests/spec/arb_transform_feedback2/api-errors.c
> b/tests/spec/arb_transform_feedback2/api-errors.c
> new file mode 100644
> index 0000000..dd239d8
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback2/api-errors.c
> @@ -0,0 +1,685 @@
> +/*
> + * Copyright © 2012 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> next
> + * paragraph) shall be included in all copies or substantial portions of
> the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +/**
> + * \file api-errors.c
> + * Verify a handful of error conditions required by the spec.
> + *
> + * None of these subtests is large enough to warrant a separate test case.
> + */
> +#include "piglit-util-gl-common.h"
> +
> +static enum piglit_result delete_inactive_only(void);
> +static enum piglit_result paired_begin_end(void);
> +static enum piglit_result pause_active_only(void);
> +static enum piglit_result resume_paused_only(void);
> +static enum piglit_result vertex_shader_required(void);
> +static enum piglit_result change_varyings_inactive_only(void);
> +static enum piglit_result change_program_inactive_or_paused(void);
> +static enum piglit_result link_program_inactive_only(void);
> +static enum piglit_result resume_same_program_only(void);
> +static enum piglit_result draw_from_valid_object_only(void);
> +static enum piglit_result draw_from_ended_object_only(void);
> +
> +static const struct piglit_gl_subtest subtests[] = {
> + {
> + "Paired begin and end",
> + "paired-begin-end",
> + paired_begin_end
> + },
> + {
> + "Pause active feedback only",
> + "pause-active-only",
> + pause_active_only
> + },
> + {
> + "Resume paused feedback only",
> + "resume-paused-only",
> + resume_paused_only
> + },
> + {
> + "Vertex shader required",
> + "vertex-shader-required",
> + vertex_shader_required
> + },
> + {
> + "TransformFeedbackVaryings only when inactive",
> + "change-varyings-inactive-only",
> + change_varyings_inactive_only
> + },
> + {
> + "Change program only when inactive or paused",
> + "change-program-inactive-or-paused",
> + change_program_inactive_or_paused
> + },
> + {
> + "Link program only when inactive",
> + "link-program-inactive-only",
> + link_program_inactive_only
> + },
> + {
> + "Resume with the same program only",
> + "resume-same-program-only",
> + resume_same_program_only
> + },
> + {
> + "Draw only from valid object",
> + "draw-from-valid-object-only",
> + draw_from_valid_object_only
> + },
> + {
> + "Draw only from ended object",
> + "draw-from-ended-object-only",
> + draw_from_ended_object_only
> + },
> + {
> + /* Do this one last. If it fails, it will delete the
> object
> + * and cause all of the othere subtests to fail.
> + */
> + "Cannot delete while active",
> + "delete-inactive-only",
> + delete_inactive_only
> + },
> + {
> + NULL,
> + NULL,
> + NULL
> + }
> +};
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> + config.window_visual = PIGLIT_GL_VISUAL_RGB;
> + config.subtests = subtests;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + return PIGLIT_FAIL;
> +}
> +
> +static const char vstext[] =
> + "varying vec4 x;\n"
> + "varying vec4 y;\n"
> + "void main()\n"
> + "{\n"
> + " gl_Position = vec4(0);\n"
> + " x = vec4(0);\n"
> + " y = vec4(0);\n"
> + "}"
> + ;
> +
> +static const char fstext[] =
> + "void main() { gl_FragColor = vec4(0); }";
> +
> +static const char *varyings[] = {"x"};
> +static GLuint id;
> +static GLuint prog;
> +static GLuint fs_only_prog;
> +static GLuint buf;
> +
> +enum piglit_result delete_inactive_only(void)
> +{
> + bool pass = true;
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated by
> + * DeleteTransformFeedbacks if the transform feedback operation
> + * for any object named by <ids> is currently active."
> + *
> + * However, shortly before that it also says,
> + *
> + * "If an active transform feedback object is deleted its name
> + * immediately becomes unused, but the underlying object is not
> + * deleted until it is no longer active."
> + *
> + * The later text does not appear in the OpenGL 4.4 spec, so I
> + * believe that it was an error in the extension.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glDeleteTransformFeedbacks(1, &id);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result paired_begin_end(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "Transform feedback commands must be paired; the error
> + * INVALID_OPERATION is generated by BeginTransformFeedback if
> + * transform feedback is active, and by EndTransformFeedback if
> + * transform feedback is inactive. Transform feedback is
> initially
> + * inactive."
> + *
> + * The first case is already tested by the cannot-bind-when-active
> + * test.
> + */
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result pause_active_only(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated by
> + * PauseTransformFeedback if the currently bound transform
> + * feedback is not active or is paused."
> + */
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + /* There is no need for an explicit resume here. Section 13.2.2
> + * (Transform Feedback Primitive Capture) of the OpenGL 4.3 spec
> says:
> + *
> + * "EndTransformFeedback first performs an implicit
> + * ResumeTransformFeedback (see below) if transform feedback is
> + * paused."
> + *
> + * NOTE: Previous versions of the spec had an error in this section
> + * that was corrected in 4.3.
> + */
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result resume_paused_only(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated by
> + * ResumeTransformFeedback if the currently bound transform
> + * feedback is not active or is not paused."
> + */
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result vertex_shader_required(void)
> +{
> + bool pass = true;
> +
> + if (piglit_is_extension_supported("GL_NV_transform_feedback2")) {
> + piglit_report_subtest_result(PIGLIT_SKIP,
> + "Vertex shader required");
> + return true;
> + }
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated by
> + * BeginTransformFeedback if no vertex or geometry shader is
> + * active."
> + */
> + glUseProgram(fs_only_prog);
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glUseProgram(prog);
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result change_varyings_inactive_only(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated:
> + *
> + * * by TransformFeedbackVaryings if the current transform
> + * feedback object is active, even if paused;"
> + */
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glTransformFeedbackVaryings(prog, 1, varyings,
> + GL_INTERLEAVED_ATTRIBS);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glTransformFeedbackVaryings(prog, 1, varyings,
> + GL_INTERLEAVED_ATTRIBS);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result change_program_inactive_or_paused(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated:
> + *
> + * * by UseProgram if the current transform feedback
> object is
> + * active and not paused;"
> + */
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glUseProgram(fs_only_prog);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glUseProgram(fs_only_prog);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore the program or glResumeTransformFeedback will generate
> an
> + * error.
> + */
> + glUseProgram(prog);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Work-around drivers with glEndTransformFeedback bugs. See
> + * pause_active_only above.
> + */
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glUseProgram(prog);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result link_program_inactive_only(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated:
> + *
> + * * by LinkProgram if <program> is the name of a program
> + * being used by one or more transform feedback objects,
> + * even if the objects are not currently bound or are
> + * paused;"
> + */
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glLinkProgram(prog);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glLinkProgram(prog);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glLinkProgram(prog);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glUseProgram(0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glLinkProgram(prog);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glUseProgram(prog);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Work-around drivers with glEndTransformFeedback bugs. See
> + * pause_active_only above.
> + */
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result resume_same_program_only(void)
> +{
> + bool pass = true;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated:
> + *
> + * * by ResumeTransformFeedback if the program object being
> + * used by the current transform feedback object is not
> + * active."
> + */
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glUseProgram(0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glUseProgram(prog);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Work-around drivers with glEndTransformFeedback bugs. See
> + * pause_active_only above.
> + */
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result draw_from_valid_object_only(void)
> +{
> + bool pass = true;
> + GLuint bad_id;
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_VALUE is generated if <id> is not the
> name
> + * of a transform feedback object."
> + */
> + glGenTransformFeedbacks(1, &bad_id);
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, bad_id);
> + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glDeleteTransformFeedbacks(1, &bad_id);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glDrawTransformFeedback(GL_TRIANGLES, bad_id);
> + pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
> +
> + /* Restore binding state.
> + */
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +enum piglit_result draw_from_ended_object_only(void)
> +{
> + bool pass = true;
> + GLuint bad_id;
> +
> + /* The ARB_transform_feedback2 spec says:
> + *
> + * "The error INVALID_OPERATION is generated if
> + * EndTransformFeedback has never been called while the object
> + * named by <id> was bound."
> + */
> + glGenTransformFeedbacks(1, &bad_id);
> +
> + glDrawTransformFeedback(GL_TRIANGLES, bad_id);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, bad_id);
> + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
> +
> + glBeginTransformFeedback(GL_TRIANGLES);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glPauseTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glDrawTransformFeedback(GL_TRIANGLES, bad_id);
> + pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, bad_id);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + /* Work-around drivers with glEndTransformFeedback bugs. See
> + * pause_active_only above.
> + */
> + glResumeTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glEndTransformFeedback();
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glDeleteTransformFeedbacks(1, &bad_id);
> + pass = piglit_check_gl_error(0) && pass;
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +void piglit_init(int argc, char **argv)
> +{
> + enum piglit_result result;
> + const char **selected_subtests;
> + size_t num_selected_subtests;
> +
> + piglit_require_transform_feedback();
> + piglit_require_GLSL();
> + piglit_require_extension("GL_ARB_transform_feedback2");
> +
> + num_selected_subtests =
> piglit_get_selected_tests(&selected_subtests);
> +
> + /* This is all just the boot-strap work for the test.
> + */
> + glGenBuffers(1, &buf);
> + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buf);
> + glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, 1024, NULL,
> GL_STREAM_READ);
> +
> + prog = piglit_build_simple_program_unlinked(vstext, fstext);
> +
> + glTransformFeedbackVaryings(prog, 1, varyings,
> + GL_INTERLEAVED_ATTRIBS);
> + glLinkProgram(prog);
> + if (!piglit_link_check_status(prog)) {
> + result = PIGLIT_FAIL;
> + goto done;
> + }
> +
> + fs_only_prog = piglit_build_simple_program(NULL, fstext);
> + if (fs_only_prog == 0) {
> + result = PIGLIT_FAIL;
> + goto done;
> + }
> +
> + glUseProgram(prog);
> +
> + glGenTransformFeedbacks(1, &id);
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
> + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> +
> + result = piglit_run_selected_subtests(subtests,
> + selected_subtests,
> + num_selected_subtests,
> + PIGLIT_SKIP);
> +
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
> +
> +done:
> + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
> + glDeleteBuffers(1, &buf);
> +
> + glDeleteTransformFeedbacks(1, &id);
> +
> + glUseProgram(0);
> + glDeleteProgram(prog);
> + glDeleteProgram(fs_only_prog);
> +
> + piglit_report_result(result);
> +}
> --
> 1.8.1.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131021/54369643/attachment-0001.html>
More information about the Piglit
mailing list