Improve server-only run, hide all sp shader debug message

This commit is contained in:
Benau
2018-04-01 08:51:12 +08:00
parent 852c78729f
commit 5920ac5406
3 changed files with 13 additions and 5 deletions

View File

@@ -37,6 +37,7 @@ const std::map<std::string, std::pair<unsigned, SamplerType> >
{ "skinning_tex", { 0, ST_TEXTURE_BUFFER } }
#endif
};
bool SPShader::m_sp_shader_debug = false;
// ----------------------------------------------------------------------------
void SPShader::addShaderFile(const std::string& name, GLint shader_type,
@@ -226,20 +227,20 @@ void SPShader::addAllUniforms(RenderPass rp)
GLenum type;
char name[100] = {};
glGetActiveUniform(m_program[rp], i, 99, NULL, &size, &type, name);
if (size != 1)
if (size != 1 && m_sp_shader_debug)
{
Log::debug("SPShader", "Array of uniforms is not supported in"
" shader %s for %s.", m_name.c_str(), name);
continue;
}
auto ret = supported_types.find(type);
if (ret == supported_types.end())
if (ret == supported_types.end() && m_sp_shader_debug)
{
Log::debug("SPShader", "%d type not supported", (unsigned)type);
continue;
}
GLuint location = glGetUniformLocation(m_program[rp], name);
if (location == GL_INVALID_INDEX)
if (location == GL_INVALID_INDEX && m_sp_shader_debug)
{
Log::debug("SPShader", "%s uniform not found", name);
continue;

View File

@@ -111,6 +111,8 @@ private:
const std::array<bool, 6> m_srgb;
public:
// ------------------------------------------------------------------------
static bool m_sp_shader_debug;
// ------------------------------------------------------------------------
SPShader(const std::string& name,
const std::function<void(SPShader*)>& init_func,

View File

@@ -191,6 +191,7 @@
#include "graphics/particle_kind_manager.hpp"
#include "graphics/referee.hpp"
#include "graphics/sp/sp_base.hpp"
#include "graphics/sp/sp_shader.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/event_handler.hpp"
#include "guiengine/dialog_queue.hpp"
@@ -571,6 +572,7 @@ void cmdLineHelp()
" --unlock-all Permanently unlock all karts and tracks for testing.\n"
" --no-unlock-all Disable unlock-all (i.e. base unlocking on player achievement).\n"
" --no-graphics Do not display the actual race.\n"
" --sp-shader-debug Enables debug in sp shader, it will print all unavailable uniforms.\n"
" --demo-mode=t Enables demo mode after t seconds of idle time in "
"main menu.\n"
" --demo-tracks=t1,t2 List of tracks to be used in demo mode. No\n"
@@ -734,10 +736,13 @@ int handleCmdLinePreliminary()
if(CommandLine::has("--kartdir", &s))
KartPropertiesManager::addKartSearchDir(s);
#ifndef SERVER_ONLY
if(CommandLine::has("--no-graphics") || CommandLine::has("-l"))
{
#endif
ProfileWorld::disableGraphics();
}
if (CommandLine::has("--sp-shader-debug"))
SP::SPShader::m_sp_shader_debug = true;
if(CommandLine::has("--screensize", &s) || CommandLine::has("-s", &s))
{