diff options
author | Marek Olšák <[email protected]> | 2017-04-02 14:30:16 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-10 19:00:16 +0200 |
commit | c24c3b94ed29ecd99b1101c74c6c4606f9b5580e (patch) | |
tree | 81f6966bc59a68d9867693c65d35fae9bb1d9819 /src/mesa/state_tracker | |
parent | fe437882ea2d60e91c244cc95beb4b79c615af49 (diff) |
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_array.c | 20 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw_feedback.c | 20 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_pbo.c | 8 |
5 files changed, 28 insertions, 30 deletions
diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index 9381f788bd0..79c2fe58081 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -507,8 +507,8 @@ setup_interleaved_attribs(struct st_context *st, */ if (vpv->num_inputs == 0) { /* just defensive coding here */ - vbuffer->buffer = NULL; - vbuffer->user_buffer = NULL; + vbuffer->buffer.resource = NULL; + vbuffer->is_user_buffer = false; vbuffer->buffer_offset = 0; vbuffer->stride = 0; } @@ -520,15 +520,15 @@ setup_interleaved_attribs(struct st_context *st, return FALSE; /* out-of-memory error probably */ } - vbuffer->buffer = stobj->buffer; - vbuffer->user_buffer = NULL; + vbuffer->buffer.resource = stobj->buffer; + vbuffer->is_user_buffer = false; vbuffer->buffer_offset = pointer_to_offset(low_addr); vbuffer->stride = stride; } else { /* all interleaved arrays in user memory */ - vbuffer->buffer = NULL; - vbuffer->user_buffer = low_addr; + vbuffer->buffer.user = low_addr; + vbuffer->is_user_buffer = !!low_addr; /* if NULL, then unbind */ vbuffer->buffer_offset = 0; vbuffer->stride = stride; } @@ -584,8 +584,8 @@ setup_non_interleaved_attribs(struct st_context *st, return FALSE; /* out-of-memory error probably */ } - vbuffer[bufidx].buffer = stobj->buffer; - vbuffer[bufidx].user_buffer = NULL; + vbuffer[bufidx].buffer.resource = stobj->buffer; + vbuffer[bufidx].is_user_buffer = false; vbuffer[bufidx].buffer_offset = pointer_to_offset(array->Ptr); } else { @@ -603,8 +603,8 @@ setup_non_interleaved_attribs(struct st_context *st, assert(ptr); - vbuffer[bufidx].buffer = NULL; - vbuffer[bufidx].user_buffer = ptr; + vbuffer[bufidx].buffer.user = ptr; + vbuffer[bufidx].is_user_buffer = !!ptr; /* if NULL, then unbind */ vbuffer[bufidx].buffer_offset = 0; } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 30e23fa259f..ef3f64bc763 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -694,7 +694,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx, vb.stride = sizeof(struct st_util_vertex); u_upload_alloc(pipe->stream_uploader, 0, num_vert_bytes, 4, - &vb.buffer_offset, &vb.buffer, (void **) &verts); + &vb.buffer_offset, &vb.buffer.resource, (void **) &verts); if (unlikely(!verts)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCallLists(bitmap text)"); @@ -781,7 +781,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx, out: restore_render_state(ctx); - pipe_resource_reference(&vb.buffer, NULL); + pipe_resource_reference(&vb.buffer.resource, NULL); pipe_sampler_view_reference(&sv, NULL); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index e510d437baf..5c9f7ea7917 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -385,8 +385,8 @@ st_draw_quad(struct st_context *st, u_upload_alloc(st->pipe->stream_uploader, 0, 4 * sizeof(struct st_util_vertex), 4, - &vb.buffer_offset, &vb.buffer, (void **) &verts); - if (!vb.buffer) { + &vb.buffer_offset, &vb.buffer.resource, (void **) &verts); + if (!vb.buffer.resource) { return false; } @@ -453,7 +453,7 @@ st_draw_quad(struct st_context *st, cso_draw_arrays(st->cso_context, PIPE_PRIM_TRIANGLE_FAN, 0, 4); } - pipe_resource_reference(&vb.buffer, NULL); + pipe_resource_reference(&vb.buffer.resource, NULL); return true; } diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 9d68777cfe7..ad92ff5233d 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -194,27 +194,27 @@ st_feedback_draw_vbo(struct gl_context *ctx, struct st_buffer_object *stobj = st_buffer_object(bufobj); assert(stobj->buffer); - vbuffers[attr].buffer = NULL; - vbuffers[attr].user_buffer = NULL; - pipe_resource_reference(&vbuffers[attr].buffer, stobj->buffer); + vbuffers[attr].buffer.resource = NULL; + vbuffers[attr].is_user_buffer = false; + pipe_resource_reference(&vbuffers[attr].buffer.resource, stobj->buffer); vbuffers[attr].buffer_offset = pointer_to_offset(low_addr); velements[attr].src_offset = arrays[mesaAttr]->Ptr - low_addr; /* map the attrib buffer */ - map = pipe_buffer_map(pipe, vbuffers[attr].buffer, + map = pipe_buffer_map(pipe, vbuffers[attr].buffer.resource, PIPE_TRANSFER_READ, &vb_transfer[attr]); draw_set_mapped_vertex_buffer(draw, attr, map, - vbuffers[attr].buffer->width0); + vbuffers[attr].buffer.resource->width0); } else { - vbuffers[attr].buffer = NULL; - vbuffers[attr].user_buffer = arrays[mesaAttr]->Ptr; + vbuffers[attr].buffer.user = arrays[mesaAttr]->Ptr; + vbuffers[attr].is_user_buffer = true; vbuffers[attr].buffer_offset = 0; velements[attr].src_offset = 0; - draw_set_mapped_vertex_buffer(draw, attr, vbuffers[attr].user_buffer, - ~0); + draw_set_mapped_vertex_buffer(draw, attr, + vbuffers[attr].buffer.user, ~0); } /* common-case setup */ @@ -292,7 +292,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, if (vb_transfer[attr]) pipe_buffer_unmap(pipe, vb_transfer[attr]); draw_set_mapped_vertex_buffer(draw, attr, NULL, 0); - pipe_resource_reference(&vbuffers[attr].buffer, NULL); + pipe_vertex_buffer_unreference(&vbuffers[attr]); } draw_set_vertex_buffers(draw, 0, vp->num_inputs, NULL); } diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c index 1ded58392c1..303c8535b20 100644 --- a/src/mesa/state_tracker/st_pbo.c +++ b/src/mesa/state_tracker/st_pbo.c @@ -215,7 +215,7 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr, /* Upload vertices */ { - struct pipe_vertex_buffer vbo; + struct pipe_vertex_buffer vbo = {0}; struct pipe_vertex_element velem; float x0 = (float) addr->xoffset / surface_width * 2.0f - 1.0f; @@ -225,12 +225,10 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr, float *verts = NULL; - vbo.user_buffer = NULL; - vbo.buffer = NULL; vbo.stride = 2 * sizeof(float); u_upload_alloc(st->pipe->stream_uploader, 0, 8 * sizeof(float), 4, - &vbo.buffer_offset, &vbo.buffer, (void **) &verts); + &vbo.buffer_offset, &vbo.buffer.resource, (void **) &verts); if (!verts) return false; @@ -254,7 +252,7 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr, cso_set_vertex_buffers(cso, velem.vertex_buffer_index, 1, &vbo); - pipe_resource_reference(&vbo.buffer, NULL); + pipe_resource_reference(&vbo.buffer.resource, NULL); } /* Upload constants */ |