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

Tapani Pälli tapani.palli at intel.com
Mon Feb 22 11:47:25 UTC 2016



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<n> components, where
> <n> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


// Tapani


More information about the mesa-dev mailing list