st/mesa: remove !obj checking in _mesa_get_bufferobj_reference when it's useless

There is at least one case in a future commit where the compiler can't do
this automatically.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27587>
This commit is contained in:
Marek Olšák
2024-01-04 02:22:05 -05:00
committed by Marge Bot
parent 9747cf2c8f
commit 72a38b3792
2 changed files with 8 additions and 5 deletions

View File

@@ -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

View File

@@ -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;