[Piglit] [PATCH 6/15] shader_runner: propagate all errors to piglit_init

Marek Olšák maraeo at gmail.com
Mon Sep 12 13:47:23 UTC 2016


On Sat, Sep 10, 2016 at 1:25 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 09.09.2016 21:18, Dylan Baker wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> piglit_report_result prevents running multiple tests per process.
>> ---
>>  tests/shaders/shader_runner.c | 231 +++++++++++++++++++++--------------
>>  1 file changed, 140 insertions(+), 91 deletions(-)
>>
>> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
>> index 8e29346..e7667c3 100644
>> --- a/tests/shaders/shader_runner.c
>> +++ b/tests/shaders/shader_runner.c
>> @@ -360,7 +360,7 @@ target_to_short_name(GLenum target)
>>  }
>>
>>
>> -static void
>> +static enum piglit_result
>>  compile_glsl(GLenum target)
>>  {
>>         GLuint shader = glCreateShader(target);
>> @@ -368,33 +368,42 @@ compile_glsl(GLenum target)
>>
>>         switch (target) {
>>         case GL_VERTEX_SHADER:
>> -               piglit_require_vertex_shader();
>> +               if (piglit_get_gl_version() < 20 &&
>> +
>> !(piglit_is_extension_supported("GL_ARB_shader_objects") &&
>> +
>> piglit_is_extension_supported("GL_ARB_vertex_shader")))
>> +                       return PIGLIT_SKIP;
>>                 break;
>>         case GL_FRAGMENT_SHADER:
>> -               piglit_require_fragment_shader();
>> +               if (piglit_get_gl_version() < 20 &&
>> +
>> !(piglit_is_extension_supported("GL_ARB_shader_objects") &&
>> +
>> piglit_is_extension_supported("GL_ARB_fragment_shader")))
>> +                       return PIGLIT_SKIP;
>>                 break;
>>         case GL_TESS_CONTROL_SHADER:
>>         case GL_TESS_EVALUATION_SHADER:
>>                 if (gl_version.num < (gl_version.es ? 32 : 40))
>> -                       piglit_require_extension(gl_version.es ?
>> -
>> "GL_OES_tessellation_shader" :
>> -
>> "GL_ARB_tessellation_shader");
>> +                       if (!piglit_is_extension_supported(gl_version.es ?
>> +
>> "GL_OES_tessellation_shader" :
>> +
>> "GL_ARB_tessellation_shader"))
>> +                               return PIGLIT_SKIP;
>>                 break;
>>         case GL_GEOMETRY_SHADER:
>>                 if (gl_version.num < 32)
>> -                       piglit_require_extension(gl_version.es ?
>> -                                                "GL_OES_geometry_shader"
>> :
>> -
>> "GL_ARB_geometry_shader4");
>> +                       if (!piglit_is_extension_supported(gl_version.es ?
>> +
>> "GL_OES_geometry_shader" :
>> +
>> "GL_ARB_geometry_shader4"))
>> +                               return PIGLIT_SKIP;
>>                 break;
>>         case GL_COMPUTE_SHADER:
>>                 if (gl_version.num < (gl_version.es ? 31 : 43))
>> -                       piglit_require_extension("GL_ARB_compute_shader");
>> +                       if
>> (!piglit_is_extension_supported("GL_ARB_compute_shader"))
>> +                               return PIGLIT_SKIP;
>>                 break;
>>         }
>>
>>         if (!glsl_req_version.num) {
>>                 printf("GLSL version requirement missing\n");
>> -               piglit_report_result(PIGLIT_FAIL);
>> +               return PIGLIT_FAIL;
>>         }
>>
>>         if (!strstr(shader_string, "#version ")) {
>> @@ -441,7 +450,7 @@ compile_glsl(GLenum target)
>>                         info);
>>
>>                 free(info);
>> -               piglit_report_result(PIGLIT_FAIL);
>> +               return PIGLIT_FAIL;
>>         }
>>
>>         switch (target) {
>> @@ -470,9 +479,10 @@ compile_glsl(GLenum target)
>>                 num_compute_shaders++;
>>                 break;
>>         }
>> +       return PIGLIT_PASS;
>>  }
>>
>> -static void
>> +static enum piglit_result
>>  compile_and_bind_program(GLenum target, const char *start, int len)
>>  {
>>         GLuint prog;
>> @@ -480,25 +490,29 @@ compile_and_bind_program(GLenum target, const char
>> *start, int len)
>>
>>         switch (target) {
>>         case GL_VERTEX_PROGRAM_ARB:
>> -               piglit_require_extension("GL_ARB_vertex_program");
>> +               if
>> (!piglit_is_extension_supported("GL_ARB_vertex_program"))
>> +                       return PIGLIT_SKIP;
>>                 break;
>>         case GL_FRAGMENT_PROGRAM_ARB:
>> -               piglit_require_extension("GL_ARB_fragment_program");
>> +               if
>> (!piglit_is_extension_supported("GL_ARB_fragment_program"))
>> +                       return PIGLIT_SKIP;
>>                 break;
>>         }
>>
>>         source = malloc(len + 1);
>>         memcpy(source, start, len);
>>         source[len] = 0;
>> -       prog = piglit_compile_program(target, source);
>> +       prog = piglit_compile_program(target, source);//TODO
>
>
> Maybe a slightly more enlightening comment? ;-)

That //TODO can be removed. I don't remember why I added it - maybe
for propagating errors? It's probably not needed anymore.

Marek


More information about the Piglit mailing list