Mesa (master): gallium: Make pipe_viewport_state swizzle_x/y/z/w bit-fields 8 bits wide

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 29 16:15:07 UTC 2020


Module: Mesa
Branch: master
Commit: a3363c348dcd968f2d3e413099a4d28fcda047eb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3363c348dcd968f2d3e413099a4d28fcda047eb

Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Fri Sep 25 18:29:30 2020 +0200

gallium: Make pipe_viewport_state swizzle_x/y/z/w bit-fields 8 bits wide

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 <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6867>

---

 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;
 };
 
 



More information about the mesa-commit mailing list