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
1 changed files with 4 additions and 2 deletions

View File

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