mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
6e92b7a378
Due to the `using` statement being scoped to the `CreateTextureView` method, `TextureStorage` would be disposed as soon as the view was returned. This was largely fine as the TextureStorage resources were being kept alive by the views holding their own references to them, but it also meant that dispose is only called as soon as the texture is created. Aliased Storages are TextureStorages created with the same allocation as another TextureStorage, if they have to be aliased as another format. We keep track of a TextureStorage's `_aliasedStorages` as they are created, and dispose them when the TextureStorage is disposed... ...except it is disposed immediately, before any aliased storages are even created. The aliased storages added after this will never be disposed. This PR attempts to fix this by disposing TextureStorage when its view count reaches 0. The other use of texture storage - the D32S8 blit - still manually disposes the storage, but regular uses created via the GAL are now disposed by the view count. I think this makes the most sense, as otherwise in the future this behaviour might be forgotton and more things could be added to the Dispose() method that don't work due to it not actually calling at the right time. This should improve memory leaks in Super Mario Odyssey, most noticeable when resolution scaling. The memory usage of the game is still wildly unpredictable due to how it interacts with the texture cache, but now it shouldn't get considerably longer as you play... I hope. I've seen it typically recover back to the same level occasionally, though it can spike significantly. Please test a bunch of games on multiple GPUs to make sure this doesn't break anything. |
||
---|---|---|
.. | ||
Queries | ||
Shaders | ||
Auto.cs | ||
AutoFlushCounter.cs | ||
BackgroundResources.cs | ||
BitMap.cs | ||
BufferHolder.cs | ||
BufferManager.cs | ||
BufferState.cs | ||
BufferUsageBitmap.cs | ||
CacheByRange.cs | ||
CommandBufferPool.cs | ||
CommandBufferScoped.cs | ||
Constants.cs | ||
DescriptorSetCollection.cs | ||
DescriptorSetManager.cs | ||
DescriptorSetUpdater.cs | ||
DisposableBuffer.cs | ||
DisposableBufferView.cs | ||
DisposableFramebuffer.cs | ||
DisposableImage.cs | ||
DisposableImageView.cs | ||
DisposableMemory.cs | ||
DisposablePipeline.cs | ||
DisposableRenderPass.cs | ||
DisposableSampler.cs | ||
EnumConversion.cs | ||
FenceHelper.cs | ||
FenceHolder.cs | ||
FormatCapabilities.cs | ||
FormatConverter.cs | ||
FormatTable.cs | ||
FramebufferParams.cs | ||
HardwareCapabilities.cs | ||
HashTableSlim.cs | ||
HelperShader.cs | ||
IdList.cs | ||
IndexBufferPattern.cs | ||
IndexBufferState.cs | ||
MemoryAllocation.cs | ||
MemoryAllocator.cs | ||
MemoryAllocatorBlockList.cs | ||
MultiFenceHolder.cs | ||
NativeArray.cs | ||
PersistentFlushBuffer.cs | ||
PipelineBase.cs | ||
PipelineConverter.cs | ||
PipelineDynamicState.cs | ||
PipelineFull.cs | ||
PipelineHelperShader.cs | ||
PipelineLayoutCache.cs | ||
PipelineLayoutCacheEntry.cs | ||
PipelineLayoutFactory.cs | ||
PipelineState.cs | ||
PipelineUid.cs | ||
Ryujinx.Graphics.Vulkan.csproj | ||
SamplerHolder.cs | ||
SemaphoreHolder.cs | ||
Shader.cs | ||
ShaderCollection.cs | ||
StagingBuffer.cs | ||
SyncManager.cs | ||
TextureBuffer.cs | ||
TextureCopy.cs | ||
TextureStorage.cs | ||
TextureView.cs | ||
Vendor.cs | ||
VertexBufferState.cs | ||
VulkanConfiguration.cs | ||
VulkanException.cs | ||
VulkanInitialization.cs | ||
VulkanRenderer.cs | ||
Window.cs | ||
WindowBase.cs |