diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2016-02-09 23:03:54 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2016-02-09 23:19:19 +0100 |
commit | 4e3fe460e38bed832266ee3168463a262d7fa444 (patch) | |
tree | e37fd979901996bd8f60d37bc33597784370f9fc | |
parent | baa7c8f8ad4e5717e324948c85d3da6bbbf17c16 (diff) | |
download | minetest-4e3fe460e38bed832266ee3168463a262d7fa444.tar.gz minetest-4e3fe460e38bed832266ee3168463a262d7fa444.tar.bz2 minetest-4e3fe460e38bed832266ee3168463a262d7fa444.zip |
shader.cpp: don't test twice if shader programs are present
Also use string::empty method, it is better than comparing with empty strings.
-rw-r--r-- | src/shader.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/shader.cpp b/src/shader.cpp index a2473ffbf..138ad2aac 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -767,22 +767,22 @@ ShaderInfo generate_shader(std::string name, u8 material_type, u8 drawtype, if (g_settings->getBool("tone_mapping")) shaders_header += "#define ENABLE_TONE_MAPPING\n"; - if(pixel_program != "") - pixel_program = shaders_header + pixel_program; - if(vertex_program != "") - vertex_program = shaders_header + vertex_program; - if(geometry_program != "") - geometry_program = shaders_header + geometry_program; // Call addHighLevelShaderMaterial() or addShaderMaterial() const c8* vertex_program_ptr = 0; const c8* pixel_program_ptr = 0; const c8* geometry_program_ptr = 0; - if(vertex_program != "") + if (!vertex_program.empty()) { + pixel_program = shaders_header + pixel_program; vertex_program_ptr = vertex_program.c_str(); - if(pixel_program != "") + } + if (!pixel_program.empty()) { + vertex_program = shaders_header + vertex_program; pixel_program_ptr = pixel_program.c_str(); - if(geometry_program != "") + } + if (!geometry_program.empty()) { + geometry_program = shaders_header + geometry_program; geometry_program_ptr = geometry_program.c_str(); + } s32 shadermat = -1; if(is_highlevel){ infostream<<"Compiling high level shaders for "<<name<<std::endl; |