From 2fdf61c95222102c3bd12471a0b6d77648535dda Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Fri, 18 Sep 2015 14:32:12 -0600 Subject: layers: Fix APIDump to handle "stdout" special case Also setting example vk_layer_settings.txt file to have APIDump write to stdout. --- layers/vk_layer_settings.txt | 4 ++-- vk-layer-generate.py | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/layers/vk_layer_settings.txt b/layers/vk_layer_settings.txt index 863371bb..7251ff9e 100644 --- a/layers/vk_layer_settings.txt +++ b/layers/vk_layer_settings.txt @@ -79,8 +79,8 @@ ThreadingLogFilename = stdout APIDumpDetailed = TRUE # NoAddr TRUE causes "address" to be dumped in place of hex addresses APIDumpNoAddr = FALSE -# File = TRUE indicates that output should be written to file -APIDumpFile = TRUE +# File = TRUE indicates that output should be written to file instead of STDOUT +APIDumpFile = FALSE # LogFilename is file to dump to when "File = TRUE" default is "vk_apidump.txt" APIDumpLogFilename = stdout # Flush = TRUE causes IO to be flushed after each line that's written diff --git a/vk-layer-generate.py b/vk-layer-generate.py index 26873d45..0d020b92 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -732,13 +732,19 @@ class APIDumpSubcommand(Subcommand): header_txt.append('{') header_txt.append(' if(writeToFile)') header_txt.append(' {') - header_txt.append(' fileStream.open(fileName);') - header_txt.append(' if ((fileStream.rdstate() & fileStream.failbit) != 0) {') + header_txt.append(' if (fileName == "stdout")') + header_txt.append(' {') header_txt.append(' outputStream = &std::cout;') - header_txt.append(' (*outputStream) << endl << "APIDump ERROR: Bad output filename specified: " << fileName << ". Writing to STDOUT instead" << endl << endl;') + header_txt.append(' (*outputStream) << endl << "APIDump output filename \'stdout\' specified. Writing to STDOUT instead of a file." << endl << endl;') + header_txt.append(' } else {') + header_txt.append(' fileStream.open(fileName);') + header_txt.append(' if ((fileStream.rdstate() & fileStream.failbit) != 0) {') + header_txt.append(' outputStream = &std::cout;') + header_txt.append(' (*outputStream) << endl << "APIDump ERROR: Bad output filename specified: " << fileName << ". Writing to STDOUT instead" << endl << endl;') + header_txt.append(' }') + header_txt.append(' else') + header_txt.append(' outputStream = &fileStream;') header_txt.append(' }') - header_txt.append(' else') - header_txt.append(' outputStream = &fileStream;') header_txt.append(' }') header_txt.append(' else') header_txt.append(' {') -- cgit v1.2.3