<div dir="ltr">Oops. I'll take it out.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 15, 2014 at 7:33 PM, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Did you mean to leave the non-DSA nvidia workaround in here? I<br>
understand this might have been useful for getting it working<br>
initially, but... if their driver is broken, it's broken.<br>
<div><div class="h5"><br>
On Tue, Dec 16, 2014 at 2:24 PM, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> wrote:<br>
> Dylan Baker: all.py: Add dsa tests.<br>
> ---<br>
> tests/all.py | 2 +<br>
> tests/spec/CMakeLists.txt | 1 +<br>
> .../spec/arb_direct_state_access/CMakeLists.gl.txt | 13 +++<br>
> tests/spec/arb_direct_state_access/CMakeLists.txt | 1 +<br>
> tests/spec/arb_direct_state_access/dsa-textures.c | 123 +++++++++++++++++++++<br>
> tests/spec/arb_direct_state_access/dsa-utils.c | 79 +++++++++++++<br>
> tests/spec/arb_direct_state_access/dsa-utils.h | 51 +++++++++<br>
> 7 files changed, 270 insertions(+)<br>
> create mode 100644 tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> create mode 100644 tests/spec/arb_direct_state_access/CMakeLists.txt<br>
> create mode 100644 tests/spec/arb_direct_state_access/dsa-textures.c<br>
> create mode 100644 tests/spec/arb_direct_state_access/dsa-utils.c<br>
> create mode 100644 tests/spec/arb_direct_state_access/dsa-utils.h<br>
><br>
> diff --git a/tests/all.py b/tests/all.py<br>
> index cfbe529..84639c2 100644<br>
> --- a/tests/all.py<br>
> +++ b/tests/all.py<br>
> @@ -4306,6 +4306,8 @@ add_shader_test_dir(arb_derivative_control,<br>
> import_glsl_parser_tests(arb_derivative_control,<br>
> testsDir + '/spec/arb_derivative_control', [''])<br>
><br>
> +spec['ARB_direct_state_access'] = {}<br>
> +spec['ARB_direct_state_access']['dsa-textures'] = PiglitGLTest('arb_direct_state_access-dsa-textures', run_concurrent=True)<br>
><br>
> profile.tests['hiz'] = hiz<br>
> profile.tests['fast_color_clear'] = fast_color_clear<br>
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt<br>
> index dfd822b..697b00d 100644<br>
> --- a/tests/spec/CMakeLists.txt<br>
> +++ b/tests/spec/CMakeLists.txt<br>
> @@ -114,3 +114,4 @@ add_subdirectory (arb_blend_func_extended)<br>
> add_subdirectory (ext_unpack_subimage)<br>
> add_subdirectory (arb_vertex_array_object)<br>
> add_subdirectory (oes_texture_float)<br>
> +add_subdirectory (arb_direct_state_access)<br>
> diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> new file mode 100644<br>
> index 0000000..cb0f7da<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
> @@ -0,0 +1,13 @@<br>
> +include_directories(<br>
> + ${GLEXT_INCLUDE_DIR}<br>
> + ${OPENGL_INCLUDE_PATH}<br>
> +)<br>
> +<br>
> +link_libraries (<br>
> + piglitutil_${piglit_target_api}<br>
> + ${OPENGL_gl_LIBRARY}<br>
> + ${OPENGL_glu_LIBRARY}<br>
> +)<br>
> +<br>
> +piglit_add_executable (arb_direct_state_access-dsa-textures dsa-textures.c dsa-utils.c)<br>
> +# vim: ft=cmake:<br>
> diff --git a/tests/spec/arb_direct_state_access/CMakeLists.txt b/tests/spec/arb_direct_state_access/CMakeLists.txt<br>
> new file mode 100644<br>
> index 0000000..144a306<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_direct_state_access/CMakeLists.txt<br>
> @@ -0,0 +1 @@<br>
> +piglit_include_target_api()<br>
> diff --git a/tests/spec/arb_direct_state_access/dsa-textures.c b/tests/spec/arb_direct_state_access/dsa-textures.c<br>
> new file mode 100644<br>
> index 0000000..468d23e<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_direct_state_access/dsa-textures.c<br>
> @@ -0,0 +1,123 @@<br>
> +/*<br>
> + * Copyright 2014 Intel Corporation<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the "Software"),<br>
> + * to deal in the Software without restriction, including without limitation<br>
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
> + * and/or sell copies of the Software, and to permit persons to whom the<br>
> + * Software is furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the next<br>
> + * paragraph) shall be included in all copies or substantial portions of the<br>
> + * Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
> + * DEALINGS IN THE SOFTWARE.<br>
> + */<br>
> +<br>
> +/** @file dsa-textures.c<br>
> + *<br>
> + * Tests the direct state access functionality for creating, initializing, and<br>
> + * rendering texture objects.<br>
> + */<br>
> +#include "piglit-util-gl.h"<br>
> +#include "dsa-utils.h"<br>
> +<br>
> +#include <stdlib.h><br>
> +<br>
> +static const char* glversion;<br>
> +static bool nv340_23; /* Are we using the NVIDIA 340.23 driver? */<br>
> +<br>
> +PIGLIT_GL_TEST_CONFIG_BEGIN<br>
> +<br>
> + config.supports_gl_compat_version = 13;<br>
> +<br>
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA |<br>
> + PIGLIT_GL_VISUAL_DOUBLE;<br>
> +<br>
> +PIGLIT_GL_TEST_CONFIG_END<br>
> +<br>
> +GLfloat*<br>
> +random_image_data(void)<br>
> +{<br>
> + int i;<br>
> + GLfloat *img = malloc(4*piglit_width*piglit_height*sizeof(GLfloat));<br>
> + for (i = 0; i < 4*piglit_width*piglit_height; ++i) {<br>
> + img[i] = (float) rand() / RAND_MAX;<br>
> + }<br>
> + return img;<br>
> +} /* random_image_data */<br>
> +<br>
> +void<br>
> +piglit_init(int argc, char **argv)<br>
> +{<br>
> + piglit_require_extension("GL_ARB_direct_state_access");<br>
> +<br>
> + srand(0);<br>
> +<br>
> + glversion = (const char*) glGetString(GL_VERSION);<br>
> + printf("Using driver %s.\n", glversion);<br>
> + if (strcmp("2.1.2 NVIDIA 340.23.03", glversion) == 0)<br>
> + nv340_23 = true;<br>
> + else<br>
> + nv340_23 = false;<br>
> +<br>
> + dsa_init_program();<br>
> +<br>
> +} /* piglit_init */<br>
> +<br>
> +enum piglit_result<br>
> +piglit_display(void)<br>
> +{<br>
> + bool pass = true;<br>
> + GLfloat* data = random_image_data();<br>
> + GLuint name;<br>
> + int texunit = 3;<br>
> +<br>
> + glCreateTextures(GL_TEXTURE_2D, 1, &name);<br>
> + if (nv340_23) {<br>
> + printf("Working around bugs in NVIDIA 340.23.03.\n");<br>
> + glBindTexture(GL_TEXTURE_2D, name);<br>
> + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,<br>
> + piglit_width, piglit_height, 0, GL_RGBA,<br>
> + GL_FLOAT, data);<br>
> + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,<br>
> + GL_NEAREST);<br>
> + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,<br>
> + GL_NEAREST);<br>
> + }<br>
> + else {<br>
> + /* These do not appear to work on nv340_23. */<br>
> + glTextureStorage2D(name, 1, GL_RGBA32F, piglit_width,<br>
> + piglit_height);<br>
> + glTextureSubImage2D(name, 0, 0, 0,<br>
> + piglit_width, piglit_height, GL_RGBA, GL_FLOAT, data);<br>
> + glTextureParameteri(name, GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br>
> + glTextureParameteri(name, GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br>
> + }<br>
> +<br>
> + /* Draw the image */<br>
> + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);<br>
> + dsa_texture_with_unit(texunit);<br>
> + glEnable(GL_TEXTURE_2D);<br>
> + glBindTextureUnit(texunit, name);<br>
> + pass &= piglit_check_gl_error(GL_NO_ERROR);<br>
> + piglit_draw_rect_tex(0, 0, piglit_width, piglit_height, 0, 0, 1, 1);<br>
> + pass &= piglit_check_gl_error(GL_NO_ERROR);<br>
> +<br>
> + /* Check to make sure the image was drawn correctly */<br>
> + pass &= piglit_probe_image_rgba(0, 0, piglit_width, piglit_height,<br>
> + data);<br>
> +<br>
> + if (!piglit_automatic) {<br>
> + piglit_present_results();<br>
> + }<br>
> +<br>
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
> +} /* piglit_display */<br>
> diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c b/tests/spec/arb_direct_state_access/dsa-utils.c<br>
> new file mode 100644<br>
> index 0000000..ec7bb24<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_direct_state_access/dsa-utils.c<br>
> @@ -0,0 +1,79 @@<br>
> +/*<br>
> + * Copyright 2014 Intel Corporation<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the "Software"),<br>
> + * to deal in the Software without restriction, including without limitation<br>
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
> + * and/or sell copies of the Software, and to permit persons to whom the<br>
> + * Software is furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the next<br>
> + * paragraph) shall be included in all copies or substantial portions of the<br>
> + * Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
> + * DEALINGS IN THE SOFTWARE.<br>
> + */<br>
> +<br>
> +/** @file dsa-utils.c<br>
> + *<br>
> + * Contains some common functionality for writing arb_direct_state_access<br>
> + * Piglit tests.<br>
> + *<br>
> + * @author Laura Ekstrand (<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>)<br>
> + */<br>
> +<br>
> +#include "dsa-utils.h"<br>
> +#include "piglit-shader.h"<br>
> +<br>
> +/*<br>
> + * You must use shaders in order to use different texture units.<br>
> + * These duplicate fixed-function gl 1.0 pipeline shading.<br>
> + * Adapted from arb_clear_texture/3d.c.<br>
> + */<br>
> +static const char dsa_vs_source[] =<br>
> + "#version 120\n"<br>
> + "attribute vec4 piglit_vertex;\n"<br>
> + "attribute vec4 piglit_texcoord;\n"<br>
> + "varying vec2 tex_coord;\n"<br>
> + "\n"<br>
> + "void main()\n"<br>
> + "{\n"<br>
> + " gl_Position = gl_ModelViewProjectionMatrix\n"<br>
> + " * piglit_vertex;\n"<br>
> + " tex_coord = <a href="http://piglit_texcoord.st" target="_blank">piglit_texcoord.st</a>;\n"<br>
> + "}\n";<br>
> +<br>
> +static const char dsa_fs_source[] =<br>
> + "#version 120\n"<br>
> + "uniform sampler2D tex;\n"<br>
> + "varying vec2 tex_coord;\n"<br>
> + "\n"<br>
> + "void main()\n"<br>
> + "{\n"<br>
> + " gl_FragColor = texture2D(tex, tex_coord);\n"<br>
> + "}\n";<br>
> +<br>
> +static GLuint dsa_prog;<br>
> +static GLuint dsa_uniform;<br>
> +<br>
> +void<br>
> +dsa_init_program(void)<br>
> +{<br>
> + dsa_prog = piglit_build_simple_program(dsa_vs_source, dsa_fs_source);<br>
> + glUseProgram(dsa_prog);<br>
> + dsa_uniform = glGetUniformLocation(dsa_prog, "tex");<br>
> + glUniform1i(dsa_uniform, 0);<br>
> +}<br>
> +<br>
> +void<br>
> +dsa_texture_with_unit(GLuint unit)<br>
> +{<br>
> + glUniform1i(dsa_uniform, unit);<br>
> +}<br>
> diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h b/tests/spec/arb_direct_state_access/dsa-utils.h<br>
> new file mode 100644<br>
> index 0000000..242c019<br>
> --- /dev/null<br>
> +++ b/tests/spec/arb_direct_state_access/dsa-utils.h<br>
> @@ -0,0 +1,51 @@<br>
> +/*<br>
> + * Copyright 2014 Intel Corporation<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the "Software"),<br>
> + * to deal in the Software without restriction, including without limitation<br>
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
> + * and/or sell copies of the Software, and to permit persons to whom the<br>
> + * Software is furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the next<br>
> + * paragraph) shall be included in all copies or substantial portions of the<br>
> + * Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
> + * DEALINGS IN THE SOFTWARE.<br>
> + */<br>
> +<br>
> +/** @file dsa-utils.h<br>
> + *<br>
> + * Contains some common functionality for writing arb_direct_state_access<br>
> + * Piglit tests.<br>
> + *<br>
> + * @author Laura Ekstrand (<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>)<br>
> + */<br>
> +<br>
> +#pragma once<br>
> +#ifndef __DSA_UTILS_H__<br>
> +#define __DSA_UTILS_H__<br>
> +<br>
> +#ifdef __cplusplus<br>
> +extern "C" {<br>
> +#endif<br>
> +<br>
> +#include "piglit-util-gl.h"<br>
> +#include "piglit-glx-util.h"<br>
> +<br>
> +void dsa_init_program(void);<br>
> +<br>
> +void dsa_texture_with_unit(GLuint);<br>
> +<br>
> +#ifdef __cplusplus<br>
> +} /* end extern "C" */<br>
> +#endif<br>
> +<br>
> +#endif /* __DSA_UTILS_H__ */<br>
> --<br>
> 2.1.0<br>
><br>
</div></div>> _______________________________________________<br>
> Piglit mailing list<br>
> <a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</blockquote></div></div>