Merge pull request #6432 from degasus/OGL-OSD-update

OGL: Scale OSD text on big screens.
This commit is contained in:
Markus Wick 2018-03-13 16:37:58 +01:00 committed by GitHub
commit f7ff634e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View File

@ -157,6 +157,7 @@ RasterFont::RasterFont()
} }
} }
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CHARACTER_WIDTH * CHARACTER_COUNT, CHARACTER_HEIGHT, 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CHARACTER_WIDTH * CHARACTER_COUNT, CHARACTER_HEIGHT, 0,
GL_RGBA, GL_UNSIGNED_BYTE, texture_data.data()); GL_RGBA, GL_UNSIGNED_BYTE, texture_data.data());

View File

@ -730,6 +730,16 @@ Renderer::Renderer()
g_ogl_config.gl_renderer, g_ogl_config.gl_version), g_ogl_config.gl_renderer, g_ogl_config.gl_version),
5000); 5000);
if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory)
{
OSD::AddMessage(
StringFromFormat("Your OpenGL driver does not support %s_buffer_storage.",
GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3 ? "EXT" : "ARB"),
60000);
OSD::AddMessage("This device's performance will be terrible.", 60000);
OSD::AddMessage("Please ask your device vendor for an updated OpenGL driver.", 60000);
}
WARN_LOG(VIDEO, "Missing OGL Extensions: %s%s%s%s%s%s%s%s%s%s%s%s%s%s", WARN_LOG(VIDEO, "Missing OGL Extensions: %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ", g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ", g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
@ -841,10 +851,17 @@ Renderer::CreateFramebuffer(const AbstractTexture* color_attachment,
void Renderer::RenderText(const std::string& text, int left, int top, u32 color) void Renderer::RenderText(const std::string& text, int left, int top, u32 color)
{ {
s_raster_font->printMultilineText(text, int screen_width = m_backbuffer_width;
left * 2.0f / static_cast<float>(m_backbuffer_width) - 1.0f, int screen_height = m_backbuffer_height;
1.0f - top * 2.0f / static_cast<float>(m_backbuffer_height), 0, if (screen_width >= 2000)
m_backbuffer_width, m_backbuffer_height, color); {
screen_width /= 2;
screen_height /= 2;
}
s_raster_font->printMultilineText(text, left * 2.0f / static_cast<float>(screen_width) - 1.0f,
1.0f - top * 2.0f / static_cast<float>(screen_height), 0,
screen_width, screen_height, color);
} }
std::unique_ptr<AbstractShader> Renderer::CreateShaderFromSource(ShaderStage stage, std::unique_ptr<AbstractShader> Renderer::CreateShaderFromSource(ShaderStage stage,