GLES fixes (#11205)

* Consistently set float precision for GLES

* Enable DPI scaling on Windows+GLES
This commit is contained in:
sfan5 2021-04-18 16:07:13 +02:00 committed by GitHub
parent 623f0a8613
commit 0077982fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

@ -335,6 +335,10 @@ static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd)
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd); hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd);
break; break;
#if ENABLE_GLES
case video::EDT_OGLES1:
case video::EDT_OGLES2:
#endif
case video::EDT_OPENGL: case video::EDT_OPENGL:
hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd); hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd);
break; break;

@ -579,8 +579,10 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
if (use_gles) { if (use_gles) {
shaders_header << R"( shaders_header << R"(
#version 100 #version 100
)"; )";
vertex_header = R"( vertex_header = R"(
precision mediump float;
uniform highp mat4 mWorldView; uniform highp mat4 mWorldView;
uniform highp mat4 mWorldViewProj; uniform highp mat4 mWorldViewProj;
uniform mediump mat4 mTexture; uniform mediump mat4 mTexture;
@ -592,17 +594,17 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
attribute mediump vec3 inVertexNormal; attribute mediump vec3 inVertexNormal;
attribute mediump vec4 inVertexTangent; attribute mediump vec4 inVertexTangent;
attribute mediump vec4 inVertexBinormal; attribute mediump vec4 inVertexBinormal;
)"; )";
fragment_header = R"( fragment_header = R"(
precision mediump float; precision mediump float;
)"; )";
} else { } else {
shaders_header << R"( shaders_header << R"(
#version 120 #version 120
#define lowp #define lowp
#define mediump #define mediump
#define highp #define highp
)"; )";
vertex_header = R"( vertex_header = R"(
#define mWorldView gl_ModelViewMatrix #define mWorldView gl_ModelViewMatrix
#define mWorldViewProj gl_ModelViewProjectionMatrix #define mWorldViewProj gl_ModelViewProjectionMatrix
@ -615,7 +617,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
#define inVertexNormal gl_Normal #define inVertexNormal gl_Normal
#define inVertexTangent gl_MultiTexCoord1 #define inVertexTangent gl_MultiTexCoord1
#define inVertexBinormal gl_MultiTexCoord2 #define inVertexBinormal gl_MultiTexCoord2
)"; )";
} }
bool use_discard = use_gles; bool use_discard = use_gles;