From ac49ed0779f804f79dfe9e024bdde204aa44e62f Mon Sep 17 00:00:00 2001 From: Stephen White Date: Mon, 22 Jan 2018 14:09:08 -0500 Subject: [PATCH] Use a memcpy to avoid strict-aliasing warnings. --- src/backend/opengl/CommandBufferGL.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/opengl/CommandBufferGL.cpp b/src/backend/opengl/CommandBufferGL.cpp index d56fee70d7..c3028ab7f9 100644 --- a/src/backend/opengl/CommandBufferGL.cpp +++ b/src/backend/opengl/CommandBufferGL.cpp @@ -128,8 +128,10 @@ namespace backend { namespace opengl { *reinterpret_cast(&mValues[stage][constant])); break; case PushConstantType::Float: - glUniform1f(location, - *reinterpret_cast(&mValues[stage][constant])); + float value; + // Use a memcpy to avoid strict-aliasing warnings. + memcpy(&value, &mValues[stage][constant], sizeof(value)); + glUniform1f(location, value); break; } }