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

Eric Anholt eric at anholt.net
Wed Apr 2 14:11:58 PDT 2014


Eric Anholt <eric at anholt.net> writes:

> 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.

did I say dropped?  I've now separated it out to a new commit:

commit 4830ec6d7cfbf0b7e4a39aa02c8203738706fe30
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Apr 1 21:15:42 2014 -0700

    glamor: Use plain GLSL 1.20 features for fill code.
    
    This prevents performance regressions from losing acceleration support
    on older hardware as we transition to using glamor_program.c for
    acceleration.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- 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/225ba493/attachment.sig>


More information about the xorg-devel mailing list