1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-01 11:15:13 +01:00

Fix #12297: OpenGL renderer causing artifacts

Do not re-allocate texture memory if we don't need to and aren't going to restore the old pixels.
This commit is contained in:
Ted John
2020-07-26 18:46:23 +01:00
parent 8a378ad236
commit cf9e8022a0
2 changed files with 12 additions and 11 deletions

View File

@@ -51,6 +51,7 @@
- Fix: [#12211] Map Generator shows incorrect map sizes (e.g. "150 x 0").
- Fix: [#12221] Map Generation tool doesn't place any trees.
- Fix: [#12285] On-ride photo profit assumes every guest buys one.
- Fix: [#12297] OpenGL renderer causing artifacts.
- Fix: [#12312] Softlock when loading save file via command line fails.
- Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list.
- Improved: [#6530] Allow water and land height changes on park borders.

View File

@@ -215,19 +215,19 @@ void TextureCache::EnlargeAtlasesTexture(GLuint newEntries)
// Initial capacity will be 12 which covers most cases of a fully visible park.
_atlasesTextureCapacity = (_atlasesTextureCapacity + 6) << 1UL;
}
glBindTexture(GL_TEXTURE_2D_ARRAY, _atlasesTexture);
glTexImage3D(
GL_TEXTURE_2D_ARRAY, 0, GL_R8UI, _atlasesTextureDimensions, _atlasesTextureDimensions, _atlasesTextureCapacity, 0,
GL_RED_INTEGER, GL_UNSIGNED_BYTE, nullptr);
glBindTexture(GL_TEXTURE_2D_ARRAY, _atlasesTexture);
glTexImage3D(
GL_TEXTURE_2D_ARRAY, 0, GL_R8UI, _atlasesTextureDimensions, _atlasesTextureDimensions, _atlasesTextureCapacity, 0,
GL_RED_INTEGER, GL_UNSIGNED_BYTE, nullptr);
// Restore old data
if (!oldPixels.empty())
{
glTexSubImage3D(
GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _atlasesTextureDimensions, _atlasesTextureDimensions, _atlasesTextureIndices,
GL_RED_INTEGER, GL_UNSIGNED_BYTE, oldPixels.data());
// Restore old data
if (!oldPixels.empty())
{
glTexSubImage3D(
GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _atlasesTextureDimensions, _atlasesTextureDimensions, _atlasesTextureIndices,
GL_RED_INTEGER, GL_UNSIGNED_BYTE, oldPixels.data());
}
}
_atlasesTextureIndices = newIndices;