[Drape] Remove GLES2-related code

Signed-off-by: renderexpert <expert@renderconsulting.co.uk>
This commit is contained in:
renderexpert
2025-01-20 11:05:45 +00:00
committed by Konstantin Pastbin
parent 705c715356
commit b23c2ba3e3
47 changed files with 235 additions and 623 deletions

View File

@@ -107,7 +107,7 @@ void MapWidget::CreateEngine()
{
Framework::DrapeCreationParams p;
p.m_apiVersion = m_apiOpenGLES3 ? dp::ApiVersion::OpenGLES3 : dp::ApiVersion::OpenGLES2;
p.m_apiVersion = dp::ApiVersion::OpenGLES3;
p.m_surfaceWidth = m_screenshotMode ? width() : static_cast<int>(m_ratio * width());
p.m_surfaceHeight = m_screenshotMode ? height() : static_cast<int>(m_ratio * height());
@@ -232,8 +232,6 @@ void MapWidget::Build()
{
std::string_view vertexSrc;
std::string_view fragmentSrc;
if (m_apiOpenGLES3)
{
#if defined(OMIM_OS_LINUX)
vertexSrc = ":common/shaders/gles_300.vsh.glsl";
fragmentSrc = ":common/shaders/gles_300.fsh.glsl";
@@ -241,12 +239,6 @@ void MapWidget::Build()
vertexSrc = ":common/shaders/gl_150.vsh.glsl";
fragmentSrc = ":common/shaders/gl_150.fsh.glsl";
#endif
}
else
{
vertexSrc = ":common/shaders/gles_200.vsh.glsl";
fragmentSrc = ":common/shaders/gles_200.fsh.glsl";
}
m_program = std::make_unique<QOpenGLShaderProgram>(this);
m_program->addShaderFromSourceFile(QOpenGLShader::Vertex, vertexSrc.data());
@@ -348,8 +340,6 @@ void MapWidget::initializeGL()
if (!m_screenshotMode)
m_ratio = devicePixelRatio();
m_apiOpenGLES3 = true;
#if defined(OMIM_OS_LINUX)
{
QOpenGLFunctions * funcs = context()->functions();
@@ -367,29 +357,14 @@ void MapWidget::initializeGL()
auto fmt = context()->format();
if (context()->format().version() < qMakePair(3, 0))
{
LOG(LINFO, ("OpenGL ES version is below 3.0, taking the OpenGL ES 2.0 path"));
m_apiOpenGLES3 = false;
constexpr const char* requiredExtensions[3] =
{ "GL_EXT_map_buffer_range", "GL_OES_mapbuffer", "GL_OES_vertex_array_object" };
for (auto & requiredExtension : requiredExtensions)
{
if (context()->hasExtension(QByteArray::fromStdString(requiredExtension)))
LOG(LDEBUG, ("Found OpenGL ES 2.0 extension: ", requiredExtension));
else
LOG(LCRITICAL, ("A required OpenGL ES 2.0 extension is missing:", requiredExtension));
}
fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
fmt.setVersion(2, 0);
CHECK(false, ("OpenGL ES2 is not supported"));
}
else
{
LOG(LINFO, ("OpenGL version is at least 3.0, enabling GLSL '#version 300 es'"));
m_apiOpenGLES3 = true;
fmt.setVersion(3, 0);
}
QSurfaceFormat::setDefaultFormat(fmt);
}
#endif

View File

@@ -97,7 +97,6 @@ protected:
void wheelEvent(QWheelEvent * e) override;
Framework & m_framework;
bool m_apiOpenGLES3;
bool m_screenshotMode;
ScaleSlider * m_slider;
SliderState m_sliderState;

View File

@@ -16,8 +16,6 @@
<file>spinner12.png</file>
<file>shaders/gl_150.fsh.glsl</file>
<file>shaders/gl_150.vsh.glsl</file>
<file>shaders/gles_200.fsh.glsl</file>
<file>shaders/gles_200.vsh.glsl</file>
<file>shaders/gles_300.fsh.glsl</file>
<file>shaders/gles_300.vsh.glsl</file>
</qresource>

View File

@@ -1,15 +0,0 @@
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#endif
uniform sampler2D u_sampler;
varying vec2 v_texCoord;
void main()
{
gl_FragColor = vec4(texture2D(u_sampler, v_texCoord).rgb, 1.0);
}

View File

@@ -1,9 +0,0 @@
attribute vec4 a_position;
uniform vec2 u_samplerSize;
varying vec2 v_texCoord;
void main()
{
v_texCoord = vec2(a_position.z * u_samplerSize.x, a_position.w * u_samplerSize.y);
gl_Position = vec4(a_position.x, a_position.y, 0.0, 1.0);
}