2021-01-17 21:08:06 +01:00
|
|
|
using Ryujinx.Graphics.Shader;
|
2023-12-04 20:30:19 +01:00
|
|
|
using Ryujinx.Memory.Range;
|
2024-04-07 23:25:55 +02:00
|
|
|
using System;
|
2021-01-17 21:08:06 +01:00
|
|
|
|
2019-10-13 08:02:07 +02:00
|
|
|
namespace Ryujinx.Graphics.Gpu.Memory
|
|
|
|
{
|
2019-12-31 04:22:58 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Memory range used for buffers.
|
|
|
|
/// </summary>
|
2024-04-07 23:25:55 +02:00
|
|
|
readonly struct BufferBounds : IEquatable<BufferBounds>
|
2019-10-13 08:02:07 +02:00
|
|
|
{
|
2020-11-08 12:10:00 +01:00
|
|
|
/// <summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
/// Physical memory ranges where the buffer is mapped.
|
2020-11-08 12:10:00 +01:00
|
|
|
/// </summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
public MultiRange Range { get; }
|
2020-11-08 12:10:00 +01:00
|
|
|
|
|
|
|
/// <summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
/// Buffer usage flags.
|
2020-11-08 12:10:00 +01:00
|
|
|
/// </summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
public BufferUsageFlags Flags { get; }
|
2020-11-08 12:10:00 +01:00
|
|
|
|
2021-01-17 21:08:06 +01:00
|
|
|
/// <summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
/// Indicates that the backing memory for the buffer does not exist.
|
2021-01-17 21:08:06 +01:00
|
|
|
/// </summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
public bool IsUnmapped => Range.IsUnmapped;
|
2021-01-17 21:08:06 +01:00
|
|
|
|
2020-11-08 12:10:00 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new buffer region.
|
|
|
|
/// </summary>
|
2023-12-04 20:30:19 +01:00
|
|
|
/// <param name="range">Physical memory ranges where the buffer is mapped</param>
|
2021-01-17 21:08:06 +01:00
|
|
|
/// <param name="flags">Buffer usage flags</param>
|
2023-12-04 20:30:19 +01:00
|
|
|
public BufferBounds(MultiRange range, BufferUsageFlags flags = BufferUsageFlags.None)
|
2020-11-08 12:10:00 +01:00
|
|
|
{
|
2023-12-04 20:30:19 +01:00
|
|
|
Range = range;
|
2021-01-17 21:08:06 +01:00
|
|
|
Flags = flags;
|
2020-11-08 12:10:00 +01:00
|
|
|
}
|
2024-04-07 23:25:55 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2019-10-13 08:02:07 +02:00
|
|
|
}
|
2023-07-02 02:47:54 +02:00
|
|
|
}
|