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