mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
st/mesa: remove alignment code from st_setup_current
I was the one who added this code and it doesn't seem useful. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19783>
This commit is contained in:
parent
1d5962b0e6
commit
a18b9d071d
1 changed files with 11 additions and 7 deletions
|
|
@ -219,18 +219,22 @@ st_setup_current(struct st_context *st,
|
||||||
GLubyte data[VERT_ATTRIB_MAX * sizeof(GLdouble) * 4];
|
GLubyte data[VERT_ATTRIB_MAX * sizeof(GLdouble) * 4];
|
||||||
GLubyte *cursor = data;
|
GLubyte *cursor = data;
|
||||||
const unsigned bufidx = (*num_vbuffers)++;
|
const unsigned bufidx = (*num_vbuffers)++;
|
||||||
unsigned max_alignment = 1;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const gl_vert_attrib attr = (gl_vert_attrib)u_bit_scan(&curmask);
|
const gl_vert_attrib attr = (gl_vert_attrib)u_bit_scan(&curmask);
|
||||||
const struct gl_array_attributes *const attrib
|
const struct gl_array_attributes *const attrib
|
||||||
= _mesa_draw_current_attrib(ctx, attr);
|
= _mesa_draw_current_attrib(ctx, attr);
|
||||||
const unsigned size = attrib->Format._ElementSize;
|
const unsigned size = attrib->Format._ElementSize;
|
||||||
const unsigned alignment = util_next_power_of_two(size);
|
|
||||||
max_alignment = MAX2(max_alignment, alignment);
|
/* When the current attribs are set (e.g. via glColor3ub or
|
||||||
|
* glVertexAttrib2s), they are always converted to float32 or int32
|
||||||
|
* or dual slots being 2x int32, so they are always dword-aligned.
|
||||||
|
* glBegin/End behaves in the same way. It's really an internal Mesa
|
||||||
|
* inefficiency that is convenient here, which is why this assertion
|
||||||
|
* is always true.
|
||||||
|
*/
|
||||||
|
assert(size % 4 == 0); /* assume a hw-friendly alignment */
|
||||||
memcpy(cursor, attrib->Ptr, size);
|
memcpy(cursor, attrib->Ptr, size);
|
||||||
if (alignment != size)
|
|
||||||
memset(cursor + size, 0, alignment - size);
|
|
||||||
|
|
||||||
if (UPDATE == UPDATE_ALL) {
|
if (UPDATE == UPDATE_ALL) {
|
||||||
init_velement(velements->velems, &attrib->Format, cursor - data,
|
init_velement(velements->velems, &attrib->Format, cursor - data,
|
||||||
|
|
@ -238,7 +242,7 @@ st_setup_current(struct st_context *st,
|
||||||
util_bitcount_fast<POPCNT>(inputs_read & BITFIELD_MASK(attr)));
|
util_bitcount_fast<POPCNT>(inputs_read & BITFIELD_MASK(attr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor += alignment;
|
cursor += size;
|
||||||
} while (curmask);
|
} while (curmask);
|
||||||
|
|
||||||
vbuffer[bufidx].is_user_buffer = false;
|
vbuffer[bufidx].is_user_buffer = false;
|
||||||
|
|
@ -256,7 +260,7 @@ st_setup_current(struct st_context *st,
|
||||||
st->pipe->const_uploader :
|
st->pipe->const_uploader :
|
||||||
st->pipe->stream_uploader;
|
st->pipe->stream_uploader;
|
||||||
u_upload_data(uploader,
|
u_upload_data(uploader,
|
||||||
0, cursor - data, max_alignment, data,
|
0, cursor - data, 16, data,
|
||||||
&vbuffer[bufidx].buffer_offset,
|
&vbuffer[bufidx].buffer_offset,
|
||||||
&vbuffer[bufidx].buffer.resource);
|
&vbuffer[bufidx].buffer.resource);
|
||||||
/* Always unmap. The uploader might use explicit flushes. */
|
/* Always unmap. The uploader might use explicit flushes. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue