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

2015-10-02 Thread Samuel Iglesias Gonsalvez
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 
---
 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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2015-10-02 Thread Ilia Mirkin
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
 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 
> ---
>  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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2015-10-02 Thread Samuel Iglesias Gonsálvez


On 02/10/15 09:20, Ilia Mirkin wrote:
> I'm a little concerned that your random ssbo packing tests didn't pick
> this up... can you double-check your script?
> 

The script generates shader_runner tests that query GL_MATRIX_STRIDE
using ARB_program_interface_query's calls but it has not support for
checking that it is writing/reading to the proper places yet.

That queries are fine. This patch is to fix the SSBO load/stores
operations with std430 and row_major mat2xY matrices.

Sam

> On Fri, Oct 2, 2015 at 3:13 AM, 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_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 
>> ---
>>  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@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2015-10-02 Thread Ilia Mirkin
On Fri, Oct 2, 2015 at 3:34 AM, Samuel Iglesias Gonsálvez
 wrote:
> On 02/10/15 09:20, Ilia Mirkin wrote:
>> I'm a little concerned that your random ssbo packing tests didn't pick
>> this up... can you double-check your script?
>>
>
> The script generates shader_runner tests that query GL_MATRIX_STRIDE
> using ARB_program_interface_query's calls but it has not support for
> checking that it is writing/reading to the proper places yet.

Oh. That explains it. Might I suggest implementing such support? :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2015-10-02 Thread Samuel Iglesias Gonsálvez


On 02/10/15 09:39, Ilia Mirkin wrote:
> On Fri, Oct 2, 2015 at 3:34 AM, Samuel Iglesias Gonsálvez
>  wrote:
>> On 02/10/15 09:20, Ilia Mirkin wrote:
>>> I'm a little concerned that your random ssbo packing tests didn't pick
>>> this up... can you double-check your script?
>>>
>>
>> The script generates shader_runner tests that query GL_MATRIX_STRIDE
>> using ARB_program_interface_query's calls but it has not support for
>> checking that it is writing/reading to the proper places yet.
> 
> Oh. That explains it. Might I suggest implementing such support? :)
> 

Yeah, sure. I add it to my todo list :-)

Sam
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev