summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-06-19 12:21:17 -0600
committerBrian Paul <[email protected]>2017-06-20 08:03:12 -0600
commit2a9d8a45a6edec7c8f6f670951b0fe6fd781c33f (patch)
treedcdb220f4ba0a5ba74ce6fbcb91de70893807cfb
parented83e73c4e7118a60294c0bff137f6d2e5837fa3 (diff)
gallium/vbuf: add some const qualifiers
Helps understandability a bit. Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 8361e649ff4..b342f342e92 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -366,8 +366,8 @@ void u_vbuf_destroy(struct u_vbuf *mgr)
{
struct pipe_screen *screen = mgr->pipe->screen;
unsigned i;
- unsigned num_vb = screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
- PIPE_SHADER_CAP_MAX_INPUTS);
+ const unsigned num_vb = screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
+ PIPE_SHADER_CAP_MAX_INPUTS);
mgr->pipe->set_vertex_buffers(mgr->pipe, 0, num_vb, NULL);
@@ -435,7 +435,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
/* Translate. */
if (unroll_indices) {
struct pipe_transfer *transfer = NULL;
- unsigned offset = info->start * info->index_size;
+ const unsigned offset = info->start * info->index_size;
uint8_t *map;
/* Create and map the output buffer. */
@@ -555,16 +555,16 @@ u_vbuf_translate_begin(struct u_vbuf *mgr,
struct translate_key key[VB_NUM];
unsigned elem_index[VB_NUM][PIPE_MAX_ATTRIBS]; /* ... into key.elements */
unsigned i, type;
- unsigned incompatible_vb_mask = mgr->incompatible_vb_mask &
- mgr->ve->used_vb_mask;
+ const unsigned incompatible_vb_mask = mgr->incompatible_vb_mask &
+ mgr->ve->used_vb_mask;
- int start[VB_NUM] = {
+ const int start[VB_NUM] = {
start_vertex, /* VERTEX */
info->start_instance, /* INSTANCE */
0 /* CONST */
};
- unsigned num[VB_NUM] = {
+ const unsigned num[VB_NUM] = {
num_vertices, /* VERTEX */
info->instance_count, /* INSTANCE */
1 /* CONST */
@@ -802,7 +802,7 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr,
uint32_t incompatible_vb_mask = 0;
/* which buffers have a non-zero stride */
uint32_t nonzero_stride_vb_mask = 0;
- uint32_t mask = ~(((1ull << count) - 1) << start_slot);
+ const uint32_t mask = ~(((1ull << count) - 1) << start_slot);
/* Zero out the bits we are going to rewrite completely. */
mgr->user_vb_mask &= mask;
@@ -885,7 +885,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
{
unsigned i;
unsigned nr_velems = mgr->ve->count;
- struct pipe_vertex_element *velems =
+ const struct pipe_vertex_element *velems =
mgr->using_translate ? mgr->fallback_velems : mgr->ve->ve;
unsigned start_offset[PIPE_MAX_ATTRIBS];
unsigned end_offset[PIPE_MAX_ATTRIBS];
@@ -893,7 +893,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
/* Determine how much data needs to be uploaded. */
for (i = 0; i < nr_velems; i++) {
- struct pipe_vertex_element *velem = &velems[i];
+ const struct pipe_vertex_element *velem = &velems[i];
unsigned index = velem->vertex_buffer_index;
struct pipe_vertex_buffer *vb = &mgr->vertex_buffer[index];
unsigned instance_div, first, size, index_bit;
@@ -1110,9 +1110,10 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
int start_vertex, min_index;
unsigned num_vertices;
boolean unroll_indices = FALSE;
- uint32_t used_vb_mask = mgr->ve->used_vb_mask;
+ const uint32_t used_vb_mask = mgr->ve->used_vb_mask;
uint32_t user_vb_mask = mgr->user_vb_mask & used_vb_mask;
- uint32_t incompatible_vb_mask = mgr->incompatible_vb_mask & used_vb_mask;
+ const uint32_t incompatible_vb_mask =
+ mgr->incompatible_vb_mask & used_vb_mask;
struct pipe_draw_info new_info;
/* Normal draw. No fallback and no user buffers. */