aboutsummaryrefslogtreecommitdiff
path: root/src/client/clientmap.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-07-09 22:26:39 +0200
committerGitHub <noreply@github.com>2022-07-09 22:26:39 +0200
commit7c261118e06c630ea9ad00f20d7005b8edc108dd (patch)
tree44a2b6be86343cb5b157f3dfe8570a89b7b15ea1 /src/client/clientmap.cpp
parentb15393c2a5e43e5493c767877cf48b1a510736d6 (diff)
downloadminetest-7c261118e06c630ea9ad00f20d7005b8edc108dd.tar.gz
minetest-7c261118e06c630ea9ad00f20d7005b8edc108dd.tar.bz2
minetest-7c261118e06c630ea9ad00f20d7005b8edc108dd.zip
Release shadow mapping resources when not needed (#12497)
Diffstat (limited to 'src/client/clientmap.cpp')
-rw-r--r--src/client/clientmap.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp
index 38ba1daad..c5ba98ff6 100644
--- a/src/client/clientmap.cpp
+++ b/src/client/clientmap.cpp
@@ -472,7 +472,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
// pass the shadow map texture to the buffer texture
ShadowRenderer *shadow = m_rendering_engine->get_shadow_renderer();
if (shadow && shadow->is_active()) {
- auto &layer = material.TextureLayer[3];
+ auto &layer = material.TextureLayer[ShadowRenderer::TEXTURE_LAYER_SHADOW];
layer.Texture = shadow->get_texture();
layer.TextureWrapU = video::E_TEXTURE_CLAMP::ETC_CLAMP_TO_EDGE;
layer.TextureWrapV = video::E_TEXTURE_CLAMP::ETC_CLAMP_TO_EDGE;
@@ -485,6 +485,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
}
driver->setMaterial(material);
++material_swaps;
+ material.TextureLayer[ShadowRenderer::TEXTURE_LAYER_SHADOW].Texture = nullptr;
}
v3f block_wpos = intToFloat(descriptor.m_pos * MAP_BLOCKSIZE, BS);