using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Gpu.Shader.HashTable;
using System;
namespace Ryujinx.Graphics.Gpu.Shader
{
///
/// Shader code accessor.
///
readonly struct ShaderCodeAccessor : IDataAccessor
{
private readonly MemoryManager _memoryManager;
private readonly ulong _baseAddress;
///
/// Creates a new shader code accessor.
///
/// Memory manager used to access the shader code
/// Base address of the shader in memory
public ShaderCodeAccessor(MemoryManager memoryManager, ulong baseAddress)
{
_memoryManager = memoryManager;
_baseAddress = baseAddress;
}
///
public ReadOnlySpan GetSpan(int offset, int length)
{
return _memoryManager.GetSpanMapped(_baseAddress + (ulong)offset, length);
}
}
}