renderer/opengl: Deduce GLES from actual driver in use. (#7056)
This commit is contained in:
parent
6264b6d43c
commit
4220f69c06
|
@ -8,6 +8,7 @@
|
|||
#include "core/telemetry_session.h"
|
||||
#include "video_core/custom_textures/custom_format.h"
|
||||
#include "video_core/renderer_opengl/gl_driver.h"
|
||||
#include "video_core/renderer_opengl/gl_vars.h"
|
||||
|
||||
namespace OpenGL {
|
||||
|
||||
|
@ -74,8 +75,7 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum
|
|||
GetType(type), id, message);
|
||||
}
|
||||
|
||||
Driver::Driver(Core::TelemetrySession& telemetry_session_)
|
||||
: telemetry_session{telemetry_session_}, is_gles{Settings::values.use_gles.GetValue()} {
|
||||
Driver::Driver(Core::TelemetrySession& telemetry_session_) : telemetry_session{telemetry_session_} {
|
||||
const bool enable_debug = Settings::values.renderer_debug.GetValue();
|
||||
if (enable_debug) {
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
|
@ -83,6 +83,7 @@ Driver::Driver(Core::TelemetrySession& telemetry_session_)
|
|||
}
|
||||
|
||||
ReportDriverInfo();
|
||||
DeduceGLES();
|
||||
DeduceVendor();
|
||||
CheckExtensionSupport();
|
||||
FindBugs();
|
||||
|
@ -142,6 +143,14 @@ void Driver::ReportDriverInfo() {
|
|||
telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string{gl_version});
|
||||
}
|
||||
|
||||
void Driver::DeduceGLES() {
|
||||
// According to the spec, all GLES version strings must start with "OpenGL ES".
|
||||
is_gles = gl_version.starts_with("OpenGL ES");
|
||||
|
||||
// TODO: Eliminate this global state and replace with driver references.
|
||||
OpenGL::GLES = is_gles;
|
||||
}
|
||||
|
||||
void Driver::DeduceVendor() {
|
||||
if (gpu_vendor.find("NVIDIA") != gpu_vendor.npos) {
|
||||
vendor = Vendor::Nvidia;
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
|
||||
private:
|
||||
void ReportDriverInfo();
|
||||
void DeduceGLES();
|
||||
void DeduceVendor();
|
||||
void CheckExtensionSupport();
|
||||
void FindBugs();
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "core/memory.h"
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
||||
#include "video_core/renderer_opengl/gl_texture_mailbox.h"
|
||||
#include "video_core/renderer_opengl/gl_vars.h"
|
||||
#include "video_core/renderer_opengl/post_processing_opengl.h"
|
||||
#include "video_core/renderer_opengl/renderer_opengl.h"
|
||||
#include "video_core/shader/generator/glsl_shader_gen.h"
|
||||
|
@ -459,7 +458,7 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
|
|||
case GPU::Regs::PixelFormat::RGBA8:
|
||||
internal_format = GL_RGBA;
|
||||
texture.gl_format = GL_RGBA;
|
||||
texture.gl_type = GLES ? GL_UNSIGNED_BYTE : GL_UNSIGNED_INT_8_8_8_8;
|
||||
texture.gl_type = driver.IsOpenGLES() ? GL_UNSIGNED_BYTE : GL_UNSIGNED_INT_8_8_8_8;
|
||||
break;
|
||||
|
||||
case GPU::Regs::PixelFormat::RGB8:
|
||||
|
@ -470,7 +469,7 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
|
|||
internal_format = GL_RGB;
|
||||
|
||||
// GLES Dosen't support BGR , Use RGB instead
|
||||
texture.gl_format = GLES ? GL_RGB : GL_BGR;
|
||||
texture.gl_format = driver.IsOpenGLES() ? GL_RGB : GL_BGR;
|
||||
texture.gl_type = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "video_core/pica.h"
|
||||
#include "video_core/pica_state.h"
|
||||
#include "video_core/renderer_base.h"
|
||||
#include "video_core/renderer_opengl/gl_vars.h"
|
||||
#include "video_core/renderer_opengl/renderer_opengl.h"
|
||||
#include "video_core/renderer_software/renderer_software.h"
|
||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||
|
@ -34,8 +33,6 @@ void Init(Frontend::EmuWindow& emu_window, Frontend::EmuWindow* secondary_window
|
|||
Pica::Init();
|
||||
|
||||
const Settings::GraphicsAPI graphics_api = Settings::values.graphics_api.GetValue();
|
||||
OpenGL::GLES = Settings::values.use_gles.GetValue();
|
||||
|
||||
switch (graphics_api) {
|
||||
case Settings::GraphicsAPI::Software:
|
||||
g_renderer = std::make_unique<SwRenderer::RendererSoftware>(system, emu_window);
|
||||
|
|
Loading…
Reference in a new issue