Implement texture buffers (#1152)

* Implement texture buffers

* Throw NotSupportedException where appropriate
This commit is contained in:
gdkchan 2020-04-25 10:02:18 -03:00 committed by GitHub
parent a065dc1626
commit 3cb1fa0e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 291 additions and 135 deletions

View file

@ -1,19 +1,27 @@
using Ryujinx.Common;
using System;
namespace Ryujinx.Graphics.Texture
{
public struct SizeInfo
{
private int[] _mipOffsets;
private int[] _allOffsets;
private readonly int[] _mipOffsets;
private readonly int[] _allOffsets;
private int _levels;
private readonly int _levels;
public int LayerSize { get; }
public int TotalSize { get; }
public SizeInfo(
public SizeInfo(int size)
{
_mipOffsets = new int[] { 0 };
_allOffsets = new int[] { 0 };
_levels = 1;
LayerSize = size;
TotalSize = size;
}
internal SizeInfo(
int[] mipOffsets,
int[] allOffsets,
int levels,
@ -29,7 +37,7 @@ namespace Ryujinx.Graphics.Texture
public int GetMipOffset(int level)
{
if ((uint)level > _mipOffsets.Length)
if ((uint)level >= _mipOffsets.Length)
{
throw new ArgumentOutOfRangeException(nameof(level));
}