Implement S8D24 texture format and tweak depth range detection (#2458)

This commit is contained in:
gdkchan 2022-03-14 23:42:08 -03:00 committed by GitHub
parent 79becc4b78
commit e5ad1dfa48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 196 additions and 30 deletions

View file

@ -140,9 +140,11 @@ namespace Ryujinx.Graphics.OpenGL.Image
size += Info.GetMipSize(level);
}
ReadOnlySpan<byte> data;
if (HwCapabilities.UsePersistentBufferForFlush)
{
return _renderer.PersistentBuffers.Default.GetTextureData(this, size);
data = _renderer.PersistentBuffers.Default.GetTextureData(this, size);
}
else
{
@ -150,8 +152,15 @@ namespace Ryujinx.Graphics.OpenGL.Image
WriteTo(target);
return new ReadOnlySpan<byte>(target.ToPointer(), size);
data = new ReadOnlySpan<byte>(target.ToPointer(), size);
}
if (Format == Format.S8UintD24Unorm)
{
data = FormatConverter.ConvertD24S8ToS8D24(data);
}
return data;
}
public unsafe ReadOnlySpan<byte> GetData(int layer, int level)
@ -285,6 +294,11 @@ namespace Ryujinx.Graphics.OpenGL.Image
public void SetData(ReadOnlySpan<byte> data)
{
if (Format == Format.S8UintD24Unorm)
{
data = FormatConverter.ConvertS8D24ToD24S8(data);
}
unsafe
{
fixed (byte* ptr = data)
@ -296,6 +310,11 @@ namespace Ryujinx.Graphics.OpenGL.Image
public void SetData(ReadOnlySpan<byte> data, int layer, int level)
{
if (Format == Format.S8UintD24Unorm)
{
data = FormatConverter.ConvertS8D24ToD24S8(data);
}
unsafe
{
fixed (byte* ptr = data)