diff --git a/tools/geometryc/geometryc.cpp b/tools/geometryc/geometryc.cpp index c60650a7b..75d89b9a5 100644 --- a/tools/geometryc/geometryc.cpp +++ b/tools/geometryc/geometryc.cpp @@ -21,6 +21,9 @@ namespace stl = tinystl; #include #include +#define BGFX_GEOMETRYC_VERSION_MAJOR 1 +#define BGFX_GEOMETRYC_VERSION_MINOR 0 + #if 0 # define BX_TRACE(_format, ...) \ do { \ @@ -350,6 +353,23 @@ void write(bx::WriterI* _writer } } +inline uint32_t rgbaToAbgr(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) +{ + return (uint32_t(_r)<<0) + | (uint32_t(_g)<<8) + | (uint32_t(_b)<<16) + | (uint32_t(_a)<<24) + ; +} + +struct GroupSortByMaterial +{ + bool operator()(const Group& _lhs, const Group& _rhs) + { + return _lhs.m_material < _rhs.m_material; + } +}; + void help(const char* _error = NULL) { if (NULL != _error) @@ -358,9 +378,12 @@ void help(const char* _error = NULL) } fprintf(stderr - , "geometryc, bgfx geometry compiler tool\n" + , "geometryc, bgfx geometry compiler tool, version %d.%d.%d.\n" "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" + , BGFX_GEOMETRYC_VERSION_MAJOR + , BGFX_GEOMETRYC_VERSION_MINOR + , BGFX_API_VERSION ); fprintf(stderr @@ -372,6 +395,8 @@ void help(const char* _error = NULL) "\n" "Options:\n" + " -h, --help Help.\n" + " -v, --version Version information only.\n" " -f Input file path.\n" " -o Output file path.\n" " -s, --scale Scale factor.\n" @@ -395,27 +420,27 @@ void help(const char* _error = NULL) ); } -inline uint32_t rgbaToAbgr(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) -{ - return (uint32_t(_r)<<0) - | (uint32_t(_g)<<8) - | (uint32_t(_b)<<16) - | (uint32_t(_a)<<24) - ; -} - -struct GroupSortByMaterial -{ - bool operator()(const Group& _lhs, const Group& _rhs) - { - return _lhs.m_material < _rhs.m_material; - } -}; - int main(int _argc, const char* _argv[]) { bx::CommandLine cmdLine(_argc, _argv); + if (cmdLine.hasArg('v', "version") ) + { + fprintf(stderr + , "geometryc, bgfx geometry compiler tool, version %d.%d.%d.\n" + , BGFX_GEOMETRYC_VERSION_MAJOR + , BGFX_GEOMETRYC_VERSION_MINOR + , BGFX_API_VERSION + ); + return EXIT_SUCCESS; + } + + if (cmdLine.hasArg('h', "help") ) + { + help(); + return EXIT_FAILURE; + } + const char* filePath = cmdLine.findOption('f'); if (NULL == filePath) { diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index ac8b3bfb5..1ab48db93 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -12,14 +12,17 @@ extern "C" #include } // extern "C" +#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2) +#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4) +#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4) + +#define BGFX_SHADERC_VERSION_MAJOR 1 +#define BGFX_SHADERC_VERSION_MINOR 0 + namespace bgfx { bool g_verbose = false; - #define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x2) - #define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x4) - #define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x4) - static const char* s_ARB_shader_texture_lod[] = { "texture2DLod", @@ -725,9 +728,12 @@ namespace bgfx } fprintf(stderr - , "shaderc, bgfx shader compiler tool\n" + , "shaderc, bgfx shader compiler tool, version %d.%d.%d.\n" "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" + , BGFX_SHADERC_VERSION_MAJOR + , BGFX_SHADERC_VERSION_MINOR + , BGFX_API_VERSION ); fprintf(stderr @@ -735,6 +741,8 @@ namespace bgfx "\n" "Options:\n" + " -h, --help Help.\n" + " -v, --version Version information only.\n" " -f Input file path.\n" " -i Include path (for multiple paths use use -i multiple times).\n" " -o Output file path.\n" @@ -774,6 +782,17 @@ namespace bgfx { bx::CommandLine cmdLine(_argc, _argv); + if (cmdLine.hasArg('v', "version") ) + { + fprintf(stderr + , "shaderc, bgfx shader compiler tool, version %d.%d.%d.\n" + , BGFX_SHADERC_VERSION_MAJOR + , BGFX_SHADERC_VERSION_MINOR + , BGFX_API_VERSION + ); + return EXIT_SUCCESS; + } + if (cmdLine.hasArg('h', "help") ) { help(); diff --git a/tools/texturev/texturev.cpp b/tools/texturev/texturev.cpp index b5ee55f5e..363ee59c3 100644 --- a/tools/texturev/texturev.cpp +++ b/tools/texturev/texturev.cpp @@ -35,6 +35,9 @@ namespace stl = tinystl; #include "fs_texture_cube.bin.h" #include "fs_texture_sdf.bin.h" +#define BGFX_TEXTUREV_VERSION_MAJOR 1 +#define BGFX_TEXTUREV_VERSION_MINOR 0 + static const bgfx::EmbeddedShader s_embeddedShaders[] = { BGFX_EMBEDDED_SHADER(vs_texture), @@ -509,39 +512,6 @@ struct Interpolator } }; -void help(const char* _error = NULL) -{ - if (NULL != _error) - { - fprintf(stderr, "Error:\n%s\n\n", _error); - } - - fprintf(stderr - , "texturev, bgfx texture viewer tool\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" - "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" - ); - - fprintf(stderr - , "Usage: texturev \n" - "\n" - "Supported input file types:\n" - ); - - for (uint32_t ii = 0; ii < BX_COUNTOF(s_supportedExt); ++ii) - { - fprintf(stderr, " *.%s\n", s_supportedExt[ii]); - } - - fprintf(stderr - , "\n" - "Options:\n" - " --associate Associate file extensions with texturev.\n" - "\n" - "For additional information, see https://github.com/bkaradzic/bgfx\n" - ); -} - void associate() { #if BX_PLATFORM_WINDOWS @@ -628,10 +598,59 @@ void associate() #endif // BX_PLATFORM_WINDOWS } +void help(const char* _error = NULL) +{ + if (NULL != _error) + { + fprintf(stderr, "Error:\n%s\n\n", _error); + } + + fprintf(stderr + , "texturev, bgfx texture viewer tool, version %d.%d.%d.\n" + "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" + "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" + , BGFX_TEXTUREV_VERSION_MAJOR + , BGFX_TEXTUREV_VERSION_MINOR + , BGFX_API_VERSION + ); + + fprintf(stderr + , "Usage: texturev \n" + "\n" + "Supported input file types:\n" + ); + + for (uint32_t ii = 0; ii < BX_COUNTOF(s_supportedExt); ++ii) + { + fprintf(stderr, " *.%s\n", s_supportedExt[ii]); + } + + fprintf(stderr + , "\n" + "Options:\n" + " -h, --help Help.\n" + " -v, --version Version information only.\n" + " --associate Associate file extensions with texturev.\n" + "\n" + "For additional information, see https://github.com/bkaradzic/bgfx\n" + ); +} + int _main_(int _argc, char** _argv) { bx::CommandLine cmdLine(_argc, _argv); + if (cmdLine.hasArg('v', "version") ) + { + fprintf(stderr + , "texturev, bgfx texture viewer tool, version %d.%d.%d.\n" + , BGFX_TEXTUREV_VERSION_MAJOR + , BGFX_TEXTUREV_VERSION_MINOR + , BGFX_API_VERSION + ); + return EXIT_SUCCESS; + } + if (cmdLine.hasArg('h', "help") ) { help(); @@ -776,9 +795,12 @@ int _main_(int _argc, char** _argv) ImGui::SetWindowFontScale(1.0f); ImGui::Text( - "texturev, bgfx texture viewer tool " ICON_KI_WRENCH "\n" + "texturev, bgfx texture viewer tool " ICON_KI_WRENCH ", version %d.%d.%d.\n" "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n" + , BGFX_TEXTUREV_VERSION_MAJOR + , BGFX_TEXTUREV_VERSION_MINOR + , BGFX_API_VERSION ); ImGui::Separator(); ImGui::NextLine();