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:
@@ -36,12 +36,10 @@
|
|||||||
* Internal functions
|
* 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)
|
_mesa_get_bufferobj_reference(struct gl_context *ctx, struct gl_buffer_object *obj)
|
||||||
{
|
{
|
||||||
if (unlikely(!obj))
|
assert(obj);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
struct pipe_resource *buffer = obj->buffer;
|
struct pipe_resource *buffer = obj->buffer;
|
||||||
|
|
||||||
/* Only one context is using the fast path. All other contexts must use
|
/* Only one context is using the fast path. All other contexts must use
|
||||||
|
@@ -282,7 +282,12 @@ st_bind_ubos(struct st_context *st, struct gl_program *prog,
|
|||||||
binding =
|
binding =
|
||||||
&st->ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->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) {
|
if (cb.buffer) {
|
||||||
cb.buffer_offset = binding->Offset;
|
cb.buffer_offset = binding->Offset;
|
||||||
|
Reference in New Issue
Block a user