summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-09-15 13:14:56 +1000
committerDave Airlie <airlied@redhat.com>2017-10-11 09:10:21 +1000
commit9926af0e7195c245d6b9d11b0fee6ba146987dbf (patch)
tree8dbaa0a33c890ca6c840c0d30655814734fd5e66
parent3e156b89ed8c0ed61d81c9d4f0503f32a6bfa904 (diff)
mesa/st: fix atomic buffer sizing to align with ssbo.
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>
-rw-r--r--src/mesa/state_tracker/st_atom_atomicbuf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom_atomicbuf.c b/src/mesa/state_tracker/st_atom_atomicbuf.c
index 7ebcd08dc43..ee5944fe9b4 100644
--- a/src/mesa/state_tracker/st_atom_atomicbuf.c
+++ b/src/mesa/state_tracker/st_atom_atomicbuf.c
@@ -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,