Fix occasional black screen on startup

This commit is contained in:
x2048 2023-03-16 14:56:27 +01:00 committed by GitHub
parent b7359f5fa9
commit 2bed338ef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -140,7 +140,8 @@ bool TextureBuffer::ensureTexture(video::ITexture **texture, const TextureDefini
if (definition.valid) {
if (definition.clear) {
video::IImage *image = m_driver->createImage(definition.format, size);
image->fill(0u);
// Cannot use image->fill because it's not implemented for all formats.
std::memset(image->getData(), 0, image->getDataSizeFromFormat(definition.format, size.Width, size.Height));
*texture = m_driver->addTexture(definition.name.c_str(), image);
image->drop();
}