[Piglit] [PATCH 03/10] sso: Use pick_a_glsl_version utility function

Jordan Justen jljusten at gmail.com
Mon May 5 20:32:21 PDT 2014


Patches 2 & 3,
sso: Add utility function to select the GLSL version
sso: Use pick_a_glsl_version utility function
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

On Sun, Apr 27, 2014 at 2:12 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Existing tests had this open-coded.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  tests/spec/arb_separate_shader_objects/400-combinations.c   | 13 ++-----------
>  .../ActiveShaderProgram-invalid-program.c                   |  8 ++------
>  tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt    |  6 +++---
>  .../arb_separate_shader_objects/rendezvous_by_location.c    | 13 ++-----------
>  4 files changed, 9 insertions(+), 31 deletions(-)
>
> diff --git a/tests/spec/arb_separate_shader_objects/400-combinations.c b/tests/spec/arb_separate_shader_objects/400-combinations.c
> index 388536f..8278983 100644
> --- a/tests/spec/arb_separate_shader_objects/400-combinations.c
> +++ b/tests/spec/arb_separate_shader_objects/400-combinations.c
> @@ -40,6 +40,7 @@
>   * (with --by-location command line parameter).
>   */
>  #include "piglit-util-gl-common.h"
> +#include "sso-common.h"
>
>  /**
>   * Size of each square that will be drawn.
> @@ -199,9 +200,6 @@ piglit_init(int argc, char **argv)
>         unsigned i;
>         unsigned j;
>         unsigned idx;
> -       bool es;
> -       int glsl_major;
> -       int glsl_minor;
>         const char *location;
>         const char *vertex_name;
>         const char *fragment_name;
> @@ -227,14 +225,7 @@ piglit_init(int argc, char **argv)
>                 fragment_name = "in_color";
>         }
>
> -       /* Some NVIDIA drivers have issues with layout qualifiers, 'in'
> -        * keywords, and 'out' keywords in "lower" GLSL versions.  If the
> -        * driver supports GLSL >= 1.40, use 1.40.  Otherwise, pick the
> -        * highest version that the driver supports.
> -        */
> -       piglit_get_glsl_version(&es, &glsl_major, &glsl_minor);
> -       glsl_version = ((glsl_major * 100) + glsl_minor) >= 140
> -               ? 140 : ((glsl_major * 100) + glsl_minor);
> +       glsl_version = pick_a_glsl_version();
>
>         /* Generate the vertex shader programs.  Each vertex shader is
>          * hardcoded to select a specific column on the display.
> diff --git a/tests/spec/arb_separate_shader_objects/ActiveShaderProgram-invalid-program.c b/tests/spec/arb_separate_shader_objects/ActiveShaderProgram-invalid-program.c
> index 5f8b696..fa15f93 100644
> --- a/tests/spec/arb_separate_shader_objects/ActiveShaderProgram-invalid-program.c
> +++ b/tests/spec/arb_separate_shader_objects/ActiveShaderProgram-invalid-program.c
> @@ -40,6 +40,7 @@
>   */
>
>  #include "piglit-util-gl-common.h"
> +#include "sso-common.h"
>
>  PIGLIT_GL_TEST_CONFIG_BEGIN
>
> @@ -68,16 +69,11 @@ piglit_init(int argc, char **argv)
>         GLuint unlinked_prog;
>         GLuint shader;
>         unsigned glsl_version;
> -       bool es;
> -       int glsl_major;
> -       int glsl_minor;
>         char *source;
>
>         piglit_require_extension("GL_ARB_separate_shader_objects");
>
> -       piglit_get_glsl_version(&es, &glsl_major, &glsl_minor);
> -       glsl_version = ((glsl_major * 100) + glsl_minor) >= 140
> -               ? 140 : ((glsl_major * 100) + glsl_minor);
> +       glsl_version = pick_a_glsl_version();
>
>         glGenProgramPipelines(1, &pipe);
>         pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
> diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> index b8ac47d..f0dcf01 100644
> --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> @@ -9,13 +9,13 @@ link_libraries (
>         ${OPENGL_glu_LIBRARY}
>  )
>
> -piglit_add_executable (arb_separate_shader_object-400-combinations 400-combinations.c)
> +piglit_add_executable (arb_separate_shader_object-400-combinations 400-combinations.c sso-common.c)
>  piglit_add_executable (arb_separate_shader_object-active-sampler-conflict active-sampler-conflict.c)
> -piglit_add_executable (arb_separate_shader_object-ActiveShaderProgram-invalid-program ActiveShaderProgram-invalid-program.c)
> +piglit_add_executable (arb_separate_shader_object-ActiveShaderProgram-invalid-program ActiveShaderProgram-invalid-program.c sso-common.c)
>  piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv GetProgramPipelineiv.c)
>  piglit_add_executable (arb_separate_shader_object-IsProgramPipeline IsProgramPipeline.c)
>  piglit_add_executable (arb_separate_shader_object-mix_pipeline_useprogram mix_pipeline_useprogram.c)
>  piglit_add_executable (arb_separate_shader_object-ProgramUniform-coverage ProgramUniform-coverage.c)
> -piglit_add_executable (arb_separate_shader_object-rendezvous_by_location rendezvous_by_location.c)
> +piglit_add_executable (arb_separate_shader_object-rendezvous_by_location rendezvous_by_location.c sso-common.c)
>  piglit_add_executable (arb_separate_shader_object-UseProgramStages-non-separable UseProgramStages-non-separable.c)
>  piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline ValidateProgramPipeline.c)
> diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
> index 4193ea5..b44211c 100644
> --- a/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
> +++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
> @@ -42,6 +42,7 @@
>   * shader.
>   */
>  #include "piglit-util-gl-common.h"
> +#include "sso-common.h"
>
>  PIGLIT_GL_TEST_CONFIG_BEGIN
>
> @@ -140,9 +141,6 @@ void piglit_init(int argc, char **argv)
>         GLuint vs_prog;
>         GLuint fs_prog_same_declaration_order;
>         GLuint fs_prog_same_location_order;
> -       bool es;
> -       int glsl_major;
> -       int glsl_minor;
>         char *source;
>
>         piglit_require_vertex_shader();
> @@ -150,14 +148,7 @@ void piglit_init(int argc, char **argv)
>         piglit_require_extension("GL_ARB_separate_shader_objects");
>         piglit_require_extension("GL_ARB_explicit_attrib_location");
>
> -       /* Some NVIDIA drivers have issues with layout qualifiers, 'in'
> -        * keywords, and 'out' keywords in "lower" GLSL versions.  If the
> -        * driver supports GLSL >= 1.40, use 1.40.  Otherwise, pick the
> -        * highest version that the driver supports.
> -        */
> -       piglit_get_glsl_version(&es, &glsl_major, &glsl_minor);
> -       glsl_version = ((glsl_major * 100) + glsl_minor) >= 140
> -               ? 140 : ((glsl_major * 100) + glsl_minor);
> +       glsl_version = pick_a_glsl_version();
>
>         asprintf(&source, vs_code_template, glsl_version);
>         vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
> --
> 1.8.1.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list