aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/TextureStorage.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-03-29 09:48:39 -0300
committerGitHub <noreply@github.com>2020-03-29 23:48:39 +1100
commitb18ef8e3a00980595f45c7fe184dcb160dcc3cb9 (patch)
tree9d9b3fea4d7822d548878988c12c18e23a72bb52 /Ryujinx.Graphics.OpenGL/TextureStorage.cs
parent5c1757f7c29fc06577b5fc551dd3d76b12b281d3 (diff)
Workaround for AMD and Intel view format bug (#1050)
* Workaround for Intel view format bug * Dispose of the intermmediate texture aswell * Apply workaround on AMD aswell
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/TextureStorage.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/TextureStorage.cs76
1 files changed, 37 insertions, 39 deletions
diff --git a/Ryujinx.Graphics.OpenGL/TextureStorage.cs b/Ryujinx.Graphics.OpenGL/TextureStorage.cs
index 241b4116..b680f3a6 100644
--- a/Ryujinx.Graphics.OpenGL/TextureStorage.cs
+++ b/Ryujinx.Graphics.OpenGL/TextureStorage.cs
@@ -8,18 +8,16 @@ namespace Ryujinx.Graphics.OpenGL
{
public int Handle { get; private set; }
- private readonly Renderer _renderer;
-
- private readonly TextureCreateInfo _info;
+ public TextureCreateInfo Info { get; }
- public Target Target => _info.Target;
+ private readonly Renderer _renderer;
private int _viewsCount;
public TextureStorage(Renderer renderer, TextureCreateInfo info)
{
_renderer = renderer;
- _info = info;
+ Info = info;
Handle = GL.GenTexture();
@@ -28,13 +26,13 @@ namespace Ryujinx.Graphics.OpenGL
private void CreateImmutableStorage()
{
- TextureTarget target = _info.Target.Convert();
+ TextureTarget target = Info.Target.Convert();
GL.ActiveTexture(TextureUnit.Texture0);
GL.BindTexture(target, Handle);
- FormatInfo format = FormatTable.GetFormatInfo(_info.Format);
+ FormatInfo format = FormatTable.GetFormatInfo(Info.Format);
SizedInternalFormat internalFormat;
@@ -47,92 +45,92 @@ namespace Ryujinx.Graphics.OpenGL
internalFormat = (SizedInternalFormat)format.PixelInternalFormat;
}
- switch (_info.Target)
+ switch (Info.Target)
{
case Target.Texture1D:
GL.TexStorage1D(
TextureTarget1d.Texture1D,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width);
+ Info.Width);
break;
case Target.Texture1DArray:
GL.TexStorage2D(
TextureTarget2d.Texture1DArray,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width,
- _info.Height);
+ Info.Width,
+ Info.Height);
break;
case Target.Texture2D:
GL.TexStorage2D(
TextureTarget2d.Texture2D,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width,
- _info.Height);
+ Info.Width,
+ Info.Height);
break;
case Target.Texture2DArray:
GL.TexStorage3D(
TextureTarget3d.Texture2DArray,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width,
- _info.Height,
- _info.Depth);
+ Info.Width,
+ Info.Height,
+ Info.Depth);
break;
case Target.Texture2DMultisample:
GL.TexStorage2DMultisample(
TextureTargetMultisample2d.Texture2DMultisample,
- _info.Samples,
+ Info.Samples,
internalFormat,
- _info.Width,
- _info.Height,
+ Info.Width,
+ Info.Height,
true);
break;
case Target.Texture2DMultisampleArray:
GL.TexStorage3DMultisample(
TextureTargetMultisample3d.Texture2DMultisampleArray,
- _info.Samples,
+ Info.Samples,
internalFormat,
- _info.Width,
- _info.Height,
- _info.Depth,
+ Info.Width,
+ Info.Height,
+ Info.Depth,
true);
break;
case Target.Texture3D:
GL.TexStorage3D(
TextureTarget3d.Texture3D,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width,
- _info.Height,
- _info.Depth);
+ Info.Width,
+ Info.Height,
+ Info.Depth);
break;
case Target.Cubemap:
GL.TexStorage2D(
TextureTarget2d.TextureCubeMap,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width,
- _info.Height);
+ Info.Width,
+ Info.Height);
break;
case Target.CubemapArray:
GL.TexStorage3D(
(TextureTarget3d)All.TextureCubeMapArray,
- _info.Levels,
+ Info.Levels,
internalFormat,
- _info.Width,
- _info.Height,
- _info.Depth);
+ Info.Width,
+ Info.Height,
+ Info.Depth);
break;
default:
@@ -143,7 +141,7 @@ namespace Ryujinx.Graphics.OpenGL
public ITexture CreateDefaultView()
{
- return CreateView(_info, 0, 0);
+ return CreateView(Info, 0, 0);
}
public ITexture CreateView(TextureCreateInfo info, int firstLayer, int firstLevel)