[Mesa-dev] [PATCH 15/20] glsl/es3.1: Allow textureGather and textureGatherOffset in GLSL ES 3.10

Ilia Mirkin imirkin at alum.mit.edu
Thu Apr 30 15:03:11 PDT 2015


On Thu, Apr 30, 2015 at 5:56 PM, Chris Forbes <chrisf at ijw.co.nz> wrote:
>>  /* Only ARB_texture_gather but not GLSL 4.0 or ARB_gpu_shader5.
>>   * used for relaxation of const offset requirements.
>>   */
>>  static bool
>> -texture_gather_only(const _mesa_glsl_parse_state *state)
>> +texture_gather_only_or_es31(const _mesa_glsl_parse_state *state)
>>  {
>>     return !state->is_version(400, 0) &&
>>            !state->ARB_gpu_shader5_enable &&
>> -          state->ARB_texture_gather_enable;
>> +          (state->ARB_texture_gather_enable ||
>> +           state->is_version(0, 310));
>>  }
>
> I don't think this is correct. This is used to enable the restricted
> versions of textureGather/textureGatherOffset which require a constant
> offset. This restriction doesn't appear to exist in ES3.1 -- it's more
> or less the GS5 version.
>
> An example pair, where at most one should be enabled:
>     _texture(ir_tg4, texture_gather_only, glsl_type::vec4_type,
> glsl_type::sampler2D_type, glsl_type::vec2_type, TEX_OFFSET),
>     _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type,
> glsl_type::sampler2D_type, glsl_type::vec2_type, TEX_OFFSET_NONCONST),

>From my read of GLSL ES 3.10, it requires const offsets. Non-const
support is added in EXT_gpu_shader5:

      * extending the textureGather() built-in functions provided by
        OpenGL ES Shading Language 3.10:

        * allowing shaders to use arbitrary offsets computed at run-time to
          select a 2x2 footprint to gather from; and

  -ilia


More information about the mesa-dev mailing list