Avoid compling useless code in server only or gles

This commit is contained in:
Benau 2017-03-15 12:45:35 +08:00
parent 562131b53f
commit d08d2cc9c7
7 changed files with 25 additions and 13 deletions

View File

@ -553,6 +553,11 @@ namespace UserConfigParams
&m_video_group, "Max texture size when high definition textures are "
"disabled"));
PARAM_PREFIX BoolUserConfigParam m_hq_mipmap
PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap",
&m_video_group, "Generate mipmap for textures using "
"high quality method with SSE"));
// ---- Debug - not saved to config file
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false);
@ -617,9 +622,6 @@ namespace UserConfigParams
/** True if graphical profiler should be displayed */
PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false );
/** True if hardware skinning should be enabled */
PARAM_PREFIX bool m_hw_skinning_enabled PARAM_DEFAULT( false );
// not saved to file
// ---- Networking
@ -934,11 +936,6 @@ namespace UserConfigParams
PARAM_DEFAULT( BoolUserConfigParam(false, "everything_unlocked",
"Enable all karts and tracks") );
PARAM_PREFIX BoolUserConfigParam m_hq_mipmap
PARAM_DEFAULT( BoolUserConfigParam(false, "hq_mipmap",
"Generate mipmap for textures using "
"high quality method with SSE") );
// TODO? implement blacklist for new irrlicht device and GUI
PARAM_PREFIX std::vector<std::string> m_blacklist_res;

View File

@ -243,7 +243,6 @@ void CentralVideoSettings::init()
{
hasTextureStorage = true;
hasTextureSwizzle = true;
hasPixelBufferObject = true;
}
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXPLICIT_ATTRIB_LOCATION) &&

View File

@ -15,6 +15,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
#include "graphics/hq_mipmap_generator.hpp"
#undef DUMP_MIPMAP
@ -116,3 +117,5 @@ void HQMipmapGenerator::cleanThreadedLoader()
imFreeMipmapCascade((imMipmapCascade*)m_mipmap_data);
free(m_mipmap_data);
} // cleanThreadedLoader
#endif

View File

@ -18,6 +18,8 @@
#ifndef HEADER_HQ_MIPMAP_GENERATOR_HPP
#define HEADER_HQ_MIPMAP_GENERATOR_HPP
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
#include "graphics/gl_headers.hpp"
#include "utils/no_copy.hpp"
#include "utils/types.hpp"
@ -93,3 +95,5 @@ public:
}; // HQMipmapGenerator
#endif
#endif

View File

@ -28,7 +28,6 @@
#include "utils/log.hpp"
#include "utils/string_utils.hpp"
#include <algorithm>
#include <fstream>
#include <functional>
@ -218,7 +217,7 @@ void STKTexture::reload(bool no_upload, uint8_t* preload_data,
const unsigned int w = m_size.Width;
const unsigned int h = m_size.Height;
unsigned int format = m_single_channel ? GL_RED : GL_BGRA;
unsigned int internal_format = m_single_channel ? GL_R8 : GL_RGBA8;
unsigned int internal_format = m_single_channel ? GL_R8 : GL_RGBA;
#if !defined(USE_GLES2)
if (m_mesh_texture && CVS->isTextureCompressionEnabled())
@ -598,6 +597,7 @@ bool STKTexture::useThreadedLoading() const
//-----------------------------------------------------------------------------
void STKTexture::threadedReload(void* ptr, void* param) const
{
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
video::IImage* orig_img =
m_img_loader->loadImage(m_file, true/*skip_checking*/);
orig_img = resizeImage(orig_img);
@ -626,6 +626,7 @@ void STKTexture::threadedReload(void* ptr, void* param) const
}
else
delete[] data;
#endif
} // threadedReload
//-----------------------------------------------------------------------------
@ -646,10 +647,12 @@ void STKTexture::threadedSubImage(void* ptr) const
//-----------------------------------------------------------------------------
void STKTexture::cleanThreadedLoader()
{
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
assert(m_file);
m_file->drop();
m_file = NULL;
m_img_loader = NULL;
#endif
} // cleanThreadedLoader
//-----------------------------------------------------------------------------

View File

@ -15,6 +15,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
#include "graphics/threaded_tex_loader.hpp"
#include "graphics/stk_tex_manager.hpp"
#include "utils/string_utils.hpp"
@ -82,7 +84,6 @@ void* ThreadedTexLoader::startRoutine(void *obj)
// ----------------------------------------------------------------------------
void ThreadedTexLoader::handleCompletedTextures()
{
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
assert(m_locked);
size_t offset = m_pbo_offset;
for (irr::video::ITexture* tex : m_completed_textures)
@ -92,5 +93,6 @@ void ThreadedTexLoader::handleCompletedTextures()
offset += cur_offset;
}
m_completed_textures.clear();
#endif
} // handleCompletedTextures
#endif

View File

@ -18,6 +18,8 @@
#ifndef HEADER_THREADED_TEX_LOADER_HPP
#define HEADER_THREADED_TEX_LOADER_HPP
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
#include "utils/can_be_deleted.hpp"
#include "utils/no_copy.hpp"
#include "utils/synchronised.hpp"
@ -112,3 +114,5 @@ public:
}; // ThreadedTexLoader
#endif
#endif