diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-03-29 09:48:39 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-29 23:48:39 +1100 |
| commit | b18ef8e3a00980595f45c7fe184dcb160dcc3cb9 (patch) | |
| tree | 9d9b3fea4d7822d548878988c12c18e23a72bb52 /Ryujinx.Graphics.OpenGL/HwCapabilities.cs | |
| parent | 5c1757f7c29fc06577b5fc551dd3d76b12b281d3 (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/HwCapabilities.cs')
| -rw-r--r-- | Ryujinx.Graphics.OpenGL/HwCapabilities.cs | 41 |
1 files changed, 34 insertions, 7 deletions
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<bool> _supportsAstcCompression = new Lazy<bool>(() => HasExtension("GL_KHR_texture_compression_astc_ldr")); + private static readonly Lazy<bool> _supportsAstcCompression = new Lazy<bool>(() => HasExtension("GL_KHR_texture_compression_astc_ldr")); - private static Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize)); - private static Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment)); + private static readonly Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize)); + private static readonly Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment)); - private static Lazy<bool> _isNvidiaDriver = new Lazy<bool>(() => IsNvidiaDriver()); + public enum GpuVendor + { + Unknown, + Amd, + Intel, + Nvidia + } + + private static readonly Lazy<GpuVendor> _gpuVendor = new Lazy<GpuVendor>(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 |
