st/mesa: empty buffer binding if the buffer's not really there
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 13 Feb 2016 23:37:33 +0000 (18:37 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 16 Feb 2016 03:22:33 +0000 (22:22 -0500)
This can happen with 0-sized buffers.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_atom_atomicbuf.c

index d83c39606404c57309f403bcb1e18f185768415c..a27dbe0460d04c02ba11689f7a0c9030282ba936 100644 (file)
@@ -58,9 +58,11 @@ st_bind_atomics(struct st_context *st,
          st_buffer_object(binding->BufferObject);
       struct pipe_shader_buffer sb = { 0 };
 
-      sb.buffer = st_obj->buffer;
-      sb.buffer_offset = binding->Offset;
-      sb.buffer_size = st_obj->buffer->width0 - binding->Offset;
+      if (st_obj && st_obj->buffer) {
+         sb.buffer = st_obj->buffer;
+         sb.buffer_offset = binding->Offset;
+         sb.buffer_size = st_obj->buffer->width0 - binding->Offset;
+      }
 
       st->pipe->set_shader_buffers(st->pipe, shader_type,
                                    atomic->Binding, 1, &sb);