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

Ilia Mirkin imirkin at alum.mit.edu
Fri Oct 2 00:20:48 PDT 2015


I'm a little concerned that your random ssbo packing tests didn't pick
this up... can you double-check your script?

On Fri, Oct 2, 2015 at 3:13 AM, Samuel Iglesias Gonsalvez
<siglesias at igalia.com> wrote:
> It doesn't round up to vec4 size.
>
> Fixes 15 dEQP tests:
>
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_lowp_mat2
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_mediump_mat2
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_highp_mat2
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_lowp_mat2x3
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_mediump_mat2x3
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_highp_mat2x3
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_lowp_mat2x4
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_mediump_mat2x4
> dEQP-GLES31.functional.ssbo.layout.single_basic_type.std430.row_major_highp_mat2x4
> dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat2
> dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat2x3
> dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat2x4
> dEQP-GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_major_mat2
> dEQP-GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_major_mat2x3
> dEQP-GLES31.functional.ssbo.layout.instance_array_basic_type.std430.row_major_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.
> +       */
> +      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;
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list