mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 20:50:44 +02:00
r600: compare structure elements instead of doing a memcmp
Structures might be padded by the compiler and these padding bytes remain
un-initialized which in turn makes memcmp return a difference where from
the logical point of view there is none.
Fixes valgrind:
Conditional jump or move depends on uninitialised value(s)
at 0x4C32CBA: __memcmp_sse4_1 (vg_replace_strmem.c:1099)
by 0xB8D2537: r600_set_vertex_buffers (r600_state_common.c:573)
by 0xB71D44A: u_vbuf_set_driver_vertex_buffers (u_vbuf.c:1129)
by 0xB71F7BB: u_vbuf_draw_vbo (u_vbuf.c:1153)
by 0xB3B92CB: st_draw_vbo (st_draw.c:235)
by 0xB36B1AE: vbo_draw_arrays (vbo_exec_array.c:391)
by 0xB36BB0D: vbo_exec_DrawArrays (vbo_exec_array.c:550)
by 0x10A989: piglit_display (textureSize.c:157)
by 0x4F8F174: run_test (piglit_fbo_framework.c:52)
by 0x4F7BA12: piglit_gl_test_run (piglit-framework-gl.c:229)
by 0x10A60A: main (textureSize.c:71)
Uninitialised value was created by a stack allocation
at 0xB3948FD: st_update_array (st_atom_array.c:388)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
9c1ae6a1a1
commit
806a42fc47
1 changed files with 4 additions and 1 deletions
|
|
@ -570,7 +570,10 @@ static void r600_set_vertex_buffers(struct pipe_context *ctx,
|
|||
/* Set vertex buffers. */
|
||||
if (input) {
|
||||
for (i = 0; i < count; i++) {
|
||||
if (memcmp(&input[i], &vb[i], sizeof(struct pipe_vertex_buffer))) {
|
||||
if ((input[i].buffer.resource != vb[i].buffer.resource) ||
|
||||
(vb[i].stride != input[i].stride) ||
|
||||
(vb[i].buffer_offset != input[i].buffer_offset) ||
|
||||
(vb[i].is_user_buffer != input[i].is_user_buffer)) {
|
||||
if (input[i].buffer.resource) {
|
||||
vb[i].stride = input[i].stride;
|
||||
vb[i].buffer_offset = input[i].buffer_offset;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue