gl: Disable overlay if required extension is not supported (#2212)

This commit is contained in:
kd-11 2016-10-20 06:20:45 +03:00 committed by raven02
parent 80a9abcfc8
commit 973bf5abdf
3 changed files with 29 additions and 1 deletions

View File

@ -559,7 +559,9 @@ void GLGSRender::on_init_thread()
m_vao.element_array_buffer = *m_index_ring_buffer;
m_gl_texture_cache.initialize_rtt_cache();
m_text_printer.init();
if (g_cfg_rsx_overlay)
m_text_printer.init();
}
void GLGSRender::on_exit()

View File

@ -160,6 +160,7 @@ OPENGL_PROC(PFNGLDISABLEIPROC, Disablei);
OPENGL_PROC(PFNGLPRIMITIVERESTARTINDEXPROC, PrimitiveRestartIndex);
OPENGL_PROC(PFNGLGETINTEGER64VPROC, GetInteger64v);
OPENGL_PROC(PFNGLGETSTRINGIPROC, GetStringi);
OPENGL_PROC(PFNGLCHECKFRAMEBUFFERSTATUSPROC, CheckFramebufferStatus);

View File

@ -20,6 +20,7 @@ namespace gl
std::unordered_map<u8, std::pair<u32, u32>> m_offsets;
bool initialized = false;
bool enabled = false;
void init_program()
{
@ -84,6 +85,28 @@ namespace gl
void init()
{
//Check for ARB_shader_draw_parameters
//While it is possible to draw text without full multidraw support, issuing separate draw calls per character is not effecient
int ext_count;
glGetIntegerv(GL_NUM_EXTENSIONS, &ext_count);
for (int i = 0; i < ext_count; i++)
{
const char *ext = (const char*)glGetStringi(GL_EXTENSIONS, i);
if (std::string(ext) == "GL_ARB_shader_draw_parameters")
{
enabled = true;
break;
}
}
if (!enabled)
{
LOG_ERROR(RSX, "Debug overlay could not start because ARB_shader_draw_parameters is not supported by your GPU");
return;
}
m_text_buffer.create();
m_scale_offsets_buffer.create();
@ -117,6 +140,8 @@ namespace gl
void print_text(int x, int y, int target_w, int target_h, const std::string &text, color4f color = { 0.3f, 1.f, 0.3f, 1.f })
{
if (!enabled) return;
verify(HERE), initialized;
std::vector<GLint> offsets;