Skip to content

Commit

Permalink
Prevent shaders from being created when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kwolekr committed Nov 17, 2013
1 parent 533785e commit a92fc35
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/mapblock_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,18 +1109,22 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
/*
Convert MeshCollector to SMesh
*/
bool enable_shaders = g_settings->getBool("enable_shaders");
bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
bool enable_shaders = g_settings->getBool("enable_shaders");
video::E_MATERIAL_TYPE shadermat1 = m_gamedef->getShaderSource()->
getShader("test_shader_1").material;
video::E_MATERIAL_TYPE shadermat2 = m_gamedef->getShaderSource()->
getShader("test_shader_2").material;
video::E_MATERIAL_TYPE shadermat3 = m_gamedef->getShaderSource()->
getShader("test_shader_3").material;
video::E_MATERIAL_TYPE bumpmaps1 = m_gamedef->getShaderSource()->
getShader("bumpmaps_solids").material;
video::E_MATERIAL_TYPE bumpmaps2 = m_gamedef->getShaderSource()->
getShader("bumpmaps_liquids").material;

video::E_MATERIAL_TYPE shadermat1, shadermat2, shadermat3, bumpmaps1, bumpmaps2;
shadermat1 = shadermat2 = shadermat3 = bumpmaps1 = bumpmaps2 = video::EMT_SOLID;

if (enable_shaders) {
IShaderSource *shdrsrc = m_gamedef->getShaderSource();
shadermat1 = shdrsrc->getShader("test_shader_1").material;
shadermat2 = shdrsrc->getShader("test_shader_2").material;
shadermat3 = shdrsrc->getShader("test_shader_3").material;
if (enable_bumpmapping) {
bumpmaps1 = shdrsrc->getShader("bumpmaps_solids").material;
bumpmaps2 = shdrsrc->getShader("bumpmaps_liquids").material;
}
}

for(u32 i = 0; i < collector.prebuffers.size(); i++)
{
Expand Down

0 comments on commit a92fc35

Please sign in to comment.