[Piglit] [PATCH] fp64: check GetTransformFeedbackVaryings returns the correct types
Dylan Baker
baker.dylan.c at gmail.com
Mon Feb 23 16:14:38 PST 2015
Add to all.py?
On Mon, Feb 23, 2015 at 01:25:41PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This just tests we get back the correct GL types from the query.
>
> This passes on mesa currently.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> .../execution/CMakeLists.gl.txt | 1 +
> .../execution/double-gettransformfeedbackvarying.c | 133 +++++++++++++++++++++
> 2 files changed, 134 insertions(+)
> create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c
>
> diff --git a/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt b/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt
> index af7df11..68d0b07 100644
> --- a/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt
> +++ b/tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt
> @@ -11,3 +11,4 @@ link_libraries (
> )
>
> piglit_add_executable (arb_gpu_shader_fp64-tf-separate tf-separate.c)
> +piglit_add_executable (arb_gpu_shader_fp64-double-gettransformfeedbackvarying double-gettransformfeedbackvarying.c)
> diff --git a/tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c b/tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c
> new file mode 100644
> index 0000000..ff4b0e0
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c
> @@ -0,0 +1,133 @@
> +/*
> + * Copyright © 2015 Red Hat
> + *
> + * 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 double-gettransformfeedbackvarying.c
> + *
> + * Verify that transform feedback on double varyings returns
> + * the correct types.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_core_version = 32;
> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +#define MAX_EXPECTED_OUTPUT_COMPONENTS 8
> +
> +static const char *vstext = {
> + "#version 150\n"
> + "#extension GL_ARB_gpu_shader_fp64 : require\n"
> + "in vec4 vertex;"
> + "out %s tfout;"
> + "void main() {"
> + " gl_Position = vertex;"
> + " tfout = %s(0.2lf);"
> + "}"
> +};
> +
> +static struct get_tests {
> + GLenum type;
> + const char *glsltype;
> + int size;
> +} tests[] = {
> + { GL_DOUBLE, "double", 1 },
> + { GL_DOUBLE_VEC2 , "dvec2", 1 },
> + { GL_DOUBLE_VEC3 , "dvec3", 1 },
> + { GL_DOUBLE_VEC4 , "dvec4", 1 },
> + { GL_DOUBLE_MAT2 , "dmat2", 1 },
> + { GL_DOUBLE_MAT2x3 , "dmat2x3", 1 },
> + { GL_DOUBLE_MAT2x4 , "dmat2x4", 1 },
> + { GL_DOUBLE_MAT3 , "dmat3", 1 },
> + { GL_DOUBLE_MAT3x2 , "dmat3x2", 1 },
> + { GL_DOUBLE_MAT3x4 , "dmat3x4", 1 },
> + { GL_DOUBLE_MAT4 , "dmat4", 1 },
> + { GL_DOUBLE_MAT4x2 , "dmat4x2", 1 },
> + { GL_DOUBLE_MAT4x3 , "dmat4x3", 1 },
> +};
> +
> +static bool size_and_type_ok = true;
> +static const char *varyings[] = { "tfout" };
> +
> +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);
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + int i;
> +
> + /* Set up test */
> + piglit_require_GLSL_version(1.50);
> + 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);
> +}
> +
> +enum piglit_result piglit_display(void)
> +{
> + return PIGLIT_PASS;
> +}
> --
> 1.9.3
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150223/1ca314f5/attachment-0001.sig>
More information about the Piglit
mailing list