From a3363c348dcd968f2d3e413099a4d28fcda047eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2020 18:29:30 +0200 Subject: [PATCH] gallium: Make pipe_viewport_state swizzle_x/y/z/w bit-fields 8 bits wide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously there were 20 padding bits after them, which would be left uninitialized and preserved when writing to the swizzle members. This could result in two equal viewport states spuriously being considered different (because memcmp compared the padding bits as well). Noticed while looking for something else with valgrind: ==801624== Conditional jump or move depends on uninitialised value(s) ==801624== at 0x10B86259: cso_set_viewport (cso_context.c:739) ==801624== by 0x10B862C7: cso_set_viewport_dims (cso_context.c:764) ==801624== by 0x1057E3A1: clear_with_quad (st_cb_clear.c:335) ==801624== by 0x1057E3A1: st_Clear (st_cb_clear.c:545) ==801624== [...] ==801624== ==801624== Conditional jump or move depends on uninitialised value(s) ==801624== at 0x10B885DE: cso_restore_viewport (cso_context.c:777) ==801624== by 0x10B885DE: cso_restore_state (cso_context.c:1710) ==801624== by 0x1057E4CB: clear_with_quad (st_cb_clear.c:364) ==801624== by 0x1057E4CB: st_Clear (st_cb_clear.c:545) ==801624== [...] Reviewed-by: Marek Olšák Part-of: --- src/gallium/include/pipe/p_state.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 7acb79df67c..1d907bd228d 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -213,10 +213,10 @@ struct pipe_viewport_state { float scale[3]; float translate[3]; - enum pipe_viewport_swizzle swizzle_x:3; - enum pipe_viewport_swizzle swizzle_y:3; - enum pipe_viewport_swizzle swizzle_z:3; - enum pipe_viewport_swizzle swizzle_w:3; + enum pipe_viewport_swizzle swizzle_x:8; + enum pipe_viewport_swizzle swizzle_y:8; + enum pipe_viewport_swizzle swizzle_z:8; + enum pipe_viewport_swizzle swizzle_w:8; };