<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 9, 2015 at 2:58 PM, Dylan Baker <span dir="ltr"><<a href="mailto:baker.dylan.c@gmail.com" target="_blank">baker.dylan.c@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Friday, January 09, 2015 02:53:25 PM Jason Ekstrand wrote:<br>
> ---<br>
>  tests/all.py                      |  3 +++<br>
>  tests/texturing/teximage-colors.c | 54 ++++++++++++++++++++++++++++-----------<br>
>  2 files changed, 42 insertions(+), 15 deletions(-)<br>
><br>
> diff --git a/tests/all.py b/tests/all.py<br>
> index 87ff8e9..50d4b39 100644<br>
> --- a/tests/all.py<br>
> +++ b/tests/all.py<br>
> @@ -853,6 +853,9 @@ color_formats = [<br>
>  for format in color_formats:<br>
>      add_concurrent_test(gl11, ['teximage-colors', format])<br>
><br>
> +for format in color_formats:<br>
> +    add_concurrent_test(gl11, ['teximage-colors', '--pbo', format])<br>
> +<br>
<br>
</span>Is there a reason this cannot be part of the previous loop?<br></blockquote><div><br></div><div>No.  Would you rather it be?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
>  gl10 = {}<br>
>  spec['!OpenGL 1.0'] = gl10<br>
>  add_concurrent_test(gl10, ['gl-1.0-beginend-coverage'])<br>
> diff --git a/tests/texturing/teximage-colors.c b/tests/texturing/teximage-colors.c<br>
> index 31136a9..5944137 100644<br>
> --- a/tests/texturing/teximage-colors.c<br>
> +++ b/tests/texturing/teximage-colors.c<br>
> @@ -459,8 +459,11 @@ int texture_size = 31;<br>
>  struct texture_format *format = NULL;<br>
>  GLuint unsigned_prog, signed_prog;<br>
>  void *rand_data;<br>
> +float *rand_float;<br>
> +GLuint pbo, float_pbo;<br>
>  float tolerance[4];<br>
>  bool benchmark = false;<br>
> +bool use_pbo = false;<br>
><br>
>  void<br>
>  piglit_init(int argc, char **argv)<br>
> @@ -473,6 +476,8 @@ piglit_init(int argc, char **argv)<br>
>               } else if (strcmp(argv[i], "--benchmark") == 0) {<br>
>                       benchmark = true;<br>
>                       texture_size = 128;<br>
> +             } else if (strcmp(argv[i], "--pbo") == 0) {<br>
> +                     use_pbo = true;<br>
>               } else if (i == argc - 1) {<br>
>                       format = find_format(argv[i]);<br>
>                       break;<br>
> @@ -492,10 +497,31 @@ piglit_init(int argc, char **argv)<br>
>       unsigned_prog = piglit_build_simple_program(NULL, frag_shader_unsigned_src);<br>
><br>
>       srand(seed);<br>
> +<br>
>       rand_data = malloc(texture_size * texture_size * 128);<br>
>       for (i = 0; i < texture_size * texture_size * 128; ++i)<br>
>               ((GLubyte *)rand_data)[i] = rand();<br>
><br>
> +     rand_float = malloc(texture_size * texture_size * 128);<br>
> +     for (i = 0; i < texture_size * texture_size * 32; ++i)<br>
> +             rand_float[i] = sn_to_float(32, ((GLint *)rand_data)[i]);<br>
> +<br>
> +     if (use_pbo) {<br>
> +             glGenBuffers(1, &pbo);<br>
> +             glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);<br>
> +             glBufferData(GL_PIXEL_UNPACK_BUFFER,<br>
> +                          texture_size * texture_size * 128, rand_data,<br>
> +                          GL_STATIC_DRAW);<br>
> +<br>
> +             glGenBuffers(1, &float_pbo);<br>
> +             glBindBuffer(GL_PIXEL_UNPACK_BUFFER, float_pbo);<br>
> +             glBufferData(GL_PIXEL_UNPACK_BUFFER,<br>
> +                          texture_size * texture_size * 128, rand_float,<br>
> +                          GL_STATIC_DRAW);<br>
> +<br>
> +             glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);<br>
> +     }<br>
> +<br>
>       if (is_format_srgb(format->internal_format)) {<br>
>               /* We loose a little precision in the high numbers */<br>
>               tolerance[0] = 0.02;<br>
> @@ -701,9 +727,9 @@ run_test(GLenum test_format, GLenum test_type, float *time_out)<br>
>       bool pass = true;<br>
>       int64_t time;<br>
>       GLuint tex;<br>
> -     int i, Bpp, channels;<br>
> -     float *tmp, *expected, *observed;<br>
> -     void *data;<br>
> +     int i, Bpp;<br>
> +     float *expected, *observed;<br>
> +     void *data, *teximage_ptr;<br>
><br>
>       glGenTextures(1, &tex);<br>
>       glBindTexture(GL_TEXTURE_2D, tex);<br>
> @@ -712,18 +738,15 @@ run_test(GLenum test_format, GLenum test_type, float *time_out)<br>
><br>
>       glPixelStorei(GL_UNPACK_ALIGNMENT, 1);<br>
><br>
> -     channels = num_channels(test_format);<br>
>       Bpp = bytes_per_pixel(test_format, test_type);<br>
><br>
> -     if (test_type == GL_FLOAT) {<br>
> -             /* Sanatize so we don't get invalid floating point values */<br>
> -             tmp = malloc(texture_size * texture_size * channels * sizeof(float));<br>
> -             for (i = 0; i < texture_size * texture_size * channels; ++i)<br>
> -                     tmp[i] = sn_to_float(32, ((GLint *)rand_data)[i]);<br>
> -             data = tmp;<br>
> +     data = (test_type == GL_FLOAT) ? rand_float : rand_data;<br>
> +     if (use_pbo) {<br>
> +             glBindBuffer(GL_PIXEL_UNPACK_BUFFER,<br>
> +                          (test_type == GL_FLOAT) ? float_pbo : pbo);<br>
> +             teximage_ptr = NULL;<br>
>       } else {<br>
> -             tmp = NULL;<br>
> -             data = rand_data;<br>
> +             teximage_ptr = data;<br>
>       }<br>
><br>
>       expected = malloc(texture_size * texture_size * 4 * sizeof(float));<br>
> @@ -736,16 +759,18 @@ run_test(GLenum test_format, GLenum test_type, float *time_out)<br>
>               for (i = 0; i < BENCHMARK_ITERATIONS; ++i)<br>
>                       glTexImage2D(GL_TEXTURE_2D, 0, format->internal_format,<br>
>                                    texture_size, texture_size, 0,<br>
> -                                  test_format, test_type, data);<br>
> +                                  test_format, test_type, teximage_ptr);<br>
>               time = piglit_time_get_nano() - time;<br>
>               *time_out = (double)time / (double)(BENCHMARK_ITERATIONS*1000);<br>
>       } else {<br>
>               glTexImage2D(GL_TEXTURE_2D, 0, format->internal_format,<br>
>                            texture_size, texture_size, 0,<br>
> -                          test_format, test_type, data);<br>
> +                          test_format, test_type, teximage_ptr);<br>
>       }<br>
>       pass &= piglit_check_gl_error(GL_NO_ERROR);<br>
><br>
> +     glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);<br>
> +<br>
>       if (is_format_signed(format->internal_format)) {<br>
>               glUseProgram(signed_prog);<br>
><br>
> @@ -767,7 +792,6 @@ run_test(GLenum test_format, GLenum test_type, float *time_out)<br>
><br>
>       free(observed);<br>
>       free(expected);<br>
> -     free(tmp);<br>
><br>
>       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
>                                    "%s texture with %s and %s",<br>
> --<br>
> 2.2.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>
><br>
</blockquote></div><br></div></div>