aboutsummaryrefslogtreecommitdiff
path: root/src/client/shader.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2023-03-05 15:10:44 +0100
committersfan5 <sfan5@live.de>2023-04-08 20:19:35 +0200
commit9d736e8b8baeeacad9cfa94edd18adfcaf000029 (patch)
tree6799a199edaeb82481edea6f101dc744b4507e9f /src/client/shader.cpp
parentc26e122485a7180edf434c0c1211713ff377d6d7 (diff)
downloadminetest-9d736e8b8baeeacad9cfa94edd18adfcaf000029.tar.xz
Drop ENABLE_GLES option
ENABLE_GLES predates forking Irrlicht. Its primary use was to distinguish Irrlicht-ogles from upstream version as Minetest could be compiled with either. That's not necessary anymore and gets in the way sometimes.
Diffstat (limited to 'src/client/shader.cpp')
-rw-r--r--src/client/shader.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/client/shader.cpp b/src/client/shader.cpp
index ccecb22c3..ce662b41d 100644
--- a/src/client/shader.cpp
+++ b/src/client/shader.cpp
@@ -229,14 +229,12 @@ class MainShaderConstantSetter : public IShaderConstantSetter
CachedVertexShaderSetting<f32> m_perspective_zbias_vertex;
CachedPixelShaderSetting<f32> m_perspective_zbias_pixel;
-#if ENABLE_GLES
// Modelview matrix
CachedVertexShaderSetting<float, 16> m_world_view;
// Texture matrix
CachedVertexShaderSetting<float, 16> m_texture;
// Normal matrix
CachedVertexShaderSetting<float, 9> m_normal;
-#endif
public:
MainShaderConstantSetter() :
@@ -256,11 +254,9 @@ public:
, m_perspective_bias1_pixel("xyPerspectiveBias1")
, m_perspective_zbias_vertex("zPerspectiveBias")
, m_perspective_zbias_pixel("zPerspectiveBias")
-#if ENABLE_GLES
, m_world_view("mWorldView")
, m_texture("mTexture")
, m_normal("mNormal")
-#endif
{}
~MainShaderConstantSetter() = default;
@@ -283,21 +279,21 @@ public:
worldViewProj *= worldView;
m_world_view_proj.set(*reinterpret_cast<float(*)[16]>(worldViewProj.pointer()), services);
-#if ENABLE_GLES
- core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
- m_world_view.set(*reinterpret_cast<float(*)[16]>(worldView.pointer()), services);
- m_texture.set(*reinterpret_cast<float(*)[16]>(texture.pointer()), services);
-
- core::matrix4 normal;
- worldView.getTransposed(normal);
- sanity_check(normal.makeInverse());
- float m[9] = {
- normal[0], normal[1], normal[2],
- normal[4], normal[5], normal[6],
- normal[8], normal[9], normal[10],
- };
- m_normal.set(m, services);
-#endif
+ if (driver->getDriverType() == video::EDT_OGLES2) {
+ core::matrix4 texture = driver->getTransform(video::ETS_TEXTURE_0);
+ m_world_view.set(*reinterpret_cast<float(*)[16]>(worldView.pointer()), services);
+ m_texture.set(*reinterpret_cast<float(*)[16]>(texture.pointer()), services);
+
+ core::matrix4 normal;
+ worldView.getTransposed(normal);
+ sanity_check(normal.makeInverse());
+ float m[9] = {
+ normal[0], normal[1], normal[2],
+ normal[4], normal[5], normal[6],
+ normal[8], normal[9], normal[10],
+ };
+ m_normal.set(m, services);
+ }
// Set uniforms for Shadow shader
if (ShadowRenderer *shadow = RenderingEngine::get_shadow_renderer()) {
@@ -628,10 +624,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
video::IGPUProgrammingServices *gpu = driver->getGPUProgrammingServices();
// Create shaders header
- bool use_gles = false;
-#if ENABLE_GLES
- use_gles = driver->getDriverType() == video::EDT_OGLES2;
-#endif
+ bool use_gles = driver->getDriverType() == video::EDT_OGLES2;
std::stringstream shaders_header;
shaders_header
<< std::noboolalpha