glsl: count atomic counters correctly

Graphics / Mesa 3D Graphics Library / Mesa - Andres Gomez [igalia.com] - 30 June 2016 15:55 UTC

Currently the linker uses the uniform count for the total number of atomic counters. However uniforms don't include the innermost array dimension in their count, but atomic counters are expected to include them.

Although the spec doesn't directly state this, it's clear how offsets will be assigned for arrays.

From OpenGL 4.2 (Core Profile), page 98:

" * Arrays of type atomic_uint are stored in memory by element order, with array element member zero at the lowest offset. The difference in offsets between each pair of elements in the array in basic machine units is referred to as the array stride, and is constant across the entire array. The stride can be queried by calling GetIntegerv with a pname of ATOMIC_COUNTER_- ARRAY_STRIDE after a program is linked."

From that it is clear how arrays of atomic counters will interact with GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE.

For other kinds of uniforms it's also clear that each entry in an array counts against the relevant limits.

Hence, although inferred, this is the expected behavior.

Fixes GL44-CTS.arrays_of_arrays_gl.AtomicDeclaration

0f00c6d glsl: count atomic counters correctly
src/compiler/glsl/link_atomics.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

Upstream: cgit.freedesktop.org


  • Share