Browse Source

Ability to filter-out driver-specific "success" shader compilation logs.

Intel drivers on Windows print out "No errors." when the shader is
compiled/linked successfully. I consider that as unnecessary spam and
filter it out.
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
3bb62b7707
  1. 7
      src/Magnum/AbstractShaderProgram.cpp
  2. 32
      src/Magnum/Implementation/driverSpecific.cpp
  3. 7
      src/Magnum/Shader.cpp

7
src/Magnum/AbstractShaderProgram.cpp

@ -44,6 +44,11 @@
namespace Magnum {
namespace Implementation {
/* Defined in Implementation/driverSpecific.cpp */
bool isProgramLinkLogEmpty(const std::string& result);
}
Int AbstractShaderProgram::maxVertexAttributes() {
GLint& value = Context::current()->state().shaderProgram->maxVertexAttributes;
@ -371,7 +376,7 @@ bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<Ab
<< message;
/* Or just warnings, if any */
} else if(!message.empty()) {
} else if(!message.empty() && !Implementation::isProgramLinkLogEmpty(message)) {
Warning out;
out.setFlag(Debug::NewLineAtTheEnd, false);
out.setFlag(Debug::SpaceAfterEachValue, false);

32
src/Magnum/Implementation/driverSpecific.cpp

@ -29,6 +29,38 @@
namespace Magnum {
namespace Implementation {
/* Used in Shader.cpp (duh) */
bool isShaderCompilationLogEmpty(const std::string&);
bool isShaderCompilationLogEmpty(const std::string& result) {
#ifdef CORRADE_TARGET_WINDOWS
/* Intel Windows drivers are too chatty */
if((Context::current()->detectedDriver() & Context::DetectedDriver::IntelWindows) && result == "No errors.\n")
return true;
#else
static_cast<void>(result);
#endif
return false;
}
/* Used in AbstractShaderProgram.cpp (duh) */
bool isProgramLinkLogEmpty(const std::string&);
bool isProgramLinkLogEmpty(const std::string& result) {
#ifdef CORRADE_TARGET_WINDOWS
/* Intel Windows drivers are too chatty */
if((Context::current()->detectedDriver() & Context::DetectedDriver::IntelWindows) && result == "No errors.\n")
return true;
#else
static_cast<void>(result);
#endif
return false;
}
}
auto Context::detectedDriver() -> DetectedDrivers {
if(_detectedDrivers) return *_detectedDrivers;

7
src/Magnum/Shader.cpp

@ -50,6 +50,11 @@ typedef char GLchar;
namespace Magnum {
namespace Implementation {
/* defined in Implementation/driverSpecific.cpp */
bool isShaderCompilationLogEmpty(const std::string& result);
}
namespace {
std::string shaderName(const Shader::Type type) {
@ -770,7 +775,7 @@ bool Shader::compile(std::initializer_list<std::reference_wrapper<Shader>> shade
<< message;
/* Or just warnings, if any */
} else if(!message.empty()) {
} else if(!message.empty() && !Implementation::isShaderCompilationLogEmpty(message)) {
Warning out;
out.setFlag(Debug::NewLineAtTheEnd, false);
out.setFlag(Debug::SpaceAfterEachValue, false);

Loading…
Cancel
Save