Skip to content

Commit

Permalink
GLES fixes (#11205)
Browse files Browse the repository at this point in the history
* Consistently set float precision for GLES

* Enable DPI scaling on Windows+GLES
  • Loading branch information
sfan5 committed Apr 18, 2021
1 parent 623f0a8 commit 0077982
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/client/renderingengine.cpp
Expand Up @@ -335,6 +335,10 @@ static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd)
case video::EDT_DIRECT3D9:
hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd);
break;
#if ENABLE_GLES
case video::EDT_OGLES1:
case video::EDT_OGLES2:
#endif
case video::EDT_OPENGL:
hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd);
break;
Expand Down
12 changes: 7 additions & 5 deletions src/client/shader.cpp
Expand Up @@ -579,8 +579,10 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
if (use_gles) {
shaders_header << R"(
#version 100
)";
)";
vertex_header = R"(
precision mediump float;
uniform highp mat4 mWorldView;
uniform highp mat4 mWorldViewProj;
uniform mediump mat4 mTexture;
Expand All @@ -592,17 +594,17 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
attribute mediump vec3 inVertexNormal;
attribute mediump vec4 inVertexTangent;
attribute mediump vec4 inVertexBinormal;
)";
)";
fragment_header = R"(
precision mediump float;
)";
)";
} else {
shaders_header << R"(
#version 120
#define lowp
#define mediump
#define highp
)";
)";
vertex_header = R"(
#define mWorldView gl_ModelViewMatrix
#define mWorldViewProj gl_ModelViewProjectionMatrix
Expand All @@ -615,7 +617,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
#define inVertexNormal gl_Normal
#define inVertexTangent gl_MultiTexCoord1
#define inVertexBinormal gl_MultiTexCoord2
)";
)";
}

bool use_discard = use_gles;
Expand Down

0 comments on commit 0077982

Please sign in to comment.