[Mesa-dev] [PATCH] glsl: add forgotten textureOffset function for sampler2DArrayShadow

Roland Scheidegger sroland at vmware.com
Mon Apr 18 23:55:39 UTC 2016


Am 19.04.2016 um 00:43 schrieb Ian Romanick:
> On 04/18/2016 02:05 PM, sroland at vmware.com wrote:
>> From: Roland Scheidegger <sroland at vmware.com>
>>
>> This was part of EXT_gpu_shader4 - as such it should have been supported
>> by glsl 130.
>> It was however forgotten, and not added until glsl 430 - with the wrong
>> syntax no less (glsl 430 mentions it was overlooked).
>> glsl 440 (but revision 8 only) fixed this finally for good.
>> It looks like most other implementations would support this with older
>> glsl versions as well, so just add this to the other glsl 130 textureOffset
> 
> Can you clarify this?  I believe that it would work on NVIDIA when the
> shader doesn't specify an explicit version.  Does it work on NVIDIA with
> an explicit #version 130?  How about AMD?
I haven't tried myself. Someone else however working on our gl backend
hit this issue on intel drivers (we just assumed the function was
available). With nvidia it works with #version 150 at least (and I can't
see why it would make sense to support it in 150 but not 130). Not sure
about AMD. (It actually seems problematic to detect if it's working or
not, since we don't usually require glsl 4.40, it was wrong in 4.30
even, and the spec doesn't really say it should be retroactively enabled
on older versions.)
I suppose I should add it to some piglit really...

> 
>> functions.
>>
>> (Completely untested...)
>> ---
>>  src/compiler/glsl/builtin_functions.cpp | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
>> index f488434..004beb9 100644
>> --- a/src/compiler/glsl/builtin_functions.cpp
>> +++ b/src/compiler/glsl/builtin_functions.cpp
>> @@ -1707,6 +1707,9 @@ builtin_builder::create_builtins()
>>                  _texture(ir_tex, v130, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET),
>>  
>>                  _texture(ir_tex, v130, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET),
>> +                /* the next one was forgotten in glsl spec (it's from EXT_gpu_shader4 initially),
>> +                   had wrong syntax in 4.30, correct only in 4.40 but allow it in 130 */
> 
> How about:
> 
>                 /* The next one was forgotten in GLSL 1.30 spec.  It's from
>                  * EXT_gpu_shader4 originally.  It was added in 4.30 with the
>                  * wrong syntax.  This was corrected in 4.40.  4.30 indicates
>                  * that it was intended to be included previously, so allow it
>                  * in 1.30.
>                  */
Ahh yes that sounds great.

Roland


> 
>> +                _texture(ir_tex, v130, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_OFFSET),
>>  
>>                  _texture(ir_txb, v130_fs_only, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_OFFSET),
>>                  _texture(ir_txb, v130_fs_only, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_OFFSET),
>>
> 



More information about the mesa-dev mailing list