Oops. I'll take it out.
On Mon, Dec 15, 2014 at 7:33 PM, Chris Forbes <[email protected]> wrote: > > Did you mean to leave the non-DSA nvidia workaround in here? I > understand this might have been useful for getting it working > initially, but... if their driver is broken, it's broken. > > On Tue, Dec 16, 2014 at 2:24 PM, Laura Ekstrand <[email protected]> > wrote: > > Dylan Baker: all.py: Add dsa tests. > > --- > > tests/all.py | 2 + > > tests/spec/CMakeLists.txt | 1 + > > .../spec/arb_direct_state_access/CMakeLists.gl.txt | 13 +++ > > tests/spec/arb_direct_state_access/CMakeLists.txt | 1 + > > tests/spec/arb_direct_state_access/dsa-textures.c | 123 > +++++++++++++++++++++ > > tests/spec/arb_direct_state_access/dsa-utils.c | 79 +++++++++++++ > > tests/spec/arb_direct_state_access/dsa-utils.h | 51 +++++++++ > > 7 files changed, 270 insertions(+) > > create mode 100644 tests/spec/arb_direct_state_access/CMakeLists.gl.txt > > create mode 100644 tests/spec/arb_direct_state_access/CMakeLists.txt > > create mode 100644 tests/spec/arb_direct_state_access/dsa-textures.c > > create mode 100644 tests/spec/arb_direct_state_access/dsa-utils.c > > create mode 100644 tests/spec/arb_direct_state_access/dsa-utils.h > > > > diff --git a/tests/all.py b/tests/all.py > > index cfbe529..84639c2 100644 > > --- a/tests/all.py > > +++ b/tests/all.py > > @@ -4306,6 +4306,8 @@ add_shader_test_dir(arb_derivative_control, > > import_glsl_parser_tests(arb_derivative_control, > > testsDir + '/spec/arb_derivative_control', > ['']) > > > > +spec['ARB_direct_state_access'] = {} > > +spec['ARB_direct_state_access']['dsa-textures'] = > PiglitGLTest('arb_direct_state_access-dsa-textures', run_concurrent=True) > > > > profile.tests['hiz'] = hiz > > profile.tests['fast_color_clear'] = fast_color_clear > > diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt > > index dfd822b..697b00d 100644 > > --- a/tests/spec/CMakeLists.txt > > +++ b/tests/spec/CMakeLists.txt > > @@ -114,3 +114,4 @@ add_subdirectory (arb_blend_func_extended) > > add_subdirectory (ext_unpack_subimage) > > add_subdirectory (arb_vertex_array_object) > > add_subdirectory (oes_texture_float) > > +add_subdirectory (arb_direct_state_access) > > diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt > b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt > > new file mode 100644 > > index 0000000..cb0f7da > > --- /dev/null > > +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt > > @@ -0,0 +1,13 @@ > > +include_directories( > > + ${GLEXT_INCLUDE_DIR} > > + ${OPENGL_INCLUDE_PATH} > > +) > > + > > +link_libraries ( > > + piglitutil_${piglit_target_api} > > + ${OPENGL_gl_LIBRARY} > > + ${OPENGL_glu_LIBRARY} > > +) > > + > > +piglit_add_executable (arb_direct_state_access-dsa-textures > dsa-textures.c dsa-utils.c) > > +# vim: ft=cmake: > > diff --git a/tests/spec/arb_direct_state_access/CMakeLists.txt > b/tests/spec/arb_direct_state_access/CMakeLists.txt > > new file mode 100644 > > index 0000000..144a306 > > --- /dev/null > > +++ b/tests/spec/arb_direct_state_access/CMakeLists.txt > > @@ -0,0 +1 @@ > > +piglit_include_target_api() > > diff --git a/tests/spec/arb_direct_state_access/dsa-textures.c > b/tests/spec/arb_direct_state_access/dsa-textures.c > > new file mode 100644 > > index 0000000..468d23e > > --- /dev/null > > +++ b/tests/spec/arb_direct_state_access/dsa-textures.c > > @@ -0,0 +1,123 @@ > > +/* > > + * Copyright 2014 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 dsa-textures.c > > + * > > + * Tests the direct state access functionality for creating, > initializing, and > > + * rendering texture objects. > > + */ > > +#include "piglit-util-gl.h" > > +#include "dsa-utils.h" > > + > > +#include <stdlib.h> > > + > > +static const char* glversion; > > +static bool nv340_23; /* Are we using the NVIDIA 340.23 driver? */ > > + > > +PIGLIT_GL_TEST_CONFIG_BEGIN > > + > > + config.supports_gl_compat_version = 13; > > + > > + config.window_visual = PIGLIT_GL_VISUAL_RGBA | > > + PIGLIT_GL_VISUAL_DOUBLE; > > + > > +PIGLIT_GL_TEST_CONFIG_END > > + > > +GLfloat* > > +random_image_data(void) > > +{ > > + int i; > > + GLfloat *img = > malloc(4*piglit_width*piglit_height*sizeof(GLfloat)); > > + for (i = 0; i < 4*piglit_width*piglit_height; ++i) { > > + img[i] = (float) rand() / RAND_MAX; > > + } > > + return img; > > +} /* random_image_data */ > > + > > +void > > +piglit_init(int argc, char **argv) > > +{ > > + piglit_require_extension("GL_ARB_direct_state_access"); > > + > > + srand(0); > > + > > + glversion = (const char*) glGetString(GL_VERSION); > > + printf("Using driver %s.\n", glversion); > > + if (strcmp("2.1.2 NVIDIA 340.23.03", glversion) == 0) > > + nv340_23 = true; > > + else > > + nv340_23 = false; > > + > > + dsa_init_program(); > > + > > +} /* piglit_init */ > > + > > +enum piglit_result > > +piglit_display(void) > > +{ > > + bool pass = true; > > + GLfloat* data = random_image_data(); > > + GLuint name; > > + int texunit = 3; > > + > > + glCreateTextures(GL_TEXTURE_2D, 1, &name); > > + if (nv340_23) { > > + printf("Working around bugs in NVIDIA 340.23.03.\n"); > > + glBindTexture(GL_TEXTURE_2D, name); > > + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, > > + piglit_width, piglit_height, 0, GL_RGBA, > > + GL_FLOAT, data); > > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, > > + GL_NEAREST); > > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, > > + GL_NEAREST); > > + } > > + else { > > + /* These do not appear to work on nv340_23. */ > > + glTextureStorage2D(name, 1, GL_RGBA32F, piglit_width, > > + piglit_height); > > + glTextureSubImage2D(name, 0, 0, 0, > > + piglit_width, piglit_height, GL_RGBA, GL_FLOAT, > data); > > + glTextureParameteri(name, GL_TEXTURE_MIN_FILTER, > GL_NEAREST); > > + glTextureParameteri(name, GL_TEXTURE_MAG_FILTER, > GL_NEAREST); > > + } > > + > > + /* Draw the image */ > > + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); > > + dsa_texture_with_unit(texunit); > > + glEnable(GL_TEXTURE_2D); > > + glBindTextureUnit(texunit, name); > > + pass &= piglit_check_gl_error(GL_NO_ERROR); > > + piglit_draw_rect_tex(0, 0, piglit_width, piglit_height, 0, 0, 1, > 1); > > + pass &= piglit_check_gl_error(GL_NO_ERROR); > > + > > + /* Check to make sure the image was drawn correctly */ > > + pass &= piglit_probe_image_rgba(0, 0, piglit_width, > piglit_height, > > + data); > > + > > + if (!piglit_automatic) { > > + piglit_present_results(); > > + } > > + > > + return pass ? PIGLIT_PASS : PIGLIT_FAIL; > > +} /* piglit_display */ > > diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c > b/tests/spec/arb_direct_state_access/dsa-utils.c > > new file mode 100644 > > index 0000000..ec7bb24 > > --- /dev/null > > +++ b/tests/spec/arb_direct_state_access/dsa-utils.c > > @@ -0,0 +1,79 @@ > > +/* > > + * Copyright 2014 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 dsa-utils.c > > + * > > + * Contains some common functionality for writing > arb_direct_state_access > > + * Piglit tests. > > + * > > + * @author Laura Ekstrand ([email protected]) > > + */ > > + > > +#include "dsa-utils.h" > > +#include "piglit-shader.h" > > + > > +/* > > + * You must use shaders in order to use different texture units. > > + * These duplicate fixed-function gl 1.0 pipeline shading. > > + * Adapted from arb_clear_texture/3d.c. > > + */ > > +static const char dsa_vs_source[] = > > + "#version 120\n" > > + "attribute vec4 piglit_vertex;\n" > > + "attribute vec4 piglit_texcoord;\n" > > + "varying vec2 tex_coord;\n" > > + "\n" > > + "void main()\n" > > + "{\n" > > + " gl_Position = gl_ModelViewProjectionMatrix\n" > > + " * piglit_vertex;\n" > > + " tex_coord = piglit_texcoord.st;\n" > > + "}\n"; > > + > > +static const char dsa_fs_source[] = > > + "#version 120\n" > > + "uniform sampler2D tex;\n" > > + "varying vec2 tex_coord;\n" > > + "\n" > > + "void main()\n" > > + "{\n" > > + " gl_FragColor = texture2D(tex, tex_coord);\n" > > + "}\n"; > > + > > +static GLuint dsa_prog; > > +static GLuint dsa_uniform; > > + > > +void > > +dsa_init_program(void) > > +{ > > + dsa_prog = piglit_build_simple_program(dsa_vs_source, > dsa_fs_source); > > + glUseProgram(dsa_prog); > > + dsa_uniform = glGetUniformLocation(dsa_prog, "tex"); > > + glUniform1i(dsa_uniform, 0); > > +} > > + > > +void > > +dsa_texture_with_unit(GLuint unit) > > +{ > > + glUniform1i(dsa_uniform, unit); > > +} > > diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h > b/tests/spec/arb_direct_state_access/dsa-utils.h > > new file mode 100644 > > index 0000000..242c019 > > --- /dev/null > > +++ b/tests/spec/arb_direct_state_access/dsa-utils.h > > @@ -0,0 +1,51 @@ > > +/* > > + * Copyright 2014 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 dsa-utils.h > > + * > > + * Contains some common functionality for writing > arb_direct_state_access > > + * Piglit tests. > > + * > > + * @author Laura Ekstrand ([email protected]) > > + */ > > + > > +#pragma once > > +#ifndef __DSA_UTILS_H__ > > +#define __DSA_UTILS_H__ > > + > > +#ifdef __cplusplus > > +extern "C" { > > +#endif > > + > > +#include "piglit-util-gl.h" > > +#include "piglit-glx-util.h" > > + > > +void dsa_init_program(void); > > + > > +void dsa_texture_with_unit(GLuint); > > + > > +#ifdef __cplusplus > > +} /* end extern "C" */ > > +#endif > > + > > +#endif /* __DSA_UTILS_H__ */ > > -- > > 2.1.0 > > > > _______________________________________________ > > Piglit mailing list > > [email protected] > > http://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
