Use a memcpy to avoid strict-aliasing warnings.

This commit is contained in:
Stephen White 2018-01-22 14:09:08 -05:00 committed by Corentin Wallez
parent 6d90e01858
commit ac49ed0779

View File

@ -128,8 +128,10 @@ namespace backend { namespace opengl {
*reinterpret_cast<GLuint*>(&mValues[stage][constant])); *reinterpret_cast<GLuint*>(&mValues[stage][constant]));
break; break;
case PushConstantType::Float: case PushConstantType::Float:
glUniform1f(location, float value;
*reinterpret_cast<GLfloat*>(&mValues[stage][constant])); // Use a memcpy to avoid strict-aliasing warnings.
memcpy(&value, &mValues[stage][constant], sizeof(value));
glUniform1f(location, value);
break; break;
} }
} }