diff options
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs')
| -rw-r--r-- | Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs index baf8e65d..4fc0a77f 100644 --- a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs +++ b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs @@ -1,12 +1,14 @@ using OpenTK.Graphics.OpenGL; using Ryujinx.Common.Logging; using Ryujinx.Graphics.GAL; +using System; namespace Ryujinx.Graphics.OpenGL.Image { class TextureStorage { public int Handle { get; private set; } + public float ScaleFactor { get; private set; } public TextureCreateInfo Info { get; } @@ -14,12 +16,13 @@ namespace Ryujinx.Graphics.OpenGL.Image private int _viewsCount; - public TextureStorage(Renderer renderer, TextureCreateInfo info) + public TextureStorage(Renderer renderer, TextureCreateInfo info, float scaleFactor) { _renderer = renderer; Info = info; Handle = GL.GenTexture(); + ScaleFactor = scaleFactor; CreateImmutableStorage(); } @@ -32,6 +35,9 @@ 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; @@ -52,7 +58,7 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget1d.Texture1D, Info.Levels, internalFormat, - Info.Width); + width); break; case Target.Texture1DArray: @@ -60,8 +66,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget2d.Texture1DArray, Info.Levels, internalFormat, - Info.Width, - Info.Height); + width, + height); break; case Target.Texture2D: @@ -69,8 +75,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget2d.Texture2D, Info.Levels, internalFormat, - Info.Width, - Info.Height); + width, + height); break; case Target.Texture2DArray: @@ -78,8 +84,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget3d.Texture2DArray, Info.Levels, internalFormat, - Info.Width, - Info.Height, + width, + height, Info.Depth); break; @@ -88,8 +94,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTargetMultisample2d.Texture2DMultisample, Info.Samples, internalFormat, - Info.Width, - Info.Height, + width, + height, true); break; @@ -98,8 +104,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTargetMultisample3d.Texture2DMultisampleArray, Info.Samples, internalFormat, - Info.Width, - Info.Height, + width, + height, Info.Depth, true); break; @@ -109,8 +115,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget3d.Texture3D, Info.Levels, internalFormat, - Info.Width, - Info.Height, + width, + height, Info.Depth); break; @@ -119,8 +125,8 @@ namespace Ryujinx.Graphics.OpenGL.Image TextureTarget2d.TextureCubeMap, Info.Levels, internalFormat, - Info.Width, - Info.Height); + width, + height); break; case Target.CubemapArray: @@ -128,8 +134,8 @@ namespace Ryujinx.Graphics.OpenGL.Image (TextureTarget3d)All.TextureCubeMapArray, Info.Levels, internalFormat, - Info.Width, - Info.Height, + width, + height, Info.Depth); break; |
