diff options
| -rwxr-xr-x | vk-layer-generate.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/vk-layer-generate.py b/vk-layer-generate.py index 8c3d63c2..018e3abf 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -701,6 +701,13 @@ class APIDumpSubcommand(Subcommand): header_txt.append('#include <string>') header_txt.append('#include <string.h>') header_txt.append('') + header_txt.append('#include "vk_loader_platform.h"') + header_txt.append('#include "vk_layer.h"') + header_txt.append('#include "vk_struct_string_helper_cpp.h"') + header_txt.append('#include "vk_layer_table.h"') + header_txt.append('#include "vk_layer_extension_utils.h"') + header_txt.append('#include <unordered_map>') + header_txt.append('') header_txt.append('static std::ofstream fileStream;') header_txt.append('static std::string fileName = "vk_apidump.txt";') header_txt.append('std::ostream* outputStream = NULL;') @@ -709,7 +716,12 @@ class APIDumpSubcommand(Subcommand): header_txt.append(' if(writeToFile)') header_txt.append(' {') header_txt.append(' fileStream.open(fileName);') - header_txt.append(' outputStream = &fileStream;') + 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(' {') @@ -727,13 +739,6 @@ class APIDumpSubcommand(Subcommand): header_txt.append('}') header_txt.append('') header_txt.append('%s' % self.lineinfo.get()) - header_txt.append('#include "vk_loader_platform.h"') - header_txt.append('#include "vk_layer.h"') - header_txt.append('#include "vk_struct_string_helper_cpp.h"') - header_txt.append('#include "vk_layer_table.h"') - header_txt.append('#include "vk_layer_extension_utils.h"') - header_txt.append('#include <unordered_map>') - header_txt.append('') header_txt.append('// The following is #included again to catch certain OS-specific functions being used:') header_txt.append('#include "vk_loader_platform.h"') header_txt.append('') |
