From b18ef8e3a00980595f45c7fe184dcb160dcc3cb9 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 29 Mar 2020 09:48:39 -0300 Subject: 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 --- Ryujinx.Graphics.OpenGL/HwCapabilities.cs | 41 +++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'Ryujinx.Graphics.OpenGL/HwCapabilities.cs') diff --git a/Ryujinx.Graphics.OpenGL/HwCapabilities.cs b/Ryujinx.Graphics.OpenGL/HwCapabilities.cs index f97bd2ea..3d72cb7d 100644 --- a/Ryujinx.Graphics.OpenGL/HwCapabilities.cs +++ b/Ryujinx.Graphics.OpenGL/HwCapabilities.cs @@ -5,15 +5,25 @@ namespace Ryujinx.Graphics.OpenGL { static class HwCapabilities { - private static Lazy _supportsAstcCompression = new Lazy(() => HasExtension("GL_KHR_texture_compression_astc_ldr")); + private static readonly Lazy _supportsAstcCompression = new Lazy(() => HasExtension("GL_KHR_texture_compression_astc_ldr")); - private static Lazy _maximumComputeSharedMemorySize = new Lazy(() => GetLimit(All.MaxComputeSharedMemorySize)); - private static Lazy _storageBufferOffsetAlignment = new Lazy(() => GetLimit(All.ShaderStorageBufferOffsetAlignment)); + private static readonly Lazy _maximumComputeSharedMemorySize = new Lazy(() => GetLimit(All.MaxComputeSharedMemorySize)); + private static readonly Lazy _storageBufferOffsetAlignment = new Lazy(() => GetLimit(All.ShaderStorageBufferOffsetAlignment)); - private static Lazy _isNvidiaDriver = new Lazy(() => IsNvidiaDriver()); + public enum GpuVendor + { + Unknown, + Amd, + Intel, + Nvidia + } + + private static readonly Lazy _gpuVendor = new Lazy(GetGpuVendor); + + public static GpuVendor Vendor => _gpuVendor.Value; public static bool SupportsAstcCompression => _supportsAstcCompression.Value; - public static bool SupportsNonConstantTextureOffset => _isNvidiaDriver.Value; + public static bool SupportsNonConstantTextureOffset => _gpuVendor.Value == GpuVendor.Nvidia; public static int MaximumComputeSharedMemorySize => _maximumComputeSharedMemorySize.Value; public static int StorageBufferOffsetAlignment => _storageBufferOffsetAlignment.Value; @@ -38,9 +48,26 @@ namespace Ryujinx.Graphics.OpenGL return GL.GetInteger((GetPName)name); } - private static bool IsNvidiaDriver() + private static GpuVendor GetGpuVendor() { - return GL.GetString(StringName.Vendor).Equals("NVIDIA Corporation"); + string vendor = GL.GetString(StringName.Vendor).ToLower(); + + if (vendor == "nvidia corporation") + { + return GpuVendor.Nvidia; + } + 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; + } } } } \ No newline at end of file -- cgit v1.2.3