aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine/Methods.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Methods.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Methods.cs46
1 files changed, 17 insertions, 29 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
index 96741cd6..aaac9441 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
@@ -22,21 +22,6 @@ namespace Ryujinx.Graphics.Gpu.Engine
private readonly GpuContext _context;
private readonly ShaderProgramInfo[] _currentProgramInfo;
- /// <summary>
- /// In-memory shader cache.
- /// </summary>
- public ShaderCache ShaderCache { get; }
-
- /// <summary>
- /// GPU buffer manager.
- /// </summary>
- public BufferCache BufferCache { get; }
-
- /// <summary>
- /// GPU texture manager.
- /// </summary>
- public TextureCache TextureCache { get; }
-
private bool _isAnyVbInstanced;
private bool _vsUsesInstanceId;
private byte _vsClipDistancesWritten;
@@ -53,16 +38,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
{
_context = context;
- ShaderCache = new ShaderCache(_context);
-
_currentProgramInfo = new ShaderProgramInfo[Constants.ShaderStages];
-
- BufferCache = new BufferCache(context);
- TextureCache = new TextureCache(context);
-
- context.MemoryManager.MemoryUnmapped += _counterCache.MemoryUnmappedHandler;
- context.MemoryManager.MemoryUnmapped += TextureCache.MemoryUnmappedHandler;
- context.MemoryManager.MemoryUnmapped += BufferCache.MemoryUnmappedHandler;
}
/// <summary>
@@ -130,7 +106,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
_prevTfEnable = false;
}
- FlushUboDirty();
+ FlushUboDirty(state.Channel.MemoryManager);
// Shaders must be the first one to be updated if modified, because
// some of the other state depends on information from the currently
@@ -342,7 +318,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
sbDescAddress += (ulong)sbDescOffset;
- SbDescriptor sbDescriptor = _context.PhysicalMemory.Read<SbDescriptor>(sbDescAddress);
+ SbDescriptor sbDescriptor = state.Channel.MemoryManager.Physical.Read<SbDescriptor>(sbDescAddress);
state.Channel.BufferManager.SetGraphicsStorageBuffer(stage, sb.Slot, sbDescriptor.PackAddress(), (uint)sbDescriptor.Size, sb.Flags);
}
@@ -357,6 +333,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
/// <param name="singleUse">If this is not -1, it indicates that only the given indexed target will be used.</param>
private void UpdateRenderTargetState(GpuState state, bool useControl, int singleUse = -1)
{
+ var memoryManager = state.Channel.MemoryManager;
var rtControl = state.Get<RtControl>(MethodOffset.RtControl);
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
@@ -384,7 +361,12 @@ namespace Ryujinx.Graphics.Gpu.Engine
continue;
}
- Texture color = TextureCache.FindOrCreateTexture(colorState, samplesInX, samplesInY, sizeHint);
+ Texture color = memoryManager.Physical.TextureCache.FindOrCreateTexture(
+ memoryManager,
+ colorState,
+ samplesInX,
+ samplesInY,
+ sizeHint);
changedScale |= state.Channel.TextureManager.SetRenderTargetColor(index, color);
}
@@ -398,7 +380,13 @@ namespace Ryujinx.Graphics.Gpu.Engine
var dsState = state.Get<RtDepthStencilState>(MethodOffset.RtDepthStencilState);
var dsSize = state.Get<Size3D>(MethodOffset.RtDepthStencilSize);
- depthStencil = TextureCache.FindOrCreateTexture(dsState, dsSize, samplesInX, samplesInY, sizeHint);
+ depthStencil = memoryManager.Physical.TextureCache.FindOrCreateTexture(
+ memoryManager,
+ dsState,
+ dsSize,
+ samplesInX,
+ samplesInY,
+ sizeHint);
}
changedScale |= state.Channel.TextureManager.SetRenderTargetDepthStencil(depthStencil);
@@ -1012,7 +1000,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
addressesArray[index] = baseAddress + shader.Offset;
}
- ShaderBundle gs = ShaderCache.GetGraphicsShader(state, addresses);
+ ShaderBundle gs = state.Channel.MemoryManager.Physical.ShaderCache.GetGraphicsShader(state, addresses);
byte oldVsClipDistancesWritten = _vsClipDistancesWritten;