[Mesa-dev] [PATCH v3 5/6] glsl: fix matrix stride calculation for std430's row_major matrices with two columns

Timothy Arceri t_arceri at yahoo.com.au
Wed Oct 7 15:47:44 PDT 2015


On Wed, 2015-10-07 at 09:21 +0200, Samuel Iglesias Gonsalvez wrote:
> It doesn't round up to vec4 size.
> 
> Fixes 15 dEQP tests:
> 
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_low
> p_mat2
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_med
> iump_mat2
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_hig
> hp_mat2
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_low
> p_mat2x3
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_med
> iump_mat2x3
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_hig
> hp_mat2x3
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_low
> p_mat2x4
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_med
> iump_mat2x4
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_hig
> hp_mat2x4
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_ma
> t2
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_ma
> t2x3
> dEQP
> -GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_ma
> t2x4
> dEQP
> -GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_m
> ajor_mat2
> dEQP
> -GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_m
> ajor_mat2x3
> dEQP
> -GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_m
> ajor_mat2x4
> 
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
>  src/glsl/lower_ubo_reference.cpp | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/glsl/lower_ubo_reference.cpp
> b/src/glsl/lower_ubo_reference.cpp
> index 247620e..183435e 100644
> --- a/src/glsl/lower_ubo_reference.cpp
> +++ b/src/glsl/lower_ubo_reference.cpp
> @@ -744,7 +744,14 @@ lower_ubo_reference_visitor::emit_access(bool
> is_write,
>         * or 32 depending on the number of columns.
>         */
>        assert(matrix_columns <= 4);
> -      unsigned matrix_stride = glsl_align(matrix_columns * N, 16);
> +      unsigned matrix_stride = 0;
> +      /* matrix stride for std430 mat2xY matrices are not rounded up
> to
> +       * vec4 size.
> +       */

Is there a spec quote you can use here with section number spec version
etc?

> +      if (packing == GLSL_INTERFACE_PACKING_STD430 && matrix_columns
> == 2)
> +         matrix_stride = 2 * N;
> +      else
> +         matrix_stride = glsl_align(matrix_columns * N, 16);
>  
>        const glsl_type *deref_type = deref->type->base_type ==
> GLSL_TYPE_FLOAT ?
>           glsl_type::float_type : glsl_type::double_type;


More information about the mesa-dev mailing list