Commit be110ba2 authored by Erik Faye-Lund 's avatar Erik Faye-Lund 💬
Browse files

mesa/st: accept NULL and empty buffer objects

It's prefectly legal and well-defined to render using a non-existing
or empty buffer object. The data coming out of the buffer object isn't
well defined unless we have the robustness flag set on the context, but
that's a different matter, and up to the shader hardware; it's the same
as out-of-bounds reads.
Signed-off-by: Erik Faye-Lund 's avatarErik Faye-Lund <>
Reviewed-by: default avatarMarek Olšák <>
parent ef13691e
......@@ -405,14 +405,9 @@ st_setup_arrays(struct st_context *st,
const unsigned bufidx = (*num_vbuffers)++;
if (_mesa_is_bufferobj(binding->BufferObj)) {
struct st_buffer_object *stobj = st_buffer_object(binding->BufferObj);
if (!stobj || !stobj->buffer) {
st->vertex_array_out_of_memory = true;
return; /* out-of-memory error probably */
/* Set the binding */
vbuffer[bufidx].buffer.resource = stobj->buffer;
struct st_buffer_object *stobj = st_buffer_object(binding->BufferObj);
vbuffer[bufidx].buffer.resource = stobj ? stobj->buffer : NULL;
vbuffer[bufidx].is_user_buffer = false;
vbuffer[bufidx].buffer_offset = _mesa_draw_binding_offset(binding);
} else {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment