diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index d3729c68d39..0b4c8f80a85 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -36,12 +36,10 @@ * Internal functions */ -static inline struct pipe_resource * +static ALWAYS_INLINE struct pipe_resource * _mesa_get_bufferobj_reference(struct gl_context *ctx, struct gl_buffer_object *obj) { - if (unlikely(!obj)) - return NULL; - + assert(obj); struct pipe_resource *buffer = obj->buffer; /* Only one context is using the fast path. All other contexts must use diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 50937acbeba..bd4903a5160 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -282,7 +282,12 @@ st_bind_ubos(struct st_context *st, struct gl_program *prog, binding = &st->ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->Binding]; - cb.buffer = _mesa_get_bufferobj_reference(st->ctx, binding->BufferObject); + if (binding->BufferObject) { + cb.buffer = _mesa_get_bufferobj_reference(st->ctx, + binding->BufferObject); + } else { + cb.buffer = NULL; + } if (cb.buffer) { cb.buffer_offset = binding->Offset;