summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2016-07-28 12:43:19 -0700
committerMatt Turner <[email protected]>2016-08-01 12:09:17 -0700
commitbbe012f02ae8963668e12a571b13e8c95044d2ba (patch)
tree1878d396bde4f7577f196ba6854452c3b3b9da93 /src
parent500a3dd11f9668597325eae53c4540ca871eeb89 (diff)
glsl_to_tgsi: Avoid aliasing violations.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 38e2c4a5d60..362559fbe0d 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1131,8 +1131,7 @@ glsl_to_tgsi_visitor::st_src_reg_for_double(double val)
st_src_reg src(PROGRAM_IMMEDIATE, -1, GLSL_TYPE_DOUBLE);
union gl_constant_value uval[2];
- uval[0].u = *(uint32_t *)&val;
- uval[1].u = *(((uint32_t *)&val) + 1);
+ memcpy(uval, &val, sizeof(uval));
src.index = add_constant(src.file, uval, 1, GL_DOUBLE, &src.swizzle);
return src;
@@ -3066,8 +3065,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir)
case GLSL_TYPE_DOUBLE:
gl_type = GL_DOUBLE;
for (i = 0; i < ir->type->vector_elements; i++) {
- values[i * 2].i = *(uint32_t *)&ir->value.d[i];
- values[i * 2 + 1].i = *(((uint32_t *)&ir->value.d[i]) + 1);
+ memcpy(&values[i * 2], &ir->value.d[i], sizeof(double));
}
break;
case GLSL_TYPE_UINT: