On 05/02/2018 11:02 AM, Eric Anholt wrote: > Ian Romanick <i...@freedesktop.org> writes: >> diff --git a/tests/spec/nv_fog_distance/simple-draw.c >> b/tests/spec/nv_fog_distance/simple-draw.c >> new file mode 100644 >> index 000000000..e7be6bf5e >> --- /dev/null >> +++ b/tests/spec/nv_fog_distance/simple-draw.c >> @@ -0,0 +1,245 @@ >> +/* Copyright © 2017 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 simple-draw.c >> + * Simple rendering tests of GL_NV_fog_distance >> + */ >> + >> +#include "piglit-util-gl.h" >> +#include "minmax-test.h" >> + >> +PIGLIT_GL_TEST_CONFIG_BEGIN >> + >> + config.supports_gl_compat_version = 10; >> + >> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; >> + >> +PIGLIT_GL_TEST_CONFIG_END >> + >> +static GLenum distance_mode = GL_EYE_RADIAL_NV; >> +static GLuint vbo[2]; >> + >> +/* Generate an NxM grid of vertices spanning [-1,-1]x[1,1] >> + */ >> +static unsigned >> +generate_mesh(unsigned n, unsigned m, float z, GLuint vbo[2]) >> +{ >> + /* Generate the grid of vertices by linearly interpolating across >> + * [-1,1]x[-1,1]. This is the easy part. >> + * >> + * Each vertex is 3 floats. There are N*M vertices. >> + */ >> + glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); >> + glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * n * m, >> + NULL, GL_STATIC_DRAW); >> + >> + float *verts = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY); >> + for (unsigned i = 0; i < m; i++) { >> + const float y = -1.0 + ((2.0 * i) / (m - 1)); >> + >> + for (unsigned j = 0; j < n; j++) { >> + const float x = -1.0 + ((2.0 * j) / (n - 1)); >> + >> + verts[0] = x; >> + verts[1] = y; >> + verts[2] = z; >> + verts += 3; >> + } >> + } >> + >> + glUnmapBuffer(GL_ARRAY_BUFFER); > > This all feels overly complicated for a testcase -- how bad would a > double loop of piglit_draw_rect_z() be, I wonder? I'm betting that
I was unaware of piglit_draw_rect_z. I tried that, and it simplifies the code a lot. Updated patch coming soon. > would let your testcase work on the old nvidia drivers. I wrote this about year ago... I think the problem with the old NIVIDA drivers was that I had to use them on a version of Fedora that was so old that I could not build piglit. > However, it also sounds like it works on Mesa, so either way, > > Acked-by: Eric Anholt <e...@anholt.net> > >> + if (argc > 1) { >> + unsigned i; >> + >> + for (i = 0; i < ARRAY_SIZE(modes); i++) { >> + if (strcmp(modes[i].name, argv[1]) == 0) { >> + distance_mode = modes[i].mode; >> + break; >> + } >> + } >> + >> + if (i == ARRAY_SIZE(modes)) { >> + printf("Unknown distance mode \"%s\".\n", >> + argv[1]); >> + piglit_report_result(PIGLIT_FAIL); >> + } >> + } >> + >> + glEnableClientState(GL_VERTEX_ARRAY); >> + glEnable(GL_FOG); > > Funny indentation >
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit