Fixed a texture corruption issue caused by too aggressive optimizations.

This commit is contained in:
Leon Styhre 2021-12-27 21:24:34 +01:00
parent 796951bf44
commit fa993a0489
2 changed files with 5 additions and 4 deletions

View file

@ -58,8 +58,8 @@ bool TextureData::initSVGFromMemory(const std::string& fileData)
{
std::unique_lock<std::mutex> lock{mMutex};
// If already initialized then don't process it again.
if (!mDataRGBA.empty())
// If already initialized then don't process it again unless it needs to be rasterized.
if (!mDataRGBA.empty() && !mPendingRasterization)
return true;
NSVGimage* svgImage{nsvgParse(const_cast<char*>(fileData.c_str()), "px", DPI)};
@ -282,7 +282,7 @@ float TextureData::sourceHeight()
void TextureData::setSourceSize(float width, float height)
{
if (mScalable) {
if ((mSourceWidth != width) || (mSourceHeight != height)) {
if (mSourceWidth != width || mSourceHeight != height) {
mSourceWidth = width;
mSourceHeight = height;
releaseVRAM();

View file

@ -197,7 +197,8 @@ void TextureResource::rasterizeAt(float width, float height)
{
if (mTextureData != nullptr) {
glm::vec2 textureSize = mTextureData.get()->getSize();
if (textureSize.x == width && textureSize.y == height)
if (textureSize.x == width && textureSize.y == height &&
!mTextureData.get()->getPendingRasterization())
return;
}