diff --git a/Ryujinx.Graphics.OpenGL/Framebuffer.cs b/Ryujinx.Graphics.OpenGL/Framebuffer.cs index ad72db49ce..23f015b183 100644 --- a/Ryujinx.Graphics.OpenGL/Framebuffer.cs +++ b/Ryujinx.Graphics.OpenGL/Framebuffer.cs @@ -28,9 +28,10 @@ namespace Ryujinx.Graphics.OpenGL { FramebufferAttachment attachment = FramebufferAttachment.ColorAttachment0 + index; - if (HwCapabilities.IsIntelDriver) + if (HwCapabilities.Vendor == HwCapabilities.GpuVendor.Amd || + HwCapabilities.Vendor == HwCapabilities.GpuVendor.Intel) { - GL.FramebufferTexture(FramebufferTarget.Framebuffer, attachment, color?.GetIntelWarViewHandle() ?? 0, 0); + GL.FramebufferTexture(FramebufferTarget.Framebuffer, attachment, color?.GetIncompatibleFormatViewHandle() ?? 0, 0); _colors[index] = color; } @@ -81,7 +82,8 @@ namespace Ryujinx.Graphics.OpenGL public void SignalModified() { - if (HwCapabilities.IsIntelDriver) + if (HwCapabilities.Vendor == HwCapabilities.GpuVendor.Amd || + HwCapabilities.Vendor == HwCapabilities.GpuVendor.Intel) { for (int i = 0; i < 8; i++) { diff --git a/Ryujinx.Graphics.OpenGL/HwCapabilities.cs b/Ryujinx.Graphics.OpenGL/HwCapabilities.cs index a5c46c787f..3d72cb7da6 100644 --- a/Ryujinx.Graphics.OpenGL/HwCapabilities.cs +++ b/Ryujinx.Graphics.OpenGL/HwCapabilities.cs @@ -10,16 +10,17 @@ namespace Ryujinx.Graphics.OpenGL private static readonly Lazy _maximumComputeSharedMemorySize = new Lazy(() => GetLimit(All.MaxComputeSharedMemorySize)); private static readonly Lazy _storageBufferOffsetAlignment = new Lazy(() => GetLimit(All.ShaderStorageBufferOffsetAlignment)); - private enum GpuVendor + public enum GpuVendor { Unknown, + Amd, Intel, Nvidia } private static readonly Lazy _gpuVendor = new Lazy(GetGpuVendor); - public static bool IsIntelDriver => _gpuVendor.Value == GpuVendor.Intel; + public static GpuVendor Vendor => _gpuVendor.Value; public static bool SupportsAstcCompression => _supportsAstcCompression.Value; public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia; @@ -49,16 +50,20 @@ namespace Ryujinx.Graphics.OpenGL private static GpuVendor GetGpuVendor() { - string vendor = GL.GetString(StringName.Vendor); + string vendor = GL.GetString(StringName.Vendor).ToLower(); - if (vendor == "NVIDIA Corporation") + if (vendor == "nvidia corporation") { return GpuVendor.Nvidia; } - else if (vendor == "Intel") + else if (vendor == "intel") { return GpuVendor.Intel; } + else if (vendor == "ati technologies inc." || vendor == "advanced micro devices, inc.") + { + return GpuVendor.Amd; + } else { return GpuVendor.Unknown; diff --git a/Ryujinx.Graphics.OpenGL/TextureView.cs b/Ryujinx.Graphics.OpenGL/TextureView.cs index 9569a1c1ba..cb872880ac 100644 --- a/Ryujinx.Graphics.OpenGL/TextureView.cs +++ b/Ryujinx.Graphics.OpenGL/TextureView.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.OpenGL private TextureView _emulatedViewParent; - private TextureView _intelWarView; + private TextureView _incompatibleFormatView; private readonly TextureCreateInfo _info; @@ -125,22 +125,22 @@ namespace Ryujinx.Graphics.OpenGL } } - public int GetIntelWarViewHandle() + public int GetIncompatibleFormatViewHandle() { - // Intel has a bug where the view format is always ignored, + // AMD and Intel has a bug where the view format is always ignored, // it uses the parent format instead. // As workaround we create a new texture with the correct // format, and then do a copy after the draw. if (_parent.Info.Format != Format) { - if (_intelWarView == null) + if (_incompatibleFormatView == null) { - _intelWarView = (TextureView)_renderer.CreateTexture(_info); + _incompatibleFormatView = (TextureView)_renderer.CreateTexture(_info); } - TextureCopyUnscaled.Copy(_parent.Info, _intelWarView._info, _parent.Handle, _intelWarView.Handle, FirstLayer, 0, FirstLevel, 0); + TextureCopyUnscaled.Copy(_parent.Info, _incompatibleFormatView._info, _parent.Handle, _incompatibleFormatView.Handle, FirstLayer, 0, FirstLevel, 0); - return _intelWarView.Handle; + return _incompatibleFormatView.Handle; } return Handle; @@ -148,9 +148,9 @@ namespace Ryujinx.Graphics.OpenGL public void SignalModified() { - if (_intelWarView != null) + if (_incompatibleFormatView != null) { - TextureCopyUnscaled.Copy(_intelWarView._info, _parent.Info, _intelWarView.Handle, _parent.Handle, 0, FirstLayer, 0, FirstLevel); + TextureCopyUnscaled.Copy(_incompatibleFormatView._info, _parent.Info, _incompatibleFormatView.Handle, _parent.Handle, 0, FirstLayer, 0, FirstLevel); } } @@ -433,11 +433,11 @@ namespace Ryujinx.Graphics.OpenGL public void Dispose() { - if (_intelWarView != null) + if (_incompatibleFormatView != null) { - _intelWarView.Dispose(); + _incompatibleFormatView.Dispose(); - _intelWarView = null; + _incompatibleFormatView = null; } if (Handle != 0)