aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Image
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-10-29 18:57:34 -0300
committerGitHub <noreply@github.com>2020-10-29 22:57:34 +0100
commit423da5cc911bf7545746ad4fd184eff42f32dd9b (patch)
treec554fe100de8be953a8a492d4386e23e6a91b7e8 /Ryujinx.Graphics.OpenGL/Image
parent780c7530d69068dd651c33e18828e23dc6977d90 (diff)
Scale texture resolution before sending to backend (#1646)
* Work * Propagate scale factor to copy temp. Not really needed, just here for consistency * PR feedback
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image')
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureBase.cs7
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs11
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs37
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureView.cs9
5 files changed, 29 insertions, 37 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs b/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs
index 5f786dec..2e70fa82 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureBase.cs
@@ -1,6 +1,5 @@
using OpenTK.Graphics.OpenGL;
using Ryujinx.Graphics.GAL;
-using System;
namespace Ryujinx.Graphics.OpenGL.Image
{
@@ -10,8 +9,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
public TextureCreateInfo Info { get; }
- public int Width { get; }
- public int Height { get; }
+ public int Width => Info.Width;
+ public int Height => Info.Height;
public float ScaleFactor { get; }
public Target Target => Info.Target;
@@ -20,8 +19,6 @@ namespace Ryujinx.Graphics.OpenGL.Image
public TextureBase(TextureCreateInfo info, float scaleFactor = 1f)
{
Info = info;
- Width = (int)Math.Ceiling(Info.Width * scaleFactor);
- Height = (int)Math.Ceiling(Info.Height * scaleFactor);
ScaleFactor = scaleFactor;
Handle = GL.GenTexture();
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs b/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs
index edfbec5f..191e9b63 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureCopy.cs
@@ -129,7 +129,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
public TextureView BgraSwap(TextureView from)
{
- TextureView to = (TextureView)_renderer.CreateTexture(from.Info, 1f);
+ TextureView to = (TextureView)_renderer.CreateTexture(from.Info, from.ScaleFactor);
EnsurePbo(from);
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs b/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs
index 02ae3b58..28401138 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs
@@ -15,16 +15,15 @@ namespace Ryujinx.Graphics.OpenGL.Image
int srcLayer,
int dstLayer,
int srcLevel,
- int dstLevel,
- float scaleFactor = 1f)
+ int dstLevel)
{
- int srcWidth = (int)Math.Ceiling(srcInfo.Width * scaleFactor);
- int srcHeight = (int)Math.Ceiling(srcInfo.Height * scaleFactor);
+ int srcWidth = srcInfo.Width;
+ int srcHeight = srcInfo.Height;
int srcDepth = srcInfo.GetDepthOrLayers();
int srcLevels = srcInfo.Levels;
- int dstWidth = (int)Math.Ceiling(dstInfo.Width * scaleFactor);
- int dstHeight = (int)Math.Ceiling(dstInfo.Height * scaleFactor);
+ int dstWidth = dstInfo.Width;
+ int dstHeight = dstInfo.Height;
int dstDepth = dstInfo.GetDepthOrLayers();
int dstLevels = dstInfo.Levels;
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
index 635b6c2c..b34b02bf 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
@@ -37,9 +37,6 @@ namespace Ryujinx.Graphics.OpenGL.Image
GL.BindTexture(target, Handle);
- int width = (int)Math.Ceiling(Info.Width * ScaleFactor);
- int height = (int)Math.Ceiling(Info.Height * ScaleFactor);
-
FormatInfo format = FormatTable.GetFormatInfo(Info.Format);
SizedInternalFormat internalFormat;
@@ -60,7 +57,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTarget1d.Texture1D,
Info.Levels,
internalFormat,
- width);
+ Info.Width);
break;
case Target.Texture1DArray:
@@ -68,8 +65,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTarget2d.Texture1DArray,
Info.Levels,
internalFormat,
- width,
- height);
+ Info.Width,
+ Info.Height);
break;
case Target.Texture2D:
@@ -77,8 +74,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTarget2d.Texture2D,
Info.Levels,
internalFormat,
- width,
- height);
+ Info.Width,
+ Info.Height);
break;
case Target.Texture2DArray:
@@ -86,8 +83,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTarget3d.Texture2DArray,
Info.Levels,
internalFormat,
- width,
- height,
+ Info.Width,
+ Info.Height,
Info.Depth);
break;
@@ -96,8 +93,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTargetMultisample2d.Texture2DMultisample,
Info.Samples,
internalFormat,
- width,
- height,
+ Info.Width,
+ Info.Height,
true);
break;
@@ -106,8 +103,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTargetMultisample3d.Texture2DMultisampleArray,
Info.Samples,
internalFormat,
- width,
- height,
+ Info.Width,
+ Info.Height,
Info.Depth,
true);
break;
@@ -117,8 +114,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTarget3d.Texture3D,
Info.Levels,
internalFormat,
- width,
- height,
+ Info.Width,
+ Info.Height,
Info.Depth);
break;
@@ -127,8 +124,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
TextureTarget2d.TextureCubeMap,
Info.Levels,
internalFormat,
- width,
- height);
+ Info.Width,
+ Info.Height);
break;
case Target.CubemapArray:
@@ -136,8 +133,8 @@ namespace Ryujinx.Graphics.OpenGL.Image
(TextureTarget3d)All.TextureCubeMapArray,
Info.Levels,
internalFormat,
- width,
- height,
+ Info.Width,
+ Info.Height,
Info.Depth);
break;
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
index 04cadae7..449c18d4 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
@@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
_incompatibleFormatView = (TextureView)_renderer.CreateTexture(Info, ScaleFactor);
}
- TextureCopyUnscaled.Copy(_parent.Info, _incompatibleFormatView.Info, _parent.Handle, _incompatibleFormatView.Handle, FirstLayer, 0, FirstLevel, 0, ScaleFactor);
+ TextureCopyUnscaled.Copy(_parent.Info, _incompatibleFormatView.Info, _parent.Handle, _incompatibleFormatView.Handle, FirstLayer, 0, FirstLevel, 0);
return _incompatibleFormatView.Handle;
}
@@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
{
if (_incompatibleFormatView != null)
{
- TextureCopyUnscaled.Copy(_incompatibleFormatView.Info, _parent.Info, _incompatibleFormatView.Handle, _parent.Handle, 0, FirstLayer, 0, FirstLevel, ScaleFactor);
+ TextureCopyUnscaled.Copy(_incompatibleFormatView.Info, _parent.Info, _incompatibleFormatView.Handle, _parent.Handle, 0, FirstLayer, 0, FirstLevel);
}
}
@@ -154,7 +154,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
{
TextureView destinationView = (TextureView)destination;
- TextureCopyUnscaled.Copy(Info, destinationView.Info, Handle, destinationView.Handle, 0, firstLayer, 0, firstLevel, ScaleFactor);
+ TextureCopyUnscaled.Copy(Info, destinationView.Info, Handle, destinationView.Handle, 0, firstLayer, 0, firstLevel);
if (destinationView._emulatedViewParent != null)
{
@@ -166,8 +166,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
0,
destinationView.FirstLayer,
0,
- destinationView.FirstLevel,
- ScaleFactor);
+ destinationView.FirstLevel);
}
}