diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-07-15 00:01:10 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-15 13:01:10 +1000 |
commit | 788ca6a411762035a6a7a88100c4b582b47ee82d (patch) | |
tree | d48bfb91aecaead2906ec2d390357546f8c0611f /Ryujinx.Graphics.Gpu/State/GpuState.cs | |
parent | 16dafe63166d065f40b57a9b7cf8017a6ba0b1ef (diff) |
Initial transform feedback support (#1370)
* Initial transform feedback support
* Some nits and fixes
* Update ReportCounterType and Write method
* Can't change shader or TFB bindings while TFB is active
* Fix geometry shader input names with new naming
Diffstat (limited to 'Ryujinx.Graphics.Gpu/State/GpuState.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/State/GpuState.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Gpu/State/GpuState.cs b/Ryujinx.Graphics.Gpu/State/GpuState.cs index 264719b4..9e7d9492 100644 --- a/Ryujinx.Graphics.Gpu/State/GpuState.cs +++ b/Ryujinx.Graphics.Gpu/State/GpuState.cs @@ -346,7 +346,7 @@ namespace Ryujinx.Graphics.Gpu.State /// <param name="offset">Register offset</param> /// <param name="index">Index for indexed data</param> /// <returns>The data at the specified location</returns> - public T Get<T>(MethodOffset offset, int index) where T : struct + public T Get<T>(MethodOffset offset, int index) where T : unmanaged { Register register = _registers[(int)offset]; @@ -364,19 +364,30 @@ namespace Ryujinx.Graphics.Gpu.State /// <typeparam name="T">Type of the data</typeparam> /// <param name="offset">Register offset</param> /// <returns>The data at the specified location</returns> - public T Get<T>(MethodOffset offset) where T : struct + public T Get<T>(MethodOffset offset) where T : unmanaged { return MemoryMarshal.Cast<int, T>(_memory.AsSpan().Slice((int)offset))[0]; } /// <summary> + /// Gets a span of the data at a given register offset. + /// </summary> + /// <param name="offset">Register offset</param> + /// <param name="length">Length of the data in bytes</param> + /// <returns>The data at the specified location</returns> + public Span<byte> GetSpan(MethodOffset offset, int length) + { + return MemoryMarshal.Cast<int, byte>(_memory.AsSpan().Slice((int)offset)).Slice(0, length); + } + + /// <summary> /// Sets indexed data to a given register offset. /// </summary> /// <typeparam name="T">Type of the data</typeparam> /// <param name="offset">Register offset</param> /// <param name="index">Index for indexed data</param> /// <param name="data">The data to set</param> - public void Set<T>(MethodOffset offset, int index, T data) where T : struct + public void Set<T>(MethodOffset offset, int index, T data) where T : unmanaged { Register register = _registers[(int)offset]; @@ -394,7 +405,7 @@ namespace Ryujinx.Graphics.Gpu.State /// <typeparam name="T">Type of the data</typeparam> /// <param name="offset">Register offset</param> /// <param name="data">The data to set</param> - public void Set<T>(MethodOffset offset, T data) where T : struct + public void Set<T>(MethodOffset offset, T data) where T : unmanaged { ReadOnlySpan<int> intSpan = MemoryMarshal.Cast<T, int>(MemoryMarshal.CreateReadOnlySpan(ref data, 1)); intSpan.CopyTo(_memory.AsSpan().Slice((int)offset, intSpan.Length)); |