[Piglit] [PATCH] shader_runner: Only call glMemoryBarrier when supported

Chris Forbes chrisf at ijw.co.nz
Sat Jun 21 01:34:05 PDT 2014


Ian,

That's true, but... we will probably have compute finished long before images.

Is there an acceptable thing to do here in the interim?

-- Chris

On Sat, Jun 21, 2014 at 1:07 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 06/19/2014 10:52 AM, Jordan Justen wrote:
>> Make sure ARB_shader_image_load_store is supported before calling
>> glMemoryBarrier.
>
> NAK.  You can't have GL_ARB_compute_shader without
> GL_ARB_shader_image_load_store.  This is implied by the "OpenGL 4.2 is
> required." line in the spec.
>
>> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>> ---
>>  tests/shaders/shader_runner.c | 21 +++++++++++++++++----
>>  1 file changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
>> index 5fd76f2..e12a742 100644
>> --- a/tests/shaders/shader_runner.c
>> +++ b/tests/shaders/shader_runner.c
>> @@ -129,6 +129,7 @@ GLchar *prog_err_info = NULL;
>>  GLuint vao = 0;
>>  GLuint fbo = 0;
>>  GLint render_width, render_height;
>> +bool ARB_shader_image_load_store_supported = false;
>>
>>  enum states {
>>       none = 0,
>> @@ -2044,6 +2045,17 @@ probe_atomic_counter(GLint counter_num, const char *op, uint32_t value)
>>          return true;
>>  }
>>
>> +static void
>> +dispatch_compute(int x, int y, int z)
>> +{
>> +     program_must_be_in_use();
>> +     if (ARB_shader_image_load_store_supported)
>> +             glMemoryBarrier(GL_ALL_BARRIER_BITS);
>> +     glDispatchCompute(x, y, z);
>> +     if (ARB_shader_image_load_store_supported)
>> +             glMemoryBarrier(GL_ALL_BARRIER_BITS);
>> +}
>> +
>>  enum piglit_result
>>  piglit_display(void)
>>  {
>> @@ -2089,10 +2101,7 @@ piglit_display(void)
>>               } else if (sscanf(line,
>>                                 "compute %d %d %d",
>>                                 &x, &y, &z) == 3) {
>> -                     program_must_be_in_use();
>> -                     glMemoryBarrier(GL_ALL_BARRIER_BITS);
>> -                     glDispatchCompute(x, y, z);
>> -                     glMemoryBarrier(GL_ALL_BARRIER_BITS);
>> +                     dispatch_compute(x, y, z);
>>               } else if (string_match("draw rect tex", line)) {
>>                       program_must_be_in_use();
>>                       get_floats(line + 13, c, 8);
>> @@ -2409,6 +2418,10 @@ piglit_init(int argc, char **argv)
>>       glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS,
>>                     &gl_max_vertex_uniform_components);
>>       glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max_clip_planes);
>> +
>> +     ARB_shader_image_load_store_supported =
>> +             gl_version.num >= 42 ||
>> +             piglit_is_extension_supported("GL_ARB_shader_image_load_store");
>>  #else
>>       glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS,
>>                     &gl_max_fragment_uniform_components);
>>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list