aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Image
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-04-12 22:09:42 -0300
committerGitHub <noreply@github.com>2021-04-13 03:09:42 +0200
commit001005b3d56d4984399b4baf8e4b7348ecdb5062 (patch)
tree5d478ed3a4d78a20f471751af046dd345cce1f36 /Ryujinx.Graphics.OpenGL/Image
parentb662a26c7e2b66d916986b1ed9ffae3b918619d1 (diff)
Fix sub-image copies on intel GPUs (#2198)
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image')
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/ITextureInfo.cs4
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureBase.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs54
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureView.cs4
5 files changed, 47 insertions, 19 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Image/ITextureInfo.cs b/Ryujinx.Graphics.OpenGL/Image/ITextureInfo.cs
index 92bd597c..0e9f6f11 100644
--- a/Ryujinx.Graphics.OpenGL/Image/ITextureInfo.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/ITextureInfo.cs
@@ -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; }
}
}
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs b/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs
index ebf0cacc..2e70fa82 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs
@@ -3,7 +3,7 @@ using Ryujinx.Graphics.GAL;
namespace Ryujinx.Graphics.OpenGL.Image
{
- class TextureBase : ITextureInfo
+ class TextureBase
{
public int Handle { get; protected set; }
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs b/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs
index b27403b2..3c0546d2 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs
@@ -205,22 +205,44 @@ namespace Ryujinx.Graphics.OpenGL.Image
int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width;
int copyHeight = sizeInBlocks ? BitUtils.DivRoundUp(height, blockHeight) : height;
- GL.CopyImageSubData(
- srcHandle,
- srcInfo.Target.ConvertToImageTarget(),
- srcLevel + level,
- 0,
- 0,
- srcLayer,
- dstHandle,
- dstInfo.Target.ConvertToImageTarget(),
- dstLevel + level,
- 0,
- 0,
- dstLayer,
- copyWidth,
- copyHeight,
- depth);
+ 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(),
+ srcLevel + level,
+ 0,
+ 0,
+ srcLayer,
+ dstHandle,
+ dstInfo.Target.ConvertToImageTarget(),
+ dstLevel + level,
+ 0,
+ 0,
+ dstLayer,
+ copyWidth,
+ copyHeight,
+ depth);
+ }
}
width = Math.Max(1, width >> 1);
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
index e96d8d85..c5108893 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
@@ -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; }
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
index 8bc75efb..8799167a 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
@@ -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; }