/// <summary> /// Creates a new instance of the physical memory. /// </summary> /// <param name="cpuMemory">CPU memory manager of the application process</param> public PhysicalMemory(IVirtualMemoryManagerTracked cpuMemory) { _cpuMemory = cpuMemory; if (_cpuMemory is IRefCounted rc) { rc.IncrementReferenceCount(); } }
/// <summary> /// Release our reference to the CPU memory manager. /// </summary> public void Dispose() { if (_cpuMemory is IRefCounted rc) { rc.DecrementReferenceCount(); _cpuMemory = null; } }
/// <summary> /// Creates a new instance of the physical memory. /// </summary> /// <param name="context">GPU context that the physical memory belongs to</param> /// <param name="cpuMemory">CPU memory manager of the application process</param> public PhysicalMemory(GpuContext context, IVirtualMemoryManagerTracked cpuMemory) { _context = context; _cpuMemory = cpuMemory; ShaderCache = new ShaderCache(context); BufferCache = new BufferCache(context, this); TextureCache = new TextureCache(context, this); if (cpuMemory is IRefCounted rc) { rc.IncrementReferenceCount(); } _referenceCount = 1; }