[PATCH 02/16] glamor: Compute supported GLSL version and save in screen private

Eric Anholt eric at anholt.net
Wed Apr 2 12:04:45 PDT 2014


Keith Packard <keithp at keithp.com> writes:

> This currently computes the GLSL version in a fairly naïve fashion,
> and leaves that in the screen private for other users. This will let
> us update the version computation in one place later on.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  glamor/glamor.c         |  9 +++++++++
>  glamor/glamor_priv.h    |  1 +
>  glamor/glamor_program.c | 17 ++++-------------
>  3 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/glamor/glamor.c b/glamor/glamor.c
> index a7d981c..d7192c1 100644
> --- a/glamor/glamor.c
> +++ b/glamor/glamor.c
> @@ -353,6 +353,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
>  
>      gl_version = epoxy_gl_version();
>  
> +    /* Would be nice to have a cleaner test for GLSL 1.30 support,
> +     * but for now this should suffice
> +     */
> +    if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && gl_version >= 30)
> +        glamor_priv->glsl_version = 130;
> +    else
> +        glamor_priv->glsl_version = 120;
> +
> +
>      /* We'd like to require GL_ARB_map_buffer_range or
>       * GL_OES_map_buffer_range, since it offers more information to
>       * the driver than plain old glMapBuffer() or glBufferSubData().
> diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
> index 4c305ab..36f9b71 100644
> --- a/glamor/glamor_priv.h
> +++ b/glamor/glamor_priv.h
> @@ -205,6 +205,7 @@ typedef struct glamor_screen_private {
>      Bool yInverted;
>      unsigned int tick;
>      enum glamor_gl_flavor gl_flavor;
> +    int glsl_version;
>      int has_pack_invert;
>      int has_fbo_blit;
>      int has_map_buffer_range;
> diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
> index e2e1434..cdd95ea 100644
> --- a/glamor/glamor_program.c
> +++ b/glamor/glamor_program.c
> @@ -45,9 +45,8 @@ use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
>  
>  static const glamor_facet glamor_fill_tile = {
>      .name = "tile",
> -    .version = 130,
> -    .vs_exec =  "       fill_pos = fill_offset + primitive.xy + pos;\n",
> -    .fs_exec =  "       gl_FragColor = texelFetch(sampler, ivec2(mod(fill_pos,fill_size)), 0);\n",
> +    .vs_exec =  "       fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
> +    .fs_exec =  "       gl_FragColor = texture2D(sampler, fill_pos);\n",
>      .locations = glamor_program_location_fill,
>      .use = use_tile,
>  };

Looks like there was some squashing failure here.  I've dropped this
hunk in applying the patch.

> @@ -240,16 +239,8 @@ glamor_build_program(ScreenPtr          screen,
>      flags |= fill->flags;
>      version = MAX(version, fill->version);
>  
> -    if (version >= 130) {
> -
> -        /* Would be nice to have a cleaner test for GLSL 1.30 support,
> -         * but for now this should suffice
> -         */
> -        if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP ||
> -            epoxy_gl_version() < 30) {
> -            goto fail;
> -        }
> -    }
> +    if (version > glamor_priv->glsl_version)
> +        goto fail;
>  
>      vs_vars = vs_location_vars(locations);
>      fs_vars = fs_location_vars(locations);
> -- 
> 1.9.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140402/7143eb10/attachment.sig>


More information about the xorg-devel mailing list