1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Release shadow mapping resources when not needed (#12497)

This commit is contained in:
x2048 2022-07-09 22:26:39 +02:00 committed by GitHub
parent b15393c2a5
commit 7c261118e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 33 deletions

View file

@ -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);