[Mesa-dev] [PATCH 1/2] i965: initialize struct brw_reg's union bits to zero.

Samuel Iglesias Gonsálvez siglesias at igalia.com
Thu May 12 07:28:51 UTC 2016


Extra bits required to make room for the df field of the union don't get
initialized in the constructor. Initialize them to zero before setting
the rest of union's fields.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reported-by: Francisco Jerez <currojerez at riseup.net>
---
 src/mesa/drivers/dri/i965/brw_reg.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index 6d51623..3b76d7d 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -338,6 +338,9 @@ brw_reg(enum brw_reg_file file,
    reg.subnr = subnr * type_sz(type);
    reg.nr = nr;
 
+   /* Initialize all union's bits to zero before setting them. */
+   reg.df = 0;
+
    /* Could do better: If the reg is r5.3<0;1,0>, we probably want to
     * set swizzle and writemask to W, as the lower bits of subnr will
     * be lost when converted to align16.  This is probably too much to
-- 
2.5.0



More information about the mesa-dev mailing list