[Mesa-dev] [RFC]UBO support update

Vincent Lejeune vljn at ovi.com
Sun Dec 25 10:17:00 PST 2011


Hi and merry chrismas everyone.

I have updated my UBO patch set to follow some recommandations from ML.
I splitted some patches (and for some of them, added a longer description).
The last three ones needs a bit more polishing though, and there might be
some leftover debug code or old comments that I missed when cleaning.

This patch set passes my 4 piglit tests (submitted earlier) on softpipe. These 
piglit tests checks standard layout conformance, correct type report, and 
several draw situations : simple variable dereference, record dereference,
direct addressing array dereference and indirect addressing array dereference
for draw_test, and structure/array copy in draw_several_ubo_test (as well as
checking that several UBO are well supported).

Some items are still left to claim complete spec conformance :
- i965 dri support. I checked that the driver builds, and it seems not to 
suffer from regression with these patches (I did a quick test with my snb
setup). Support for llvmpipe, r600g and vmwgfx gallium drivers.
I don't have any expererience in low level hardware programmation ...
- Matrix support at code generation.
- API queries on classic uniform.
- Queries on program that failed to link. The spec says that API querying 
should work on program that fails to link, and gives the example of a 
program that has too many uniforms for the linker. However the spec is
really vague on the behavior the API should have in every case (what happens
if UBO definition does not match in separate shaders for instance ?)
- Support for shared and packed layout. Strictly speaking, having just 
std140 layout is spec compliant, as these 2 additionnals layout are
implementation specific, but the spec introduces these 2 additionnals layout
for optimisation purpose, so it would be nice to use these layouts to have
some kind of uniform packing.
- It is out of spec, but many sample code uses this feature : array of UBO
and UBO instanciation. The official way of declaring a UBO is
layout(...) uniform OpenGLName { ... };
but there were 2 others ways in draft of the spec :
layout(...) uniform OpenGLName { ... } GLSLName;
layout(...) uniform OpenGLName { ... } GLSLName[n];
that allowed following shader codes to dereference UBO as if it was a struct
or an array. These features are said to be deferred to another extension
 in the spec FAQ but even opengl.org wiki mentions UBO instanciation and 
array of UBO as possible way of declaration.

Regards,
Vincent



More information about the mesa-dev mailing list