2023-01-27 00:21:09 +00:00
|
|
|
// Copyright 2023 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2009-02-23 07:23:34 +00:00
|
|
|
|
2023-01-27 00:21:09 +00:00
|
|
|
#include "VideoBackends/OGL/OGLConfig.h"
|
2017-01-23 16:20:20 +00:00
|
|
|
|
2018-10-03 13:02:45 +00:00
|
|
|
#include "Common/GL/GLContext.h"
|
2023-01-27 00:21:09 +00:00
|
|
|
#include "Common/GL/GLExtensions/GLExtensions.h"
|
2014-12-28 20:46:00 +00:00
|
|
|
#include "Common/Logging/LogManager.h"
|
2017-02-01 04:29:29 +00:00
|
|
|
#include "Common/MsgHandler.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2017-05-18 12:59:38 +00:00
|
|
|
#include "Core/Config/GraphicsSettings.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
|
|
|
|
#include "VideoCommon/DriverDetails.h"
|
|
|
|
#include "VideoCommon/OnScreenDisplay.h"
|
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2009-02-23 07:23:34 +00:00
|
|
|
|
2023-01-27 00:21:09 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
2013-04-04 15:37:16 +00:00
|
|
|
|
2023-01-27 00:21:09 +00:00
|
|
|
namespace OGL
|
2013-06-25 16:14:41 +00:00
|
|
|
{
|
2023-01-27 00:21:09 +00:00
|
|
|
void InitDriverInfo()
|
2013-06-11 13:33:56 +00:00
|
|
|
{
|
2019-09-24 04:30:20 +00:00
|
|
|
const std::string_view svendor(g_ogl_config.gl_vendor);
|
|
|
|
const std::string_view srenderer(g_ogl_config.gl_renderer);
|
|
|
|
const std::string_view sversion(g_ogl_config.gl_version);
|
2013-06-11 13:33:56 +00:00
|
|
|
DriverDetails::Vendor vendor = DriverDetails::VENDOR_UNKNOWN;
|
2013-08-21 10:34:42 +00:00
|
|
|
DriverDetails::Driver driver = DriverDetails::DRIVER_UNKNOWN;
|
2016-01-15 18:13:14 +00:00
|
|
|
DriverDetails::Family family = DriverDetails::Family::UNKNOWN;
|
2013-06-11 13:33:56 +00:00
|
|
|
double version = 0.0;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2013-08-21 10:34:42 +00:00
|
|
|
// Get the vendor first
|
2019-09-24 04:30:20 +00:00
|
|
|
if (svendor == "NVIDIA Corporation")
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2019-09-24 04:30:20 +00:00
|
|
|
if (srenderer != "NVIDIA Tegra")
|
|
|
|
{
|
|
|
|
vendor = DriverDetails::VENDOR_NVIDIA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vendor = DriverDetails::VENDOR_TEGRA;
|
|
|
|
}
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2013-08-21 10:34:42 +00:00
|
|
|
else if (svendor == "ATI Technologies Inc." || svendor == "Advanced Micro Devices, Inc.")
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-06-11 13:33:56 +00:00
|
|
|
vendor = DriverDetails::VENDOR_ATI;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2019-09-24 04:30:20 +00:00
|
|
|
else if (sversion.find("Mesa") != std::string::npos)
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-08-23 08:52:29 +00:00
|
|
|
vendor = DriverDetails::VENDOR_MESA;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2019-09-24 04:30:20 +00:00
|
|
|
else if (svendor.find("Intel") != std::string::npos)
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-06-11 13:33:56 +00:00
|
|
|
vendor = DriverDetails::VENDOR_INTEL;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2013-06-11 13:33:56 +00:00
|
|
|
else if (svendor == "ARM")
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-06-11 13:33:56 +00:00
|
|
|
vendor = DriverDetails::VENDOR_ARM;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2013-08-21 10:41:32 +00:00
|
|
|
else if (svendor == "http://limadriver.org/")
|
|
|
|
{
|
|
|
|
vendor = DriverDetails::VENDOR_ARM;
|
|
|
|
driver = DriverDetails::DRIVER_LIMA;
|
|
|
|
}
|
2013-06-11 13:33:56 +00:00
|
|
|
else if (svendor == "Qualcomm")
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-06-11 13:33:56 +00:00
|
|
|
vendor = DriverDetails::VENDOR_QUALCOMM;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2013-06-11 13:33:56 +00:00
|
|
|
else if (svendor == "Imagination Technologies")
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-06-11 13:33:56 +00:00
|
|
|
vendor = DriverDetails::VENDOR_IMGTEC;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2013-06-11 13:33:56 +00:00
|
|
|
else if (svendor == "Vivante Corporation")
|
2014-08-15 18:09:53 +00:00
|
|
|
{
|
2013-06-11 13:33:56 +00:00
|
|
|
vendor = DriverDetails::VENDOR_VIVANTE;
|
2014-08-15 18:09:53 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2013-06-11 13:33:56 +00:00
|
|
|
// Get device family and driver version...if we care about it
|
2014-03-10 11:30:55 +00:00
|
|
|
switch (vendor)
|
2013-06-11 13:33:56 +00:00
|
|
|
{
|
|
|
|
case DriverDetails::VENDOR_QUALCOMM:
|
|
|
|
{
|
2014-12-19 21:31:37 +00:00
|
|
|
driver = DriverDetails::DRIVER_QUALCOMM;
|
2013-06-11 13:33:56 +00:00
|
|
|
double glVersion;
|
|
|
|
sscanf(g_ogl_config.gl_version, "OpenGL ES %lg V@%lg", &glVersion, &version);
|
|
|
|
}
|
|
|
|
break;
|
2013-07-25 05:44:01 +00:00
|
|
|
case DriverDetails::VENDOR_ARM:
|
2014-04-12 04:46:44 +00:00
|
|
|
// Currently the Mali-T line has two families in it.
|
|
|
|
// Mali-T6xx and Mali-T7xx
|
|
|
|
// These two families are similar enough that they share bugs in their drivers.
|
2014-12-19 21:41:12 +00:00
|
|
|
//
|
|
|
|
// Mali drivers provide no way to explicitly find out what video driver is running.
|
|
|
|
// This is similar to how we can't find the Nvidia driver version in Windows.
|
|
|
|
// Good thing is that ARM introduces a new video driver about once every two years so we can
|
|
|
|
// find the driver version by the features it exposes.
|
|
|
|
// r2p0 - No OpenGL ES 3.0 support (We don't support this)
|
|
|
|
// r3p0 - OpenGL ES 3.0 support
|
|
|
|
// r4p0 - Supports 'GL_EXT_shader_pixel_local_storage' extension.
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-12-19 21:41:12 +00:00
|
|
|
driver = DriverDetails::DRIVER_ARM;
|
|
|
|
if (GLExtensions::Supports("GL_EXT_shader_pixel_local_storage"))
|
|
|
|
version = 400;
|
|
|
|
else
|
|
|
|
version = 300;
|
2013-08-23 08:52:29 +00:00
|
|
|
break;
|
|
|
|
case DriverDetails::VENDOR_MESA:
|
|
|
|
{
|
2014-03-10 11:30:55 +00:00
|
|
|
if (svendor == "nouveau")
|
2016-01-15 18:13:14 +00:00
|
|
|
{
|
2013-08-23 08:52:29 +00:00
|
|
|
driver = DriverDetails::DRIVER_NOUVEAU;
|
2016-01-15 18:13:14 +00:00
|
|
|
}
|
2014-03-10 11:30:55 +00:00
|
|
|
else if (svendor == "Intel Open Source Technology Center")
|
2016-01-15 18:13:14 +00:00
|
|
|
{
|
2013-08-23 08:52:29 +00:00
|
|
|
driver = DriverDetails::DRIVER_I965;
|
2016-01-15 18:13:14 +00:00
|
|
|
if (srenderer.find("Sandybridge") != std::string::npos)
|
|
|
|
family = DriverDetails::Family::INTEL_SANDY;
|
|
|
|
else if (srenderer.find("Ivybridge") != std::string::npos)
|
|
|
|
family = DriverDetails::Family::INTEL_IVY;
|
|
|
|
}
|
2019-09-24 04:30:20 +00:00
|
|
|
else if (srenderer.find("AMD") != std::string::npos ||
|
|
|
|
srenderer.find("ATI") != std::string::npos)
|
2016-01-15 18:13:14 +00:00
|
|
|
{
|
2013-08-23 08:52:29 +00:00
|
|
|
driver = DriverDetails::DRIVER_R600;
|
2016-01-15 18:13:14 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2013-08-23 08:52:29 +00:00
|
|
|
int major = 0;
|
|
|
|
int minor = 0;
|
|
|
|
int release = 0;
|
2015-07-25 10:20:00 +00:00
|
|
|
sscanf(g_ogl_config.gl_version, "%*s (Core Profile) Mesa %d.%d.%d", &major, &minor, &release);
|
2013-08-23 08:52:29 +00:00
|
|
|
version = 100 * major + 10 * minor + release;
|
|
|
|
}
|
2013-07-25 05:44:01 +00:00
|
|
|
break;
|
2014-09-04 23:03:53 +00:00
|
|
|
case DriverDetails::VENDOR_INTEL: // Happens in OS X/Windows
|
|
|
|
{
|
2016-01-15 18:13:14 +00:00
|
|
|
u32 market_name;
|
|
|
|
sscanf(g_ogl_config.gl_renderer, "Intel HD Graphics %d", &market_name);
|
|
|
|
switch (market_name)
|
|
|
|
{
|
|
|
|
case 2000:
|
|
|
|
case 3000:
|
|
|
|
family = DriverDetails::Family::INTEL_SANDY;
|
|
|
|
break;
|
|
|
|
case 2500:
|
|
|
|
case 4000:
|
|
|
|
family = DriverDetails::Family::INTEL_IVY;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
family = DriverDetails::Family::UNKNOWN;
|
|
|
|
break;
|
|
|
|
};
|
2014-09-04 23:03:53 +00:00
|
|
|
#ifdef _WIN32
|
2013-12-31 00:26:55 +00:00
|
|
|
int glmajor = 0;
|
|
|
|
int glminor = 0;
|
|
|
|
int major = 0;
|
|
|
|
int minor = 0;
|
|
|
|
int release = 0;
|
2014-09-04 23:03:53 +00:00
|
|
|
int revision = 0;
|
|
|
|
// Example version string: '4.3.0 - Build 10.18.10.3907'
|
|
|
|
sscanf(g_ogl_config.gl_version, "%d.%d.0 - Build %d.%d.%d.%d", &glmajor, &glminor, &major,
|
|
|
|
&minor, &release, &revision);
|
|
|
|
version = 100000000 * major + 1000000 * minor + 10000 * release + revision;
|
|
|
|
version /= 10000;
|
|
|
|
#endif
|
|
|
|
}
|
2013-12-31 00:26:55 +00:00
|
|
|
break;
|
2014-01-08 00:29:04 +00:00
|
|
|
case DriverDetails::VENDOR_NVIDIA:
|
|
|
|
{
|
|
|
|
int glmajor = 0;
|
|
|
|
int glminor = 0;
|
|
|
|
int glrelease = 0;
|
|
|
|
int major = 0;
|
|
|
|
int minor = 0;
|
2015-01-11 05:17:29 +00:00
|
|
|
// TODO: this is known to be broken on Windows
|
|
|
|
// Nvidia seems to have removed their driver version from this string, so we can't get it.
|
|
|
|
// hopefully we'll never have to workaround Nvidia bugs
|
2014-01-08 01:35:06 +00:00
|
|
|
sscanf(g_ogl_config.gl_version, "%d.%d.%d NVIDIA %d.%d", &glmajor, &glminor, &glrelease, &major,
|
|
|
|
&minor);
|
2014-01-08 00:29:04 +00:00
|
|
|
version = 100 * major + minor;
|
|
|
|
}
|
|
|
|
break;
|
2017-09-02 18:25:12 +00:00
|
|
|
case DriverDetails::VENDOR_IMGTEC:
|
|
|
|
{
|
|
|
|
// Example version string:
|
|
|
|
// "OpenGL ES 3.2 build 1.9@4850625"
|
|
|
|
// Ends up as "109.4850625" - "1.9" being the branch, "4850625" being the build's change ID
|
|
|
|
// The change ID only makes sense to compare within a branch
|
|
|
|
driver = DriverDetails::DRIVER_IMGTEC;
|
|
|
|
double gl_version;
|
|
|
|
int major, minor, change;
|
|
|
|
constexpr double change_scale = 10000000;
|
|
|
|
sscanf(g_ogl_config.gl_version, "OpenGL ES %lg build %d.%d@%d", &gl_version, &major, &minor,
|
|
|
|
&change);
|
|
|
|
version = 100 * major + minor;
|
|
|
|
if (change >= change_scale)
|
|
|
|
{
|
2020-11-09 08:08:00 +00:00
|
|
|
ERROR_LOG_FMT(VIDEO, "Version changeID overflow - change:{} scale:{}", change, change_scale);
|
2017-09-02 18:25:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
version += static_cast<double>(change) / change_scale;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-06-11 13:33:56 +00:00
|
|
|
// We don't care about these
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-08-13 05:16:31 +00:00
|
|
|
DriverDetails::Init(DriverDetails::API_OPENGL, vendor, driver, version, family);
|
2013-06-11 13:33:56 +00:00
|
|
|
}
|
|
|
|
|
2023-01-27 00:21:09 +00:00
|
|
|
bool PopulateConfig(GLContext* m_main_gl_context)
|
2011-05-07 22:00:05 +00:00
|
|
|
{
|
|
|
|
bool bSuccess = true;
|
2019-04-15 13:38:10 +00:00
|
|
|
bool supports_glsl_cache = false;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-01-02 02:06:11 +00:00
|
|
|
g_ogl_config.gl_vendor = (const char*)glGetString(GL_VENDOR);
|
|
|
|
g_ogl_config.gl_renderer = (const char*)glGetString(GL_RENDERER);
|
|
|
|
g_ogl_config.gl_version = (const char*)glGetString(GL_VERSION);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2018-10-03 13:03:26 +00:00
|
|
|
if (!m_main_gl_context->IsGLES())
|
2010-08-10 01:08:22 +00:00
|
|
|
{
|
2015-12-13 17:39:45 +00:00
|
|
|
if (!GLExtensions::Supports("GL_ARB_framebuffer_object"))
|
|
|
|
{
|
|
|
|
// We want the ogl3 framebuffer instead of the ogl2 one for better blitting support.
|
|
|
|
// It's also compatible with the gles3 one.
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT("GPU: ERROR: Need GL_ARB_framebuffer_object for multiple render targets.\n"
|
|
|
|
"GPU: Does your video card support OpenGL 3.0?");
|
2015-12-13 17:39:45 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-12-13 17:39:45 +00:00
|
|
|
if (!GLExtensions::Supports("GL_ARB_vertex_array_object"))
|
|
|
|
{
|
|
|
|
// This extension is used to replace lots of pointer setting function.
|
|
|
|
// Also gles3 requires to use it.
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_vertex_array_object.\n"
|
|
|
|
"GPU: Does your video card support OpenGL 3.0?");
|
2015-12-13 17:39:45 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-12-13 17:39:45 +00:00
|
|
|
if (!GLExtensions::Supports("GL_ARB_map_buffer_range"))
|
|
|
|
{
|
|
|
|
// ogl3 buffer mapping for better streaming support.
|
|
|
|
// The ogl2 one also isn't in gles3.
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_map_buffer_range.\n"
|
|
|
|
"GPU: Does your video card support OpenGL 3.0?");
|
2015-12-13 17:39:45 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-12-13 17:39:45 +00:00
|
|
|
if (!GLExtensions::Supports("GL_ARB_uniform_buffer_object"))
|
|
|
|
{
|
|
|
|
// ubo allow us to keep the current constants on shader switches
|
|
|
|
// we also can stream them much nicer and pack into it whatever we want to
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_uniform_buffer_object.\n"
|
|
|
|
"GPU: Does your video card support OpenGL 3.1?");
|
2015-12-13 17:39:45 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-10-29 22:56:18 +00:00
|
|
|
else if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_UBO))
|
2015-12-13 17:39:45 +00:00
|
|
|
{
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT(
|
2015-12-13 17:39:45 +00:00
|
|
|
"Buggy GPU driver detected.\n"
|
|
|
|
"Please either install the closed-source GPU driver or update your Mesa 3D version.");
|
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-12-13 17:39:45 +00:00
|
|
|
if (!GLExtensions::Supports("GL_ARB_sampler_objects"))
|
|
|
|
{
|
|
|
|
// Our sampler cache uses this extension. It could easyly be workaround and it's by far the
|
|
|
|
// highest requirement, but it seems that no driver lacks support for it.
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_sampler_objects.\n"
|
|
|
|
"GPU: Does your video card support OpenGL 3.3?");
|
2015-12-13 17:39:45 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2013-06-25 16:14:41 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-06-20 11:54:44 +00:00
|
|
|
// Copy the GPU name to g_Config, so Analytics can see it.
|
|
|
|
g_Config.backend_info.AdapterName = g_ogl_config.gl_renderer;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-09-05 01:25:59 +00:00
|
|
|
g_Config.backend_info.bSupportsDualSourceBlend =
|
2016-10-27 19:59:12 +00:00
|
|
|
(GLExtensions::Supports("GL_ARB_blend_func_extended") ||
|
2016-10-29 15:24:10 +00:00
|
|
|
GLExtensions::Supports("GL_EXT_blend_func_extended"));
|
2014-01-17 15:10:10 +00:00
|
|
|
g_Config.backend_info.bSupportsPrimitiveRestart =
|
2016-10-29 22:56:18 +00:00
|
|
|
!DriverDetails::HasBug(DriverDetails::BUG_PRIMITIVE_RESTART) &&
|
2014-01-17 15:10:10 +00:00
|
|
|
((GLExtensions::Version() >= 310) || GLExtensions::Supports("GL_NV_primitive_restart"));
|
OGL: implement Bounding Box on systems w/o SSBO
This commit should have zero performance effect if SSBOs are supported.
If they aren't (e.g. on all Macs), this commit alters FramebufferManager
to attach a new stencil buffer and VertexManager to draw to it when
bounding box is active. `BBoxRead` gets the pixel data from the buffer
and dumbly loops through it to find the bounding box.
This patch can run Paper Mario: The Thousand-Year Door at almost full
speed (50–60 FPS) without Dual-Core enabled for all common bounding
box-using actions I tested (going through pipes, Plane Mode, Paper
Mode, Prof. Frankly's gate, combat, walking around the overworld, etc.)
on my computer (macOS 10.12.3, 2.8 GHz Intel Core i7, 16 GB 1600 MHz
DDR3, and Intel Iris 1536 MB).
A few more demanding scenes (e.g. the self-building bridge on the way
to Petalburg) slow to ~15% of their speed without this patch (though
they don't run quite at full speed even on master). The slowdown is
caused almost solely by `glReadPixels` in `OGL::BoundingBox::Get`.
Other implementation ideas:
- Use a stencil buffer that's separate from the depth buffer. This would
require ARB_texture_stencil8 / OpenGL 4.4, which isn't available on
macOS.
- Use `glGetTexImage` instead of `glReadPixels`. This is ~5 FPS slower
on my computer, presumably because it has to transfer the entire
combined depth-stencil buffer instead of only the stencil data.
Getting only stencil data from `glGetTexImage` requires
ARB_texture_stencil8 / OpenGL 4.4, which (again) is not available on
macOS.
- Don't use a PBO, and use `glReadPixels` synchronously. This has no
visible performance effect on my computer, and is theoretically
slower.
2017-03-05 23:34:30 +00:00
|
|
|
g_Config.backend_info.bSupportsFragmentStoresAndAtomics =
|
2014-11-13 22:26:49 +00:00
|
|
|
GLExtensions::Supports("GL_ARB_shader_storage_buffer_object");
|
2022-10-01 01:37:27 +00:00
|
|
|
g_Config.backend_info.bSupportsVSLinePointExpand =
|
|
|
|
GLExtensions::Supports("GL_ARB_shader_storage_buffer_object");
|
2014-10-29 13:51:12 +00:00
|
|
|
g_Config.backend_info.bSupportsGSInstancing = GLExtensions::Supports("GL_ARB_gpu_shader5");
|
2015-09-07 20:21:11 +00:00
|
|
|
g_Config.backend_info.bSupportsSSAA = GLExtensions::Supports("GL_ARB_gpu_shader5") &&
|
|
|
|
GLExtensions::Supports("GL_ARB_sample_shading");
|
2016-01-09 18:07:08 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders =
|
|
|
|
GLExtensions::Version() >= 320 &&
|
2016-10-29 22:56:18 +00:00
|
|
|
!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_GEOMETRY_SHADERS);
|
2015-09-01 10:23:43 +00:00
|
|
|
g_Config.backend_info.bSupportsPaletteConversion =
|
|
|
|
GLExtensions::Supports("GL_ARB_texture_buffer_object") ||
|
|
|
|
GLExtensions::Supports("GL_OES_texture_buffer") ||
|
|
|
|
GLExtensions::Supports("GL_EXT_texture_buffer");
|
2015-05-18 23:18:04 +00:00
|
|
|
g_Config.backend_info.bSupportsClipControl = GLExtensions::Supports("GL_ARB_clip_control");
|
2015-07-25 10:20:00 +00:00
|
|
|
g_ogl_config.bSupportsCopySubImage =
|
|
|
|
(GLExtensions::Supports("GL_ARB_copy_image") || GLExtensions::Supports("GL_NV_copy_image") ||
|
|
|
|
GLExtensions::Supports("GL_EXT_copy_image") ||
|
|
|
|
GLExtensions::Supports("GL_OES_copy_image")) &&
|
2016-10-29 22:56:18 +00:00
|
|
|
!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_COPYIMAGE);
|
2017-10-21 14:49:40 +00:00
|
|
|
g_ogl_config.bSupportsTextureSubImage = GLExtensions::Supports("ARB_get_texture_sub_image");
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-03-30 18:58:05 +00:00
|
|
|
// Desktop OpenGL supports the binding layout if it supports 420pack
|
|
|
|
// OpenGL ES 3.1 supports it implicitly without an extension
|
|
|
|
g_Config.backend_info.bSupportsBindingLayout =
|
|
|
|
GLExtensions::Supports("GL_ARB_shading_language_420pack");
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-08-05 20:31:34 +00:00
|
|
|
// Clip distance support is useless without a method to clamp the depth range
|
2016-08-17 18:12:44 +00:00
|
|
|
g_Config.backend_info.bSupportsDepthClamp = GLExtensions::Supports("GL_ARB_depth_clamp");
|
2016-08-05 20:31:34 +00:00
|
|
|
|
2017-07-20 05:25:24 +00:00
|
|
|
// Desktop OpenGL supports bitfield manulipation and dynamic sampler indexing if it supports
|
|
|
|
// shader5. OpenGL ES 3.1 supports it implicitly without an extension
|
|
|
|
g_Config.backend_info.bSupportsBitfield = GLExtensions::Supports("GL_ARB_gpu_shader5");
|
|
|
|
g_Config.backend_info.bSupportsDynamicSamplerIndexing =
|
|
|
|
GLExtensions::Supports("GL_ARB_gpu_shader5");
|
|
|
|
|
2018-11-07 11:20:12 +00:00
|
|
|
g_ogl_config.bIsES = m_main_gl_context->IsGLES();
|
2019-04-15 13:38:10 +00:00
|
|
|
supports_glsl_cache = GLExtensions::Supports("GL_ARB_get_program_binary");
|
2013-12-30 13:22:50 +00:00
|
|
|
g_ogl_config.bSupportsGLPinnedMemory = GLExtensions::Supports("GL_AMD_pinned_memory");
|
|
|
|
g_ogl_config.bSupportsGLSync = GLExtensions::Supports("GL_ARB_sync");
|
2014-11-22 00:52:39 +00:00
|
|
|
g_ogl_config.bSupportsGLBaseVertex = GLExtensions::Supports("GL_ARB_draw_elements_base_vertex") ||
|
2015-01-18 21:23:51 +00:00
|
|
|
GLExtensions::Supports("GL_EXT_draw_elements_base_vertex") ||
|
|
|
|
GLExtensions::Supports("GL_OES_draw_elements_base_vertex");
|
|
|
|
g_ogl_config.bSupportsGLBufferStorage = GLExtensions::Supports("GL_ARB_buffer_storage") ||
|
2015-05-18 22:54:00 +00:00
|
|
|
GLExtensions::Supports("GL_EXT_buffer_storage");
|
2014-04-30 16:48:40 +00:00
|
|
|
g_ogl_config.bSupportsMSAA = GLExtensions::Supports("GL_ARB_texture_multisample");
|
2013-12-30 13:22:50 +00:00
|
|
|
g_ogl_config.bSupportViewportFloat = GLExtensions::Supports("GL_ARB_viewport_array");
|
2015-08-26 05:09:32 +00:00
|
|
|
g_ogl_config.bSupportsDebug =
|
|
|
|
GLExtensions::Supports("GL_KHR_debug") || GLExtensions::Supports("GL_ARB_debug_output");
|
2016-11-27 08:14:53 +00:00
|
|
|
g_ogl_config.bSupportsTextureStorage = GLExtensions::Supports("GL_ARB_texture_storage");
|
2023-03-06 06:03:26 +00:00
|
|
|
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageNone;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore = GLExtensions::Supports("GL_ARB_shader_image_load_store");
|
2015-10-17 11:43:22 +00:00
|
|
|
g_ogl_config.bSupportsConservativeDepth = GLExtensions::Supports("GL_ARB_conservative_depth");
|
2015-11-19 06:46:26 +00:00
|
|
|
g_ogl_config.bSupportsAniso = GLExtensions::Supports("GL_EXT_texture_filter_anisotropic");
|
2016-11-27 08:14:56 +00:00
|
|
|
g_Config.backend_info.bSupportsComputeShaders = GLExtensions::Supports("GL_ARB_compute_shader");
|
2017-04-16 10:34:02 +00:00
|
|
|
g_Config.backend_info.bSupportsST3CTextures =
|
|
|
|
GLExtensions::Supports("GL_EXT_texture_compression_s3tc");
|
2017-07-27 12:00:04 +00:00
|
|
|
g_Config.backend_info.bSupportsBPTCTextures =
|
|
|
|
GLExtensions::Supports("GL_ARB_texture_compression_bptc");
|
2021-11-14 04:10:20 +00:00
|
|
|
g_Config.backend_info.bSupportsCoarseDerivatives =
|
|
|
|
GLExtensions::Supports("GL_ARB_derivative_control") || GLExtensions::Version() >= 450;
|
2021-11-14 04:10:55 +00:00
|
|
|
g_Config.backend_info.bSupportsTextureQueryLevels =
|
|
|
|
GLExtensions::Supports("GL_ARB_texture_query_levels") || GLExtensions::Version() >= 430;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2023-01-01 03:55:53 +00:00
|
|
|
if (GLExtensions::Supports("GL_EXT_shader_framebuffer_fetch"))
|
|
|
|
{
|
|
|
|
g_ogl_config.SupportedFramebufferFetch = EsFbFetchType::FbFetchExt;
|
|
|
|
}
|
|
|
|
else if (GLExtensions::Supports("GL_ARM_shader_framebuffer_fetch"))
|
|
|
|
{
|
|
|
|
g_ogl_config.SupportedFramebufferFetch = EsFbFetchType::FbFetchArm;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_ogl_config.SupportedFramebufferFetch = EsFbFetchType::FbFetchNone;
|
|
|
|
}
|
|
|
|
g_Config.backend_info.bSupportsFramebufferFetch =
|
|
|
|
g_ogl_config.SupportedFramebufferFetch != EsFbFetchType::FbFetchNone;
|
|
|
|
|
2018-10-03 13:03:26 +00:00
|
|
|
if (m_main_gl_context->IsGLES())
|
2014-03-30 18:58:05 +00:00
|
|
|
{
|
2023-03-06 05:50:00 +00:00
|
|
|
g_ogl_config.SupportedESPointSize =
|
|
|
|
GLExtensions::Supports("GL_OES_geometry_point_size") ? EsPointSizeType::PointSizeOes :
|
|
|
|
GLExtensions::Supports("GL_EXT_geometry_point_size") ? EsPointSizeType::PointSizeExt :
|
|
|
|
EsPointSizeType::PointSizeNone;
|
2021-08-29 22:17:24 +00:00
|
|
|
g_ogl_config.SupportedESTextureBuffer =
|
|
|
|
GLExtensions::Supports("VERSION_GLES_3_2") ? EsTexbufType::TexbufCore :
|
|
|
|
GLExtensions::Supports("GL_OES_texture_buffer") ? EsTexbufType::TexbufOes :
|
|
|
|
GLExtensions::Supports("GL_EXT_texture_buffer") ? EsTexbufType::TexbufExt :
|
|
|
|
EsTexbufType::TexbufNone;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2019-04-15 13:38:10 +00:00
|
|
|
supports_glsl_cache = true;
|
2015-12-13 17:39:45 +00:00
|
|
|
g_ogl_config.bSupportsGLSync = true;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2016-08-12 11:55:35 +00:00
|
|
|
// TODO: Implement support for GL_EXT_clip_cull_distance when there is an extension for
|
|
|
|
// depth clamping.
|
2016-08-05 20:31:34 +00:00
|
|
|
g_Config.backend_info.bSupportsDepthClamp = false;
|
|
|
|
|
2018-05-25 14:04:18 +00:00
|
|
|
// GLES does not support logic op.
|
|
|
|
g_Config.backend_info.bSupportsLogicOp = false;
|
|
|
|
|
2020-05-24 06:11:10 +00:00
|
|
|
// glReadPixels() can't be used with non-color formats. But, if we support
|
|
|
|
// ARB_get_texture_sub_image (unlikely, except maybe on NVIDIA), we can use that instead.
|
|
|
|
g_Config.backend_info.bSupportsDepthReadback = g_ogl_config.bSupportsTextureSubImage;
|
|
|
|
|
2021-08-07 03:26:51 +00:00
|
|
|
// GL_TEXTURE_LOD_BIAS is not supported on GLES.
|
|
|
|
g_Config.backend_info.bSupportsLodBiasInSampler = false;
|
|
|
|
|
2016-08-17 23:20:24 +00:00
|
|
|
if (GLExtensions::Version() == 300)
|
2014-03-30 18:58:05 +00:00
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = GlslEs300;
|
2014-12-07 05:29:36 +00:00
|
|
|
g_ogl_config.bSupportsAEP = false;
|
2016-11-27 08:14:53 +00:00
|
|
|
g_ogl_config.bSupportsTextureStorage = true;
|
2014-12-16 23:26:03 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders = false;
|
2014-03-30 18:58:05 +00:00
|
|
|
}
|
2016-08-17 23:20:24 +00:00
|
|
|
else if (GLExtensions::Version() == 310)
|
2014-03-30 18:58:05 +00:00
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = GlslEs310;
|
2014-12-07 05:29:36 +00:00
|
|
|
g_ogl_config.bSupportsAEP = GLExtensions::Supports("GL_ANDROID_extension_pack_es31a");
|
2014-03-30 18:58:05 +00:00
|
|
|
g_Config.backend_info.bSupportsBindingLayout = true;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore = true;
|
2014-12-16 23:26:03 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders = g_ogl_config.bSupportsAEP;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_Config.backend_info.bSupportsComputeShaders = true;
|
2015-08-26 05:09:32 +00:00
|
|
|
g_Config.backend_info.bSupportsGSInstancing =
|
2023-03-06 05:50:00 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders &&
|
|
|
|
g_ogl_config.SupportedESPointSize != EsPointSizeType::PointSizeNone;
|
2015-09-06 11:58:18 +00:00
|
|
|
g_Config.backend_info.bSupportsSSAA = g_ogl_config.bSupportsAEP;
|
2017-03-05 23:17:54 +00:00
|
|
|
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = true;
|
2015-09-01 05:17:24 +00:00
|
|
|
g_ogl_config.bSupportsMSAA = true;
|
2016-11-27 08:14:53 +00:00
|
|
|
g_ogl_config.bSupportsTextureStorage = true;
|
2023-03-06 06:03:26 +00:00
|
|
|
if (GLExtensions::Supports("GL_OES_texture_storage_multisample_2d_array"))
|
|
|
|
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageOes;
|
2017-07-20 05:25:24 +00:00
|
|
|
g_Config.backend_info.bSupportsBitfield = true;
|
|
|
|
g_Config.backend_info.bSupportsDynamicSamplerIndexing = g_ogl_config.bSupportsAEP;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2015-08-26 05:09:32 +00:00
|
|
|
else
|
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = GlslEs320;
|
2015-08-26 05:09:32 +00:00
|
|
|
g_ogl_config.bSupportsAEP = GLExtensions::Supports("GL_ANDROID_extension_pack_es31a");
|
|
|
|
g_Config.backend_info.bSupportsBindingLayout = true;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore = true;
|
2015-08-26 05:09:32 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders = true;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_Config.backend_info.bSupportsComputeShaders = true;
|
2023-03-06 05:50:00 +00:00
|
|
|
g_Config.backend_info.bSupportsGSInstancing =
|
|
|
|
g_ogl_config.SupportedESPointSize != EsPointSizeType::PointSizeNone;
|
2015-09-01 10:23:43 +00:00
|
|
|
g_Config.backend_info.bSupportsPaletteConversion = true;
|
2015-09-01 05:17:24 +00:00
|
|
|
g_Config.backend_info.bSupportsSSAA = true;
|
2017-03-05 23:17:54 +00:00
|
|
|
g_Config.backend_info.bSupportsFragmentStoresAndAtomics = true;
|
2015-08-26 05:09:32 +00:00
|
|
|
g_ogl_config.bSupportsCopySubImage = true;
|
|
|
|
g_ogl_config.bSupportsGLBaseVertex = true;
|
|
|
|
g_ogl_config.bSupportsDebug = true;
|
2015-09-01 05:17:24 +00:00
|
|
|
g_ogl_config.bSupportsMSAA = true;
|
2016-11-27 08:14:53 +00:00
|
|
|
g_ogl_config.bSupportsTextureStorage = true;
|
2023-03-06 06:03:26 +00:00
|
|
|
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageCore;
|
2017-07-20 05:25:24 +00:00
|
|
|
g_Config.backend_info.bSupportsBitfield = true;
|
|
|
|
g_Config.backend_info.bSupportsDynamicSamplerIndexing = true;
|
2022-01-31 02:46:06 +00:00
|
|
|
g_Config.backend_info.bSupportsSettingObjectNames = true;
|
2014-03-30 18:58:05 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2013-12-30 13:22:50 +00:00
|
|
|
else
|
2013-04-08 12:50:58 +00:00
|
|
|
{
|
2023-03-06 06:03:26 +00:00
|
|
|
if (GLExtensions::Supports("GL_ARB_texture_storage_multisample"))
|
|
|
|
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageCore;
|
|
|
|
|
2016-08-17 23:20:24 +00:00
|
|
|
if (GLExtensions::Version() < 300)
|
2013-12-30 13:22:50 +00:00
|
|
|
{
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT("GPU: OGL ERROR: Need at least GLSL 1.30\n"
|
|
|
|
"GPU: Does your video card support OpenGL 3.0?\n"
|
|
|
|
"GPU: Your driver supports GLSL {0}",
|
|
|
|
reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
|
2013-12-30 13:22:50 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-08-17 23:20:24 +00:00
|
|
|
else if (GLExtensions::Version() == 300)
|
2013-12-30 13:22:50 +00:00
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl130;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore = false; // layout keyword is only supported on glsl150+
|
2015-10-17 11:43:22 +00:00
|
|
|
g_ogl_config.bSupportsConservativeDepth =
|
|
|
|
false; // layout keyword is only supported on glsl150+
|
2014-12-16 23:26:03 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders =
|
|
|
|
false; // geometry shaders are only supported on glsl150+
|
2013-12-30 13:22:50 +00:00
|
|
|
}
|
2016-08-17 23:20:24 +00:00
|
|
|
else if (GLExtensions::Version() == 310)
|
2013-12-30 13:22:50 +00:00
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl140;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore = false; // layout keyword is only supported on glsl150+
|
2015-10-17 11:43:22 +00:00
|
|
|
g_ogl_config.bSupportsConservativeDepth =
|
2014-12-16 23:26:03 +00:00
|
|
|
false; // layout keyword is only supported on glsl150+
|
2015-09-06 11:58:18 +00:00
|
|
|
g_Config.backend_info.bSupportsGeometryShaders =
|
2013-12-30 13:22:50 +00:00
|
|
|
false; // geometry shaders are only supported on glsl150+
|
2015-09-06 11:58:18 +00:00
|
|
|
}
|
2016-08-17 23:20:24 +00:00
|
|
|
else if (GLExtensions::Version() == 320)
|
2015-09-06 11:58:18 +00:00
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl150;
|
2015-09-06 11:58:18 +00:00
|
|
|
}
|
2016-08-17 23:20:24 +00:00
|
|
|
else if (GLExtensions::Version() == 330)
|
2015-09-06 11:58:18 +00:00
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl330;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2016-11-27 08:14:56 +00:00
|
|
|
else if (GLExtensions::Version() >= 430)
|
|
|
|
{
|
|
|
|
// TODO: We should really parse the GL_SHADING_LANGUAGE_VERSION token.
|
2023-01-31 17:10:48 +00:00
|
|
|
if (GLExtensions::Version() >= 450)
|
|
|
|
{
|
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl450;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl430;
|
|
|
|
}
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsTextureStorage = true;
|
2023-03-06 06:03:26 +00:00
|
|
|
g_ogl_config.SupportedMultisampleTexStorage = MultisampleTexStorageType::TexStorageCore;
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore = true;
|
|
|
|
g_Config.backend_info.bSupportsSSAA = true;
|
2022-01-31 02:46:06 +00:00
|
|
|
g_Config.backend_info.bSupportsSettingObjectNames = true;
|
2016-11-27 08:14:56 +00:00
|
|
|
|
|
|
|
// Compute shaders are core in GL4.3.
|
|
|
|
g_Config.backend_info.bSupportsComputeShaders = true;
|
2017-10-21 14:49:40 +00:00
|
|
|
if (GLExtensions::Version() >= 450)
|
|
|
|
g_ogl_config.bSupportsTextureSubImage = true;
|
2016-11-27 08:14:56 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
else
|
|
|
|
{
|
2018-01-05 18:01:18 +00:00
|
|
|
g_ogl_config.eSupportedGLSLVersion = Glsl400;
|
2014-12-07 05:29:36 +00:00
|
|
|
g_Config.backend_info.bSupportsSSAA = true;
|
2016-11-27 08:14:56 +00:00
|
|
|
|
|
|
|
if (GLExtensions::Version() == 420)
|
|
|
|
{
|
|
|
|
// Texture storage and shader image load/store are core in GL4.2.
|
|
|
|
g_ogl_config.bSupportsTextureStorage = true;
|
|
|
|
g_ogl_config.bSupportsImageLoadStore = true;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
|
|
|
|
2014-12-07 05:29:36 +00:00
|
|
|
// Desktop OpenGL can't have the Android Extension Pack
|
|
|
|
g_ogl_config.bSupportsAEP = false;
|
2019-04-21 02:36:41 +00:00
|
|
|
|
|
|
|
// Desktop GL requires GL_PROGRAM_POINT_SIZE set to use gl_PointSize in shaders.
|
|
|
|
// It is implicitly enabled in GLES.
|
|
|
|
glEnable(GL_PROGRAM_POINT_SIZE);
|
2013-04-08 12:50:58 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2022-12-11 07:15:15 +00:00
|
|
|
// Supported by all GS-supporting ES and 4.3+
|
|
|
|
g_Config.backend_info.bSupportsGLLayerInFS = g_Config.backend_info.bSupportsGeometryShaders &&
|
|
|
|
g_ogl_config.eSupportedGLSLVersion >= Glsl430;
|
|
|
|
|
2020-11-24 20:22:39 +00:00
|
|
|
g_Config.backend_info.bSupportsBBox = g_Config.backend_info.bSupportsFragmentStoresAndAtomics;
|
|
|
|
|
2015-10-17 11:43:22 +00:00
|
|
|
// Either method can do early-z tests. See PixelShaderGen for details.
|
|
|
|
g_Config.backend_info.bSupportsEarlyZ =
|
2016-11-27 08:14:56 +00:00
|
|
|
g_ogl_config.bSupportsImageLoadStore || g_ogl_config.bSupportsConservativeDepth;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2017-03-31 11:55:26 +00:00
|
|
|
glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples);
|
|
|
|
if (g_ogl_config.max_samples < 1 || !g_ogl_config.bSupportsMSAA)
|
|
|
|
g_ogl_config.max_samples = 1;
|
|
|
|
|
2023-01-31 17:10:48 +00:00
|
|
|
const bool bSupportsIsHelperInvocation = g_ogl_config.bIsES ?
|
|
|
|
g_ogl_config.eSupportedGLSLVersion >= GlslEs320 :
|
|
|
|
g_ogl_config.eSupportedGLSLVersion >= Glsl450;
|
|
|
|
g_ogl_config.bSupportsKHRShaderSubgroup =
|
|
|
|
GLExtensions::Supports("GL_KHR_shader_subgroup") && bSupportsIsHelperInvocation;
|
|
|
|
if (g_ogl_config.bSupportsKHRShaderSubgroup)
|
|
|
|
{
|
|
|
|
// Check for the features: basic + arithmetic + ballot
|
|
|
|
GLint supported_features = 0;
|
|
|
|
glGetIntegerv(GL_SUBGROUP_SUPPORTED_FEATURES_KHR, &supported_features);
|
|
|
|
if (~supported_features &
|
|
|
|
(GL_SUBGROUP_FEATURE_BASIC_BIT_KHR | GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR |
|
|
|
|
GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR))
|
|
|
|
{
|
|
|
|
g_ogl_config.bSupportsKHRShaderSubgroup = false;
|
|
|
|
}
|
|
|
|
}
|
2019-03-22 10:39:11 +00:00
|
|
|
|
2016-11-27 08:15:00 +00:00
|
|
|
// We require texel buffers, image load store, and compute shaders to enable GPU texture decoding.
|
|
|
|
// If the driver doesn't expose the extensions, but supports GL4.3/GLES3.1, it will still be
|
|
|
|
// enabled in the version check below.
|
|
|
|
g_Config.backend_info.bSupportsGPUTextureDecoding =
|
|
|
|
g_Config.backend_info.bSupportsPaletteConversion &&
|
|
|
|
g_Config.backend_info.bSupportsComputeShaders && g_ogl_config.bSupportsImageLoadStore;
|
|
|
|
|
2018-02-25 07:56:09 +00:00
|
|
|
// Background compiling is supported only when shared contexts aren't broken.
|
|
|
|
g_Config.backend_info.bSupportsBackgroundCompiling =
|
|
|
|
!DriverDetails::HasBug(DriverDetails::BUG_SHARED_CONTEXT_SHADER_COMPILATION);
|
|
|
|
|
2019-04-15 13:38:10 +00:00
|
|
|
// Program binaries are supported on GL4.1+, ARB_get_program_binary, or ES3.
|
|
|
|
if (supports_glsl_cache)
|
|
|
|
{
|
|
|
|
// We need to check the number of formats supported. If zero, don't bother getting the binaries.
|
|
|
|
GLint num_formats = 0;
|
|
|
|
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num_formats);
|
|
|
|
supports_glsl_cache = num_formats > 0;
|
|
|
|
}
|
|
|
|
g_Config.backend_info.bSupportsPipelineCacheData = supports_glsl_cache;
|
|
|
|
|
2013-11-05 16:37:32 +00:00
|
|
|
int samples;
|
|
|
|
glGetIntegerv(GL_SAMPLES, &samples);
|
2014-03-10 11:30:55 +00:00
|
|
|
if (samples > 1)
|
2013-11-05 16:37:32 +00:00
|
|
|
{
|
|
|
|
// MSAA on default framebuffer isn't working because of glBlitFramebuffer.
|
|
|
|
// It also isn't useful as we don't render anything to the default framebuffer.
|
|
|
|
// We also try to get a non-msaa fb, so this only happens when forced by the driver.
|
2020-12-02 18:17:27 +00:00
|
|
|
PanicAlertFmtT(
|
|
|
|
"The graphics driver is forcibly enabling anti-aliasing for Dolphin. You need to "
|
|
|
|
"turn this off in the graphics driver's settings in order for Dolphin to work.\n\n"
|
|
|
|
"(MSAA with {0} samples found on default framebuffer)",
|
|
|
|
samples);
|
2013-11-05 16:37:32 +00:00
|
|
|
bSuccess = false;
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2013-09-02 11:14:45 +00:00
|
|
|
if (!bSuccess)
|
2023-01-27 00:21:09 +00:00
|
|
|
return false;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-10-30 13:56:40 +00:00
|
|
|
g_Config.VerifyValidity();
|
2013-01-21 17:44:33 +00:00
|
|
|
UpdateActiveConfig();
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2020-11-09 08:08:00 +00:00
|
|
|
OSD::AddMessage(fmt::format("Video Info: {}, {}, {}", g_ogl_config.gl_vendor,
|
|
|
|
g_ogl_config.gl_renderer, g_ogl_config.gl_version),
|
2013-08-23 23:44:16 +00:00
|
|
|
5000);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2018-03-11 23:19:14 +00:00
|
|
|
if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory)
|
|
|
|
{
|
2020-11-09 08:08:00 +00:00
|
|
|
OSD::AddMessage(fmt::format("Your OpenGL driver does not support {}_buffer_storage.",
|
|
|
|
m_main_gl_context->IsGLES() ? "EXT" : "ARB"),
|
2018-10-03 13:02:45 +00:00
|
|
|
60000);
|
2021-06-05 22:08:47 +00:00
|
|
|
OSD::AddMessage("This device's performance may be poor.", 60000);
|
2018-03-11 23:19:14 +00:00
|
|
|
}
|
|
|
|
|
2022-02-24 02:30:02 +00:00
|
|
|
INFO_LOG_FMT(VIDEO, "Video Info: {}, {}, {}", g_ogl_config.gl_vendor, g_ogl_config.gl_renderer,
|
|
|
|
g_ogl_config.gl_version);
|
2020-11-09 08:08:00 +00:00
|
|
|
WARN_LOG_FMT(VIDEO, "Missing OGL Extensions: {}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsEarlyZ ? "" : "EarlyZ ",
|
|
|
|
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
|
|
|
|
supports_glsl_cache ? "" : "ShaderCache ",
|
|
|
|
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
|
|
|
|
g_ogl_config.bSupportsGLBufferStorage ? "" : "BufferStorage ",
|
|
|
|
g_ogl_config.bSupportsGLSync ? "" : "Sync ",
|
|
|
|
g_ogl_config.bSupportsMSAA ? "" : "MSAA ",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsSSAA ? "" : "SSAA ",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ",
|
|
|
|
g_ogl_config.bSupportsCopySubImage ? "" : "CopyImageSubData ",
|
|
|
|
g_ActiveConfig.backend_info.bSupportsDepthClamp ? "" : "DepthClamp ");
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2018-02-09 10:52:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-10-03 13:02:45 +00:00
|
|
|
} // namespace OGL
|