1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-11 23:02:02 +00:00

Fix sub-image copies on intel GPUs (#2198)

This commit is contained in:
gdkchan 2021-04-12 22:09:42 -03:00 committed by GitHub
parent b662a26c7e
commit 001005b3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 19 deletions

View file

@ -5,6 +5,10 @@ namespace Ryujinx.Graphics.OpenGL.Image
interface ITextureInfo
{
int Handle { get; }
int StorageHandle { get; }
int FirstLayer => 0;
int FirstLevel => 0;
TextureCreateInfo Info { get; }
}
}

View file

@ -3,7 +3,7 @@ using Ryujinx.Graphics.GAL;
namespace Ryujinx.Graphics.OpenGL.Image
{
class TextureBase : ITextureInfo
class TextureBase
{
public int Handle { get; protected set; }

View file

@ -205,6 +205,27 @@ namespace Ryujinx.Graphics.OpenGL.Image
int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width;
int copyHeight = sizeInBlocks ? BitUtils.DivRoundUp(height, blockHeight) : height;
if (HwCapabilities.Vendor == HwCapabilities.GpuVendor.Intel)
{
GL.CopyImageSubData(
src.StorageHandle,
srcInfo.Target.ConvertToImageTarget(),
src.FirstLevel + srcLevel + level,
0,
0,
src.FirstLayer + srcLayer,
dst.StorageHandle,
dstInfo.Target.ConvertToImageTarget(),
dst.FirstLevel + dstLevel + level,
0,
0,
dst.FirstLayer + dstLayer,
copyWidth,
copyHeight,
depth);
}
else
{
GL.CopyImageSubData(
srcHandle,
srcInfo.Target.ConvertToImageTarget(),
@ -222,6 +243,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
copyHeight,
depth);
}
}
width = Math.Max(1, width >> 1);
height = Math.Max(1, height >> 1);

View file

@ -1,13 +1,13 @@
using OpenTK.Graphics.OpenGL;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using System;
namespace Ryujinx.Graphics.OpenGL.Image
{
class TextureStorage : ITextureInfo
{
public int Handle { get; private set; }
public int StorageHandle => Handle;
public float ScaleFactor { get; private set; }
public TextureCreateInfo Info { get; }

View file

@ -4,12 +4,14 @@ using System;
namespace Ryujinx.Graphics.OpenGL.Image
{
class TextureView : TextureBase, ITexture
class TextureView : TextureBase, ITexture, ITextureInfo
{
private readonly Renderer _renderer;
private readonly TextureStorage _parent;
public int StorageHandle => _parent.Handle;
private TextureView _incompatibleFormatView;
public int FirstLayer { get; private set; }