Do some optimize

This commit is contained in:
lvlong 2015-01-27 15:50:05 +08:00
parent bb419719aa
commit 57970da398
1 changed files with 2 additions and 3 deletions

View File

@ -672,9 +672,8 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign
} }
else else
{ {
if (element->second.second != bytes){ if (element->second.second < bytes){
free(element->second.first); GLvoid* value = realloc(element->second.first, bytes);
GLvoid* value = malloc(bytes);
memcpy(value, data, bytes ); memcpy(value, data, bytes );
_hashForUniforms[location] = std::make_pair(value, bytes); _hashForUniforms[location] = std::make_pair(value, bytes);
}else }else