mesa/st: fix atomic buffer sizing to align with ssbo.
authorDave Airlie <airlied@redhat.com>
Fri, 15 Sep 2017 03:14:56 +0000 (13:14 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 10 Oct 2017 23:10:21 +0000 (09:10 +1000)
This respects the size from the range setting like ssbo.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_atom_atomicbuf.c

index 7ebcd08dc43f726a63e5a0506cabc106239bfaa3..ee5944fe9b4dd4a3b7ca10a9a589ab92cce8f4f5 100644 (file)
@@ -62,6 +62,12 @@ st_bind_atomics(struct st_context *st, struct gl_program *prog,
          sb.buffer = st_obj->buffer;
          sb.buffer_offset = binding->Offset;
          sb.buffer_size = st_obj->buffer->width0 - binding->Offset;
+
+        /* AutomaticSize is FALSE if the buffer was set with BindBufferRange.
+          * Take the minimum just to be sure.
+          */
+         if (!binding->AutomaticSize)
+            sb.buffer_size = MIN2(sb.buffer_size, (unsigned) binding->Size);
       }
 
       st->pipe->set_shader_buffers(st->pipe, shader_type,