aboutsummaryrefslogtreecommitdiff
path: root/layers/vk_layer_config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layers/vk_layer_config.cpp')
-rw-r--r--layers/vk_layer_config.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/layers/vk_layer_config.cpp b/layers/vk_layer_config.cpp
index a9cf5d75..d5ee78b2 100644
--- a/layers/vk_layer_config.cpp
+++ b/layers/vk_layer_config.cpp
@@ -27,6 +27,7 @@
#include <map>
#include <string.h>
#include <vk_layer.h>
+#include <iostream>
#include "vk_loader_platform.h"
#include "vk_layer_config.h"
// The following is #included again to catch certain OS-specific functions
@@ -97,6 +98,23 @@ const char *getLayerOption(const char *_option)
return g_configFileObj.getOption(_option);
}
+// If option is NULL or stdout, return stdout, otherwise try to open option
+// as a filename. If successful, return file handle, otherwise stdout
+FILE* getLayerLogOutput(const char *_option, const char *layerName)
+{
+ FILE* log_output = NULL;
+ if (!_option || !strcmp("stdout", _option))
+ log_output = stdout;
+ else {
+ log_output = fopen(_option, "w");
+ if (log_output == NULL) {
+ if (_option)
+ std::cout << std::endl << layerName << " ERROR: Bad output filename specified: " << _option << ". Writing to STDOUT instead" << std::endl << std::endl;
+ log_output = stdout;
+ }
+ }
+}
+
uint32_t getLayerOptionFlags(const char *_option, uint32_t optionDefault)
{
uint32_t flags = optionDefault;