[Mesa-dev] [PATCH v2 17/31] glsl: reject bindless samplers/images frag inputs without 'flat'

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Apr 26 08:05:41 UTC 2017



On 04/26/2017 09:37 AM, Nicolai Hähnle wrote:
> On 24.04.2017 12:35, Samuel Pitoiset wrote:
>> The ARB_bindless_texture spec says:
>>
>>    "Modify Section 4.3.4, Inputs, p. 34"
>>
>>    "(modify last paragraph, p. 35, allowing samplers and images as
>>     fragment shader inputs) ... Fragment inputs can only be signed
>>     and unsigned integers and integer vectors, floating point scalars,
>>     floating-point vectors, matrices, sampler and image types, or
>>     arrays or structures of these.  Fragment shader inputs that are
>>     signed or unsigned integers, integer vectors, or any
>>     double-precision floating- point type, or any sampler or image
>>     type must be qualified with the interpolation qualifier "flat"."
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>  src/compiler/glsl/ast_to_hir.cpp | 22 ++++++++++++++++++++++
>>  1 file changed, 22 insertions(+)
>>
>> diff --git a/src/compiler/glsl/ast_to_hir.cpp 
>> b/src/compiler/glsl/ast_to_hir.cpp
>> index 02f7d5f71c..ae81ed95d8 100644
>> --- a/src/compiler/glsl/ast_to_hir.cpp
>> +++ b/src/compiler/glsl/ast_to_hir.cpp
>> @@ -2995,6 +2995,28 @@ 
>> validate_fragment_flat_interpolation_input(struct 
>> _mesa_glsl_parse_state *state,
>>        _mesa_glsl_error(loc, state, "if a fragment input is (or 
>> contains) "
>>                         "a double, then it must be qualified with 
>> 'flat'");
>>     }
>> +
>> +   /* Bindless sampler/image fragment inputs must be qualified with 
>> 'flat'.
>> +    *
>> +    * The ARB_bindless_texture spec says:
>> +    *
>> +    *    "Modify Section 4.3.4, Inputs, p. 34"
>> +    *
>> +    *    "(modify last paragraph, p. 35, allowing samplers and images as
>> +    *     fragment shader inputs) ... Fragment inputs can only be 
>> signed and
>> +    *     unsigned integers and integer vectors, floating point scalars,
>> +    *     floating-point vectors, matrices, sampler and image types, 
>> or arrays
>> +    *     or structures of these.  Fragment shader inputs that are 
>> signed or
>> +    *     unsigned integers, integer vectors, or any double-precision 
>> floating-
>> +    *     point type, or any sampler or image type must be qualified 
>> with the
>> +    *     interpolation qualifier "flat"."
>> +    */
>> +   if (state->has_bindless()
>> +       && (var_type->contains_sampler() || 
>> var_type->contains_image())) {
> 
> The state->has_bindless() check is a bit redundant.
> 
> Then again, that matches the other code in the function. So either way,

Exactly.

> 
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> 
>> +      _mesa_glsl_error(loc, state, "if a fragment input is (or 
>> contains) "
>> +                       "a bindless sampler (or image), then it must be "
>> +                       "qualified with 'flat'");
>> +   }
>>  }
>>
>>  static void
>>
> 
> 


More information about the mesa-dev mailing list