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

Juan A. Suarez Romero jasuarez at igalia.com
Mon Feb 22 12:02:37 UTC 2016


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.



More information about the mesa-dev mailing list