On 26/09/15 19:42, Ilia Mirkin wrote: > Hi Samuel, > > Coverity is up in a tizzy because std430_base_alignment can return 0 > (which in turn would cause tons of errors since it's used with > glsl_align). Is there a better starting value that can be used for its > is_record() case? For std140 it's 16... I assume for std430 it's 4 or > something? That would allow Coverity to conclude that 0 will never be > returned from the function... as-is an empty struct would get an > alignment of 0 and create lots of div-by-zero. Not sure if that's a > legit scenario though. >
After looking at the specs and what other drivers do, empty struct declarations are not allowed. From GLSL 1.50 spec, section 4.1.8 "Structures" "Structures must have at least one member declaration." Similar wording appears in GLSL 4.30, GLSL ES 3.0 and others. > Alternatively, an assert(base_alignment > 0) will most likely appease it. > I prefer to add this assertion in std430_base_alignment() because the base alignment rules (*) are always talking about basic machine units and I prefer not assume than a basic machine unit is 4. What do you think? Sam (*) OpenGL 4.3 spec, section 7.6.2.2 "Standard Uniform Block Layout" _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
