Improve memory use

This commit is contained in:
halx99 2020-10-29 19:13:36 +08:00
parent 6d28887126
commit b897e61c94
1 changed files with 3 additions and 4 deletions

View File

@ -256,7 +256,7 @@ void ProgramGL::computeUniformInfos()
_totalBufferSize = 0; _totalBufferSize = 0;
_maxLocation = -1; _maxLocation = -1;
_activeUniformInfos.clear(); _activeUniformInfos.clear();
GLchar* uniformName = (GLchar*)malloc(MAX_UNIFORM_NAME_LENGTH + 1); GLchar uniformName[MAX_UNIFORM_NAME_LENGTH + 1];
for (int i = 0; i < numOfUniforms; ++i) for (int i = 0; i < numOfUniforms; ++i)
{ {
glGetActiveUniform(_program, i, MAX_UNIFORM_NAME_LENGTH, &length, &uniform.count, &uniform.type, uniformName); glGetActiveUniform(_program, i, MAX_UNIFORM_NAME_LENGTH, &length, &uniform.count, &uniform.type, uniformName);
@ -278,7 +278,6 @@ void ProgramGL::computeUniformInfos()
_totalBufferSize += uniform.size * uniform.count; _totalBufferSize += uniform.size * uniform.count;
_maxLocation = _maxLocation <= uniform.location ? (uniform.location + 1) : _maxLocation; _maxLocation = _maxLocation <= uniform.location ? (uniform.location + 1) : _maxLocation;
} }
free(uniformName);
} }
int ProgramGL::getAttributeLocation(Attribute name) const int ProgramGL::getAttributeLocation(Attribute name) const