vrend: use a helper variable for the buffer pointer

This makes the code a bit easier to read and may help the complier
to avoid needless dereferencing of pointers.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
macos/master
Gert Wollny 4 years ago
parent a22c56fff4
commit 46be8896a5
  1. 22
      src/vrend_renderer.c

@ -2747,6 +2747,9 @@ void vrend_set_uniform_buffer(struct vrend_context *ctx,
if (!has_feature(feat_ubo)) if (!has_feature(feat_ubo))
return; return;
struct pipe_constant_buffer *cbs = &ctx->sub->cbs[shader][index];
const uint32_t mask = 1u << index;
if (res_handle) { if (res_handle) {
res = vrend_renderer_ctx_res_lookup(ctx, res_handle); res = vrend_renderer_ctx_res_lookup(ctx, res_handle);
@ -2754,18 +2757,17 @@ void vrend_set_uniform_buffer(struct vrend_context *ctx,
vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, res_handle); vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, res_handle);
return; return;
} }
ctx->sub->cbs[shader][index].buffer = (struct pipe_resource *)res; cbs->buffer = (struct pipe_resource *)res;
ctx->sub->cbs[shader][index].buffer_offset = offset; cbs->buffer_offset = offset;
ctx->sub->cbs[shader][index].buffer_size = length; cbs->buffer_size = length;
ctx->sub->const_bufs_used_mask[shader] |= mask;
ctx->sub->const_bufs_used_mask[shader] |= (1u << index);
} else { } else {
ctx->sub->cbs[shader][index].buffer = NULL; cbs->buffer = NULL;
ctx->sub->cbs[shader][index].buffer_offset = 0; cbs->buffer_offset = 0;
ctx->sub->cbs[shader][index].buffer_size = 0; cbs->buffer_size = 0;
ctx->sub->const_bufs_used_mask[shader] &= ~(1u << index); ctx->sub->const_bufs_used_mask[shader] &= ~mask;
} }
ctx->sub->const_bufs_dirty[shader] |= (1u << index); ctx->sub->const_bufs_dirty[shader] |= mask;
} }
void vrend_set_index_buffer(struct vrend_context *ctx, void vrend_set_index_buffer(struct vrend_context *ctx,

Loading…
Cancel
Save