Add Memory::alloc_static_zeroed to allocate memory that's filled with zeroes.

This is generally faster than `malloc` followed by `memset` / loop-set to 0.
This commit is contained in:
Lukas Tenbrink
2025-03-14 15:15:09 +01:00
parent db66343528
commit 3207066e19
8 changed files with 32 additions and 47 deletions

View File

@ -340,8 +340,7 @@ void ShaderGLES3::_compile_specialization(Version::Specialization &spec, uint32_
iloglen = 4096; // buggy driver (Adreno 220+)
}
char *ilogmem = (char *)Memory::alloc_static(iloglen + 1);
memset(ilogmem, 0, iloglen + 1);
char *ilogmem = (char *)Memory::alloc_static_zeroed(iloglen + 1);
glGetShaderInfoLog(spec.vert_id, iloglen, &iloglen, ilogmem);
String err_string = name + ": Vertex shader compilation failed:\n";
@ -388,8 +387,7 @@ void ShaderGLES3::_compile_specialization(Version::Specialization &spec, uint32_
iloglen = 4096; // buggy driver (Adreno 220+)
}
char *ilogmem = (char *)Memory::alloc_static(iloglen + 1);
memset(ilogmem, 0, iloglen + 1);
char *ilogmem = (char *)Memory::alloc_static_zeroed(iloglen + 1);
glGetShaderInfoLog(spec.frag_id, iloglen, &iloglen, ilogmem);
String err_string = name + ": Fragment shader compilation failed:\n";