[Mesa-dev] [PATCH v4 (part2) 20/59] glsl: Add parser/compiler support for std430 interface packing qualifier

Ian Romanick idr at freedesktop.org
Wed Sep 9 19:04:26 PDT 2015


On 09/09/2015 03:32 AM, Samuel Iglesias Gonsálvez wrote:
> On 31/08/15 08:38, Samuel Iglesias Gonsálvez wrote:
>> On 29/08/15 02:27, Jordan Justen wrote:
>>> Hmm, you quoted the extension spec, but the 4.30 spec has: "When using
>>> the std430 storage layout, shader storage blocks will be laid out in
>>> buffer storage identically to uniform and shader storage blocks using
>>> the std140 layout, except that the base alignment and stride of arrays
>>> of scalars and vectors in rule 4 and of structures in rule 9 are not
>>> rounded up a multiple of the base alignment of a vec4 ."
>>>
>>> Notably, it mentions stride. Wouldn't this be wrong for a vec3 array,
>>> where the stride should be 12 bytes?
>>>
>>
>> Good catch! Both specs differ in this case. I will update the comment.
>>
>> Right now, we are using a 16 bytes stride for an array of vec3s. NVIDIA
>> proprietary driver (4.50 NVIDIA 352.21) does the same.
>>
>> I am going to modify our code to fix this case. Thanks!
>>
> 
> Before doing any change, I have investigated which is the proper stride
> value for array of vec3. From 4.30 spec:
> 
> "3. If the member is a three-component vector with components consuming
> N basic machine units, the base alignment is 4N."

Not sure if this helps, but issue 8 in the ARB_ssbo spec says:

      Note that in the "std430" packing, arrays of vec3s are still not tightly
      packed; vec3 types still require a 16B alignment as in "std140".

> std430 explicitly says that the base alignment and stride of arrays of
> scalars and vectors in rule 4 are not rounded up a multiple of the base
> alignment of a vec4. But it doesn't mention any change to rule 3.
> 
> According to rule (3) and std430 changes to rule (4), the stride should
> be 16 for an array of vec3.
> 
> Sam



More information about the mesa-dev mailing list