Re: [Mesa-dev] How to get uniform components used by uniform variables

2016-02-22 Thread Juan A. Suarez Romero
On Mon, 2016-02-22 at 14:13 +0200, Tapani Pälli wrote:
> > So rather than reporting the number of uniform components it is
> > consuming, is reporting the bytes used in the layout.
> >
> 
> Ah right, I see. Maybe you can query OFFSET then, this should differ 
> then when matrix has a different type?

I've tested with an UBO containing 3 floats:

uniform ssbo1 {
  float f1;
  float f2;
  float f3;
};

When query OFFSET for each of f1, f2 and f3, I get 0, 4, and 8,
respectively. That is, the offset in bytes inside the layout.

Seems more about querying the layout. But I'm not sure if this really
translates to "uniform components". Seems more about querying the 


J.A.

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


Re: [Mesa-dev] How to get uniform components used by uniform variables

2016-02-22 Thread Tapani Pälli



On 02/22/2016 02:02 PM, Juan A. Suarez Romero wrote:

On Mon, 2016-02-22 at 13:47 +0200, Tapani Pälli wrote:

Maybe one way would be to include these matrices in UBO or SSBO and
then
query BUFFER_DATA_SIZE for that buffer. That should return
"implementation-dependent minimum total buffer object size".

https://www.opengl.org/registry/specs/ARB/program_interface_query.txt



Thank you!

That API was one of the first thing I was checking :)

But it doesn't provide what I'm looking for. Rather, seems to return
the size it requires the UBO to store the content with a specific
layout.

For instance, having this UBO:

uniform ubo1 {
   float f;
};


And using the proper function from that extension to query "ubo1", it
returns 16. Which is the size required to store a vec4, according to
layout rules.

If I modify the UBO and add another value:

uniform ubo1 {
   float f;
   int i;
};

And querying again, it still returns 16, as both elements fits in that
size.

So rather than reporting the number of uniform components it is
consuming, is reporting the bytes used in the layout.



Ah right, I see. Maybe you can query OFFSET then, this should differ 
then when matrix has a different type?


// Tapani
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] How to get uniform components used by uniform variables

2016-02-22 Thread Juan A. Suarez Romero
On Mon, 2016-02-22 at 13:47 +0200, Tapani Pälli wrote:
> Maybe one way would be to include these matrices in UBO or SSBO and
> then 
> query BUFFER_DATA_SIZE for that buffer. That should return 
> "implementation-dependent minimum total buffer object size".
> 
> https://www.opengl.org/registry/specs/ARB/program_interface_query.txt
> 

Thank you!

That API was one of the first thing I was checking :)

But it doesn't provide what I'm looking for. Rather, seems to return
the size it requires the UBO to store the content with a specific
layout.

For instance, having this UBO:

uniform ubo1 {
  float f;
};


And using the proper function from that extension to query "ubo1", it
returns 16. Which is the size required to store a vec4, according to
layout rules.

If I modify the UBO and add another value:

uniform ubo1 {
  float f;
  int i;
};

And querying again, it still returns 16, as both elements fits in that
size.

So rather than reporting the number of uniform components it is
consuming, is reporting the bytes used in the layout.


J.A.

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


Re: [Mesa-dev] How to get uniform components used by uniform variables

2016-02-22 Thread Tapani Pälli



On 02/22/2016 01:39 PM, Juan A. Suarez Romero wrote:

Hello.

I'm working on providing piglit with tests for the
GL_ARB_gpu_shader_fp64 extension[1].


One of the modifications it does is referring uniform variables:

"Modify Section 2.14.4, Uniform Variables, p. 89

(modify third paragraph, p. 90) ... uniform variable storage for vertex
shader.  A uniform matrix with single- or double-precision components
will consume no more than 4 * min(r,c) or 8 * min(r,c) uniform
components, respectively.  A scalar or vector uniform with double-
precision components will consume no more than 2 components, where
 is 1 for scalars, and the component count for vectors.  A link
error is generated ..."


So a float/int/bool consumes 1 UC (Uniform Component), and a double
consumes 2 UCs. A vec3 for instance will consume 3*1=3 UCs, and a
dvec3, 3*2=6 UCs.

The interesting part is about matrices: a mat3x2 won't consume more
than 4*min(3,2)=8 UCs (ideally would consume 1*3*2=6 UCs, but spec
allows a bit more), while a dmat3x2 will consume 8*min(3,2)=16 UCs
(again, ideally 2*3*2=12 UCs).

The question is, how to test this (if it is possible)? I didn't find
any way to know how many UCs an uniform variable is consuming, either
direct or indirectly.

Does any know if it is possible, and how to do it? I guess it should be
possible, otherwise I don't see the point of specifying something that
can be tested later.


Maybe one way would be to include these matrices in UBO or SSBO and then 
query BUFFER_DATA_SIZE for that buffer. That should return 
"implementation-dependent minimum total buffer object size".


https://www.opengl.org/registry/specs/ARB/program_interface_query.txt



Thanks in advance!


[1]https://www.opengl.org/registry/specs/ARB/gpu_shader_fp64.txt
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev




// Tapani
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] How to get uniform components used by uniform variables

2016-02-22 Thread Juan A. Suarez Romero
Hello.

I'm working on providing piglit with tests for the
GL_ARB_gpu_shader_fp64 extension[1].


One of the modifications it does is referring uniform variables:

"Modify Section 2.14.4, Uniform Variables, p. 89

(modify third paragraph, p. 90) ... uniform variable storage for vertex
shader.  A uniform matrix with single- or double-precision components
will consume no more than 4 * min(r,c) or 8 * min(r,c) uniform
components, respectively.  A scalar or vector uniform with double-
precision components will consume no more than 2 components, where
 is 1 for scalars, and the component count for vectors.  A link
error is generated ..."


So a float/int/bool consumes 1 UC (Uniform Component), and a double
consumes 2 UCs. A vec3 for instance will consume 3*1=3 UCs, and a
dvec3, 3*2=6 UCs.

The interesting part is about matrices: a mat3x2 won't consume more
than 4*min(3,2)=8 UCs (ideally would consume 1*3*2=6 UCs, but spec
allows a bit more), while a dmat3x2 will consume 8*min(3,2)=16 UCs
(again, ideally 2*3*2=12 UCs).

The question is, how to test this (if it is possible)? I didn't find
any way to know how many UCs an uniform variable is consuming, either
direct or indirectly.

Does any know if it is possible, and how to do it? I guess it should be
possible, otherwise I don't see the point of specifying something that
can be tested later.

Thanks in advance!


[1]https://www.opengl.org/registry/specs/ARB/gpu_shader_fp64.txt
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev