mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-12-26 05:46:49 +01:00
Fix sub-image copies on intel GPUs (#2198)
This commit is contained in:
parent
b662a26c7e
commit
001005b3d5
5 changed files with 47 additions and 19 deletions
|
@ -5,6 +5,10 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||||
interface ITextureInfo
|
interface ITextureInfo
|
||||||
{
|
{
|
||||||
int Handle { get; }
|
int Handle { get; }
|
||||||
|
int StorageHandle { get; }
|
||||||
|
int FirstLayer => 0;
|
||||||
|
int FirstLevel => 0;
|
||||||
|
|
||||||
TextureCreateInfo Info { get; }
|
TextureCreateInfo Info { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ using Ryujinx.Graphics.GAL;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.OpenGL.Image
|
namespace Ryujinx.Graphics.OpenGL.Image
|
||||||
{
|
{
|
||||||
class TextureBase : ITextureInfo
|
class TextureBase
|
||||||
{
|
{
|
||||||
public int Handle { get; protected set; }
|
public int Handle { get; protected set; }
|
||||||
|
|
||||||
|
|
|
@ -205,22 +205,44 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||||
int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width;
|
int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width;
|
||||||
int copyHeight = sizeInBlocks ? BitUtils.DivRoundUp(height, blockHeight) : height;
|
int copyHeight = sizeInBlocks ? BitUtils.DivRoundUp(height, blockHeight) : height;
|
||||||
|
|
||||||
GL.CopyImageSubData(
|
if (HwCapabilities.Vendor == HwCapabilities.GpuVendor.Intel)
|
||||||
srcHandle,
|
{
|
||||||
srcInfo.Target.ConvertToImageTarget(),
|
GL.CopyImageSubData(
|
||||||
srcLevel + level,
|
src.StorageHandle,
|
||||||
0,
|
srcInfo.Target.ConvertToImageTarget(),
|
||||||
0,
|
src.FirstLevel + srcLevel + level,
|
||||||
srcLayer,
|
0,
|
||||||
dstHandle,
|
0,
|
||||||
dstInfo.Target.ConvertToImageTarget(),
|
src.FirstLayer + srcLayer,
|
||||||
dstLevel + level,
|
dst.StorageHandle,
|
||||||
0,
|
dstInfo.Target.ConvertToImageTarget(),
|
||||||
0,
|
dst.FirstLevel + dstLevel + level,
|
||||||
dstLayer,
|
0,
|
||||||
copyWidth,
|
0,
|
||||||
copyHeight,
|
dst.FirstLayer + dstLayer,
|
||||||
depth);
|
copyWidth,
|
||||||
|
copyHeight,
|
||||||
|
depth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL.CopyImageSubData(
|
||||||
|
srcHandle,
|
||||||
|
srcInfo.Target.ConvertToImageTarget(),
|
||||||
|
srcLevel + level,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
srcLayer,
|
||||||
|
dstHandle,
|
||||||
|
dstInfo.Target.ConvertToImageTarget(),
|
||||||
|
dstLevel + level,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
dstLayer,
|
||||||
|
copyWidth,
|
||||||
|
copyHeight,
|
||||||
|
depth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
width = Math.Max(1, width >> 1);
|
width = Math.Max(1, width >> 1);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using OpenTK.Graphics.OpenGL;
|
using OpenTK.Graphics.OpenGL;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.OpenGL.Image
|
namespace Ryujinx.Graphics.OpenGL.Image
|
||||||
{
|
{
|
||||||
class TextureStorage : ITextureInfo
|
class TextureStorage : ITextureInfo
|
||||||
{
|
{
|
||||||
public int Handle { get; private set; }
|
public int Handle { get; private set; }
|
||||||
|
public int StorageHandle => Handle;
|
||||||
public float ScaleFactor { get; private set; }
|
public float ScaleFactor { get; private set; }
|
||||||
|
|
||||||
public TextureCreateInfo Info { get; }
|
public TextureCreateInfo Info { get; }
|
||||||
|
|
|
@ -4,12 +4,14 @@ using System;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.OpenGL.Image
|
namespace Ryujinx.Graphics.OpenGL.Image
|
||||||
{
|
{
|
||||||
class TextureView : TextureBase, ITexture
|
class TextureView : TextureBase, ITexture, ITextureInfo
|
||||||
{
|
{
|
||||||
private readonly Renderer _renderer;
|
private readonly Renderer _renderer;
|
||||||
|
|
||||||
private readonly TextureStorage _parent;
|
private readonly TextureStorage _parent;
|
||||||
|
|
||||||
|
public int StorageHandle => _parent.Handle;
|
||||||
|
|
||||||
private TextureView _incompatibleFormatView;
|
private TextureView _incompatibleFormatView;
|
||||||
|
|
||||||
public int FirstLayer { get; private set; }
|
public int FirstLayer { get; private set; }
|
||||||
|
|
Loading…
Reference in a new issue