using Ryujinx.Graphics.Shader;
using Ryujinx.Memory.Range;
using System;
namespace Ryujinx.Graphics.Gpu.Memory
{
///
/// Memory range used for buffers.
///
readonly struct BufferBounds : IEquatable
{
///
/// Physical memory ranges where the buffer is mapped.
///
public MultiRange Range { get; }
///
/// Buffer usage flags.
///
public BufferUsageFlags Flags { get; }
///
/// Indicates that the backing memory for the buffer does not exist.
///
public bool IsUnmapped => Range.IsUnmapped;
///
/// Creates a new buffer region.
///
/// Physical memory ranges where the buffer is mapped
/// Buffer usage flags
public BufferBounds(MultiRange range, BufferUsageFlags flags = BufferUsageFlags.None)
{
Range = range;
Flags = flags;
}
public override bool Equals(object obj)
{
return obj is BufferBounds bounds && Equals(bounds);
}
public bool Equals(BufferBounds bounds)
{
return Range == bounds.Range && Flags == bounds.Flags;
}
public bool Equals(ref BufferBounds bounds)
{
return Range == bounds.Range && Flags == bounds.Flags;
}
public override int GetHashCode()
{
return HashCode.Combine(Range, Flags);
}
}
}