[Mesa-dev] [PATCH v2 11/31] glsl: fix std140/std430 interfaces for bindless samplers/images

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Apr 26 10:19:20 UTC 2017



On 04/26/2017 04:44 AM, Timothy Arceri wrote:
> Can we just update is_scalar instead?

That should work but only if vector_elements is 1 for samplers.

> 
> On 24/04/17 20:35, Samuel Pitoiset wrote:
>> The ARB_bindless_texture spec says:
>>
>>     "Samplers are represented using 64-bit integer handles".
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/compiler/glsl_types.cpp | 28 ++++++++++++++++++++++++++++
>>   1 file changed, 28 insertions(+)
>>
>> diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
>> index df148cfd21..0b5cacd7f3 100644
>> --- a/src/compiler/glsl_types.cpp
>> +++ b/src/compiler/glsl_types.cpp
>> @@ -1497,6 +1497,13 @@ glsl_type::std140_base_alignment(bool 
>> row_major) const
>>         }
>>      }
>> +   /* The ARB_bindless_texture spec says:
>> +    *
>> +    * "Samplers are represented using 64-bit integer handles".
>> +    */
>> +   if (this->is_sampler() || this->is_image())
>> +      return N;
>> +
>>      /* (4) If the member is an array of scalars or vectors, the base 
>> alignment
>>       *     and array stride are set to match the base alignment of a 
>> single
>>       *     array element, according to rules (1), (2), and (3), and 
>> rounded up
>> @@ -1607,6 +1614,13 @@ glsl_type::std140_size(bool row_major) const
>>         return this->vector_elements * N;
>>      }
>> +   /* The ARB_bindless_texture spec says:
>> +    *
>> +    * "Samplers are represented using 64-bit integer handles".
>> +    */
>> +   if (this->is_sampler() || this->is_image())
>> +      return N;
>> +
>>      /* (5) If the member is a column-major matrix with <C> columns and
>>       *     <R> rows, the matrix is stored identically to an array of
>>       *     <C> column vectors with <R> components each, according to
>> @@ -1752,6 +1766,13 @@ glsl_type::std430_base_alignment(bool 
>> row_major) const
>>         }
>>      }
>> +   /* The ARB_bindless_texture spec says:
>> +    *
>> +    * "Samplers are represented using 64-bit integer handles".
>> +    */
>> +   if (this->is_sampler() || this->is_image())
>> +      return N;
>> +
>>      /* OpenGL 4.30 spec, section 7.6.2.2 "Standard Uniform Block 
>> Layout":
>>       *
>>       * "When using the std430 storage layout, shader storage blocks 
>> will be
>> @@ -1868,6 +1889,13 @@ glsl_type::std430_size(bool row_major) const
>>      if (this->is_scalar() || this->is_vector())
>>            return this->vector_elements * N;
>> +   /* The ARB_bindless_texture spec says:
>> +    *
>> +    * "Samplers are represented using 64-bit integer handles".
>> +    */
>> +   if (this->is_sampler() || this->is_image())
>> +      return N;
>> +
>>      if (this->without_array()->is_matrix()) {
>>         const struct glsl_type *element_type;
>>         const struct glsl_type *vec_type;
>>


More information about the mesa-dev mailing list