Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 13:18:35 -07:00
|
|
|
using OpenTK.Graphics;
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
2020-08-02 07:41:24 -07:00
|
|
|
using Ryujinx.Common.Configuration;
|
2020-01-09 16:35:50 -08:00
|
|
|
using Ryujinx.Common.Logging;
|
2019-10-12 23:02:07 -07:00
|
|
|
using Ryujinx.Graphics.GAL;
|
2020-05-23 02:46:09 -07:00
|
|
|
using Ryujinx.Graphics.OpenGL.Image;
|
2020-05-03 19:24:59 -07:00
|
|
|
using Ryujinx.Graphics.OpenGL.Queries;
|
2019-10-12 23:02:07 -07:00
|
|
|
using Ryujinx.Graphics.Shader;
|
2020-05-03 19:24:59 -07:00
|
|
|
using System;
|
2019-10-12 23:02:07 -07:00
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.OpenGL
|
|
|
|
{
|
2019-12-31 14:09:49 -08:00
|
|
|
public sealed class Renderer : IRenderer
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-03-28 20:02:58 -07:00
|
|
|
private readonly Pipeline _pipeline;
|
2019-12-31 14:09:49 -08:00
|
|
|
|
|
|
|
public IPipeline Pipeline => _pipeline;
|
2019-10-12 23:02:07 -07:00
|
|
|
|
2019-12-29 09:41:50 -08:00
|
|
|
private readonly Counters _counters;
|
2019-10-12 23:02:07 -07:00
|
|
|
|
2019-12-29 09:41:50 -08:00
|
|
|
private readonly Window _window;
|
2019-10-12 23:02:07 -07:00
|
|
|
|
|
|
|
public IWindow Window => _window;
|
|
|
|
|
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 13:18:35 -07:00
|
|
|
private TextureCopy _textureCopy;
|
|
|
|
private TextureCopy _backgroundTextureCopy;
|
|
|
|
internal TextureCopy TextureCopy => BackgroundContextWorker.InBackground ? _backgroundTextureCopy : _textureCopy;
|
2019-10-12 23:02:07 -07:00
|
|
|
|
2020-09-10 12:44:04 -07:00
|
|
|
internal ResourcePool ResourcePool { get; }
|
|
|
|
|
2020-03-24 14:54:09 -07:00
|
|
|
public string GpuVendor { get; private set; }
|
|
|
|
public string GpuRenderer { get; private set; }
|
|
|
|
public string GpuVersion { get; private set; }
|
|
|
|
|
2019-10-12 23:02:07 -07:00
|
|
|
public Renderer()
|
|
|
|
{
|
2019-12-31 14:09:49 -08:00
|
|
|
_pipeline = new Pipeline();
|
2019-10-12 23:02:07 -07:00
|
|
|
_counters = new Counters();
|
2020-03-28 20:02:58 -07:00
|
|
|
_window = new Window(this);
|
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 13:18:35 -07:00
|
|
|
_textureCopy = new TextureCopy(this);
|
|
|
|
_backgroundTextureCopy = new TextureCopy(this);
|
2020-09-10 12:44:04 -07:00
|
|
|
ResourcePool = new ResourcePool();
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
2020-11-08 03:10:00 -08:00
|
|
|
public IShader CompileShader(ShaderStage stage, string code)
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-11-08 03:10:00 -08:00
|
|
|
return new Shader(stage, code);
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
2020-05-23 02:46:09 -07:00
|
|
|
public BufferHandle CreateBuffer(int size)
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-05-23 02:46:09 -07:00
|
|
|
return Buffer.Create(size);
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
2020-07-14 20:01:10 -07:00
|
|
|
public IProgram CreateProgram(IShader[] shaders, TransformFeedbackDescriptor[] transformFeedbackDescriptors)
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-07-14 20:01:10 -07:00
|
|
|
return new Program(shaders, transformFeedbackDescriptors);
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public ISampler CreateSampler(SamplerCreateInfo info)
|
|
|
|
{
|
|
|
|
return new Sampler(info);
|
|
|
|
}
|
|
|
|
|
2020-07-06 19:41:07 -07:00
|
|
|
public ITexture CreateTexture(TextureCreateInfo info, float scaleFactor)
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-09-10 12:44:04 -07:00
|
|
|
if (info.Target == Target.TextureBuffer)
|
|
|
|
{
|
|
|
|
return new TextureBuffer(info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return ResourcePool.GetTextureOrNull(info, scaleFactor) ?? new TextureStorage(this, info, scaleFactor).CreateDefaultView();
|
|
|
|
}
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
2020-05-23 02:46:09 -07:00
|
|
|
public void DeleteBuffer(BufferHandle buffer)
|
|
|
|
{
|
|
|
|
Buffer.Delete(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
public byte[] GetBufferData(BufferHandle buffer, int offset, int size)
|
|
|
|
{
|
|
|
|
return Buffer.GetData(buffer, offset, size);
|
|
|
|
}
|
|
|
|
|
2019-10-12 23:02:07 -07:00
|
|
|
public Capabilities GetCapabilities()
|
|
|
|
{
|
2019-11-30 18:53:09 -08:00
|
|
|
return new Capabilities(
|
|
|
|
HwCapabilities.SupportsAstcCompression,
|
2020-05-27 02:00:21 -07:00
|
|
|
HwCapabilities.SupportsImageLoadFormatted,
|
2019-12-10 22:54:18 -08:00
|
|
|
HwCapabilities.SupportsNonConstantTextureOffset,
|
2020-05-27 16:03:07 -07:00
|
|
|
HwCapabilities.SupportsViewportSwizzle,
|
2019-12-08 18:55:22 -08:00
|
|
|
HwCapabilities.MaximumComputeSharedMemorySize,
|
2020-05-27 16:03:07 -07:00
|
|
|
HwCapabilities.MaximumSupportedAnisotropy,
|
|
|
|
HwCapabilities.StorageBufferOffsetAlignment);
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
2020-05-23 02:46:09 -07:00
|
|
|
public void SetBufferData(BufferHandle buffer, int offset, ReadOnlySpan<byte> data)
|
|
|
|
{
|
|
|
|
Buffer.SetData(buffer, offset, data);
|
|
|
|
}
|
|
|
|
|
2020-05-03 19:24:59 -07:00
|
|
|
public void UpdateCounters()
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-05-03 19:24:59 -07:00
|
|
|
_counters.Update();
|
|
|
|
}
|
|
|
|
|
2020-09-10 12:44:04 -07:00
|
|
|
public void PreFrame()
|
|
|
|
{
|
|
|
|
ResourcePool.Tick();
|
|
|
|
}
|
|
|
|
|
2020-05-03 19:24:59 -07:00
|
|
|
public ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler)
|
|
|
|
{
|
|
|
|
return _counters.QueueReport(type, resultHandler);
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
|
2020-08-02 07:41:24 -07:00
|
|
|
public void Initialize(GraphicsDebugLevel glLogLevel)
|
2019-10-12 23:02:07 -07:00
|
|
|
{
|
2020-08-02 07:41:24 -07:00
|
|
|
Debugger.Initialize(glLogLevel);
|
|
|
|
|
2020-01-09 16:40:55 -08:00
|
|
|
PrintGpuInformation();
|
2020-01-09 16:35:50 -08:00
|
|
|
|
2019-10-12 23:02:07 -07:00
|
|
|
_counters.Initialize();
|
|
|
|
}
|
|
|
|
|
2020-01-09 16:40:55 -08:00
|
|
|
private void PrintGpuInformation()
|
2020-01-09 16:35:50 -08:00
|
|
|
{
|
2020-03-24 14:54:09 -07:00
|
|
|
GpuVendor = GL.GetString(StringName.Vendor);
|
|
|
|
GpuRenderer = GL.GetString(StringName.Renderer);
|
|
|
|
GpuVersion = GL.GetString(StringName.Version);
|
2020-01-09 16:35:50 -08:00
|
|
|
|
2020-08-03 16:32:53 -07:00
|
|
|
Logger.Notice.Print(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})");
|
2020-01-09 16:35:50 -08:00
|
|
|
}
|
|
|
|
|
2019-10-12 23:02:07 -07:00
|
|
|
public void ResetCounter(CounterType type)
|
|
|
|
{
|
2020-05-03 19:24:59 -07:00
|
|
|
_counters.QueueReset(type);
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
2019-12-31 14:09:49 -08:00
|
|
|
|
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 13:18:35 -07:00
|
|
|
public void BackgroundContextAction(Action action)
|
|
|
|
{
|
|
|
|
if (GraphicsContext.CurrentContext != null)
|
|
|
|
{
|
|
|
|
action(); // We have a context already - use that (assuming it is the main one).
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_window.BackgroundContext.Invoke(action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void InitializeBackgroundContext(IGraphicsContext baseContext)
|
|
|
|
{
|
|
|
|
_window.InitializeBackgroundContext(baseContext);
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:09:49 -08:00
|
|
|
public void Dispose()
|
|
|
|
{
|
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
2020-10-16 13:18:35 -07:00
|
|
|
_textureCopy.Dispose();
|
|
|
|
_backgroundTextureCopy.Dispose();
|
2020-09-10 12:44:04 -07:00
|
|
|
ResourcePool.Dispose();
|
2019-12-31 14:09:49 -08:00
|
|
|
_pipeline.Dispose();
|
|
|
|
_window.Dispose();
|
2020-05-03 19:24:59 -07:00
|
|
|
_counters.Dispose();
|
2019-12-31 14:09:49 -08:00
|
|
|
}
|
2020-11-12 15:15:34 -08:00
|
|
|
|
|
|
|
public IProgram LoadProgramBinary(byte[] programBinary)
|
|
|
|
{
|
|
|
|
Program program = new Program(programBinary);
|
|
|
|
|
|
|
|
if (program.IsLinked)
|
|
|
|
{
|
|
|
|
return program;
|
|
|
|
}
|
|
|
|
|
|
|
|
program.Dispose();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2019-10-12 23:02:07 -07:00
|
|
|
}
|
|
|
|
}
|