void Render3D::SetTextureProcessingProperties(size_t scalingFactor, bool willDeposterize, bool willSmooth) { const bool isScaleValid = ( (scalingFactor == 2) || (scalingFactor == 4) ); const size_t newScalingFactor = (isScaleValid) ? scalingFactor : 1; bool needTexCacheReset = false; if ( willDeposterize && (this->_textureDeposterizeBuffer == NULL) ) { // 1024x1024 texels is the largest possible texture size. // We need two buffers, one for each deposterize stage. const size_t bufferSize = 1024 * 1024 * 2 * sizeof(u32); this->_textureDeposterizeBuffer = (u32 *)malloc_alignedCacheLine(bufferSize); memset(this->_textureDeposterizeBuffer, 0, bufferSize); needTexCacheReset = true; } else if ( !willDeposterize && (this->_textureDeposterizeBuffer != NULL) ) { free_aligned(this->_textureDeposterizeBuffer); this->_textureDeposterizeBuffer = NULL; needTexCacheReset = true; } if (newScalingFactor != this->_textureScalingFactor) { u32 *oldTextureBuffer = this->_textureUpscaleBuffer; u32 *newTextureBuffer = (u32 *)malloc_alignedCacheLine( (1024 * newScalingFactor) * (1024 * newScalingFactor) * sizeof(u32) ); this->_textureScalingFactor = newScalingFactor; this->_textureUpscaleBuffer = newTextureBuffer; free_aligned(oldTextureBuffer); needTexCacheReset = true; } if (willSmooth != this->_textureSmooth) { this->_textureSmooth = willSmooth; needTexCacheReset = true; } if (needTexCacheReset) { TexCache_Reset(); } }
void Default3D_Reset() { default3DAlreadyClearedLayer = false; TexCache_Reset(); }