Silent error mode as global toggle
This commit is contained in:
parent
6a60e5d60e
commit
4b0bb1a454
3 changed files with 7 additions and 1 deletions
|
|
@ -12,6 +12,8 @@ namespace vks
|
||||||
{
|
{
|
||||||
namespace tools
|
namespace tools
|
||||||
{
|
{
|
||||||
|
bool errorModeSilent = false;
|
||||||
|
|
||||||
std::string errorString(VkResult errorCode)
|
std::string errorString(VkResult errorCode)
|
||||||
{
|
{
|
||||||
switch (errorCode)
|
switch (errorCode)
|
||||||
|
|
@ -263,7 +265,7 @@ namespace vks
|
||||||
void exitFatal(std::string message, std::string caption, bool silent)
|
void exitFatal(std::string message, std::string caption, bool silent)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if (!silent) {
|
if (!errorModeSilent) {
|
||||||
MessageBox(NULL, message.c_str(), caption.c_str(), MB_OK | MB_ICONERROR);
|
MessageBox(NULL, message.c_str(), caption.c_str(), MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,9 @@ namespace vks
|
||||||
{
|
{
|
||||||
namespace tools
|
namespace tools
|
||||||
{
|
{
|
||||||
|
/** @brief Disable message boxes on fatal errors */
|
||||||
|
extern bool errorModeSilent;
|
||||||
|
|
||||||
/** @brief Returns an error code as a string */
|
/** @brief Returns an error code as a string */
|
||||||
std::string errorString(VkResult errorCode);
|
std::string errorString(VkResult errorCode);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -695,6 +695,7 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation)
|
||||||
// Benchmark
|
// Benchmark
|
||||||
if ((args[i] == std::string("-b")) || (args[i] == std::string("--benchmark"))) {
|
if ((args[i] == std::string("-b")) || (args[i] == std::string("--benchmark"))) {
|
||||||
benchmark.active = true;
|
benchmark.active = true;
|
||||||
|
vks::tools::errorModeSilent = true;
|
||||||
}
|
}
|
||||||
// Warmup time (in seconds)
|
// Warmup time (in seconds)
|
||||||
if ((args[i] == std::string("-bw")) || (args[i] == std::string("--benchwarmup"))) {
|
if ((args[i] == std::string("-bw")) || (args[i] == std::string("--benchwarmup"))) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue