Merge pull request #12487 from IntelOrca/fix/12297-opengl-resizeatlas

Fix #12297: OpenGL renderer causing artifacts
This commit is contained in:
ζeh Matt 2020-07-26 20:24:35 +02:00 committed by GitHub
commit 8217acd86f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;