diff options
author | Dave Airlie <airlied@redhat.com> | 2015-02-23 13:24:55 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-07-27 13:36:16 +1000 |
commit | 91a3797f33bceb0bdb234b61ad4950ab101aafdd (patch) | |
tree | fdefce63dea04200cff429d8d34441f7af715a0c | |
parent | 3e70c6a608646031d2e5700158ab32bc8c1c6b6d (diff) |
arb_gpu_shader_fp64: check GetTransformFeedbackVaryings returns the correct types
This just tests we get back the correct GL types from the query.
This passes on mesa currently.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | tests/all.py | 1 | ||||
-rw-r--r-- | tests/spec/arb_gpu_shader_fp64/execution/CMakeLists.gl.txt | 1 | ||||
-rw-r--r-- | tests/spec/arb_gpu_shader_fp64/execution/double-gettransformfeedbackvarying.c | 133 |
3 files changed, 135 insertions, 0 deletions
diff --git a/tests/all.py b/tests/all.py index 8a9c7275c..c263e9ad2 100644 --- a/tests/all.py +++ b/tests/all.py @@ -2084,6 +2084,7 @@ with profile.group_manager( PiglitGLTest, grouptools.join('spec', 'ARB_gpu_shader_fp64', 'execution')) as g: g(['arb_gpu_shader_fp64-tf-separate']) + g(['arb_gpu_shader_fp64-double-gettransformfeedbackvarying']) with profile.group_manager( PiglitGLTest, 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 af7df1195..68d0b076e 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 000000000..ff4b0e041 --- /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; +} |