Archived
1
Fork 0

Move console and log namespaces to prism

This commit is contained in:
redstrate 2021-04-20 11:23:53 -04:00
parent 8370dfb6d6
commit bae6d05184
16 changed files with 120 additions and 122 deletions

View file

@ -20,7 +20,7 @@ std::unique_ptr<Mesh> load_mesh(const file::Path path) {
auto file = file::open(path, true); auto file = file::open(path, true);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Renderer, "Failed to load mesh from {}!", path); prism::log::error(System::Renderer, "Failed to load mesh from {}!", path);
return nullptr; return nullptr;
} }
@ -29,7 +29,7 @@ std::unique_ptr<Mesh> load_mesh(const file::Path path) {
if(version == 5 || version == 6) { if(version == 5 || version == 6) {
} else { } else {
console::error(System::Renderer, "{} failed the mesh version check! reported version = {}", path, std::to_string(version)); prism::log::error(System::Renderer, "{} failed the mesh version check! reported version = {}", path, std::to_string(version));
return nullptr; return nullptr;
} }
@ -190,7 +190,7 @@ std::unique_ptr<Texture> load_texture(const file::Path path) {
auto file = file::open(path, true); auto file = file::open(path, true);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Renderer, "Failed to load texture from {}!", path); prism::log::error(System::Renderer, "Failed to load texture from {}!", path);
return nullptr; return nullptr;
} }
@ -202,7 +202,7 @@ std::unique_ptr<Texture> load_texture(const file::Path path) {
int width, height, channels; int width, height, channels;
unsigned char* data = stbi_load_from_memory(file->cast_data<unsigned char>(), file->size(), &width, &height, &channels, 4); unsigned char* data = stbi_load_from_memory(file->cast_data<unsigned char>(), file->size(), &width, &height, &channels, 4);
if(!data) { if(!data) {
console::error(System::Renderer, "Failed to load texture from {}!", path); prism::log::error(System::Renderer, "Failed to load texture from {}!", path);
return nullptr; return nullptr;
} }
@ -247,7 +247,7 @@ std::unique_ptr<Material> load_material(const file::Path path) {
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load material from {}!", path); prism::log::error(System::Core, "Failed to load material from {}!", path);
return {}; return {};
} }
@ -258,7 +258,7 @@ std::unique_ptr<Material> load_material(const file::Path path) {
mat->path = path.string(); mat->path = path.string();
if(!j.count("version") || j["version"] != 2) { if(!j.count("version") || j["version"] != 2) {
console::error(System::Core, "Material {} failed the version check!", path); prism::log::error(System::Core, "Material {} failed the version check!", path);
return mat; return mat;
} }

View file

@ -6,46 +6,47 @@
#include <variant> #include <variant>
#include <string> #include <string>
namespace console { namespace prism::console {
enum class ArgType { enum class argument_type {
String, String,
Integer, Integer,
Boolean Boolean
}; };
struct ConsoleArgument { struct console_argument {
ConsoleArgument(bool data) : data(data) {} explicit console_argument(bool data) : data(data) {}
ConsoleArgument(int data) : data(data) {}
ArgType query_type() const { explicit console_argument(int data) : data(data) {}
[[nodiscard]] argument_type query_type() const {
if (std::holds_alternative<std::string>(data)) if (std::holds_alternative<std::string>(data))
return ArgType::String; return argument_type::String;
else if (std::holds_alternative<int>(data)) else if (std::holds_alternative<int>(data))
return ArgType::Integer; return argument_type::Integer;
else if (std::holds_alternative<bool>(data)) else if (std::holds_alternative<bool>(data))
return ArgType::Boolean; return argument_type::Boolean;
} }
std::variant<std::string, int, bool> data; std::variant<std::string, int, bool> data;
}; };
struct Arguments { using arguments = std::vector<console_argument>;
std::vector<ConsoleArgument> arguments;
};
using FunctionPtr = std::function<void(console::Arguments)>; using function_ptr = std::function<void(console::arguments)>;
struct ArgumentFormat { struct argument_format {
ArgumentFormat(const int num_arguments) : num_arguments(num_arguments) {} explicit argument_format(const int num_arguments) : num_arguments(num_arguments) {}
int num_arguments = 0; int num_arguments = 0;
std::vector<ArgType> argument_types; std::vector<argument_type> argument_types;
}; };
void register_command(const std::string_view name, const ArgumentFormat expected_format, const FunctionPtr function); void
register_command(std::string_view name, argument_format expected_format, function_ptr function);
void invoke_command(const std::string_view name, const Arguments arguments); void invoke_command(std::string_view name, arguments arguments);
void parse_and_invoke_command(const std::string_view command);
void register_variable(const std::string_view name, bool& variable); void parse_and_invoke_command(std::string_view command);
void register_variable(std::string_view name, bool &variable);
} }

View file

@ -7,41 +7,41 @@
#include "log.hpp" #include "log.hpp"
#include "string_utils.hpp" #include "string_utils.hpp"
struct RegisteredCommand { struct registered_command {
RegisteredCommand(const console::ArgumentFormat format, const console::FunctionPtr function) : expected_format(format), function(function) {} registered_command(const prism::console::argument_format format, const prism::console::function_ptr function) : expected_format(format), function(function) {}
console::ArgumentFormat expected_format; prism::console::argument_format expected_format;
std::function<void(console::Arguments)> function; std::function<void(prism::console::arguments)> function;
}; };
static std::unordered_map<std::string, RegisteredCommand> registered_commands; static std::unordered_map<std::string, registered_command> registered_commands;
struct RegisteredVariable { struct RegisteredVariable {
RegisteredVariable(bool& data) : type(console::ArgType::Boolean), data(&data) {} RegisteredVariable(bool& data) : type(prism::console::argument_type::Boolean), data(&data) {}
console::ArgType type; prism::console::argument_type type;
std::variant<bool*> data; std::variant<bool*> data;
}; };
static std::unordered_map<std::string, RegisteredVariable> registered_variables; static std::unordered_map<std::string, RegisteredVariable> registered_variables;
void console::register_command(const std::string_view name, const ArgumentFormat expected_format, const console::FunctionPtr function) { void prism::console::register_command(const std::string_view name, const prism::console::argument_format expected_format, const prism::console::function_ptr function) {
registered_commands.try_emplace(name.data(), RegisteredCommand(expected_format, function)); registered_commands.try_emplace(name.data(), registered_command(expected_format, function));
} }
void console::invoke_command(const std::string_view name, const Arguments arguments) { void prism::console::invoke_command(const std::string_view name, const prism::console::arguments arguments) {
for(auto& [command_name, command_data] : registered_commands) { for(auto& [command_name, command_data] : registered_commands) {
if(command_name == name) { if(command_name == name) {
bool invalid_format = false; bool invalid_format = false;
if(arguments.arguments.size() != command_data.expected_format.num_arguments) if(arguments.size() != command_data.expected_format.num_arguments)
invalid_format = true; invalid_format = true;
if(invalid_format) { if(invalid_format) {
console::info(System::Core, "Invalid command format!"); prism::log::info(System::Core, "Invalid command format!");
} else { } else {
command_data.function(console::Arguments()); command_data.function(console::arguments());
} }
return; return;
@ -52,18 +52,18 @@ void console::invoke_command(const std::string_view name, const Arguments argume
if(variable_name == name) { if(variable_name == name) {
bool invalid_format = false; bool invalid_format = false;
if(arguments.arguments.empty()) if(arguments.empty())
invalid_format = true; invalid_format = true;
if(arguments.arguments[0].query_type() != variable_data.type) if(arguments[0].query_type() != variable_data.type)
invalid_format = true; invalid_format = true;
if(invalid_format) { if(invalid_format) {
console::info(System::Core, "Wrong or empty variable type!"); prism::log::info(System::Core, "Wrong or empty variable type!");
} else { } else {
auto argument = arguments.arguments[0]; auto argument = arguments[0];
switch(argument.query_type()) { switch(argument.query_type()) {
case console::ArgType::Boolean: case console::argument_type::Boolean:
*std::get<bool*>(variable_data.data) = std::get<bool>(argument.data); *std::get<bool*>(variable_data.data) = std::get<bool>(argument.data);
break; break;
} }
@ -73,39 +73,36 @@ void console::invoke_command(const std::string_view name, const Arguments argume
} }
} }
console::info(System::Core, "{} is not the name of a valid command or variable!", name.data()); prism::log::info(System::Core, "{} is not the name of a valid command or variable!", name.data());
} }
void console::parse_and_invoke_command(const std::string_view command) { void prism::console::parse_and_invoke_command(const std::string_view command) {
const auto tokens = tokenize(command, " "); const auto tokens = tokenize(command, " ");
if(tokens.empty()) if(tokens.empty())
return; return;
const auto try_parse_argument = [](std::string_view arg) -> std::optional<ConsoleArgument> { const auto try_parse_argument = [](std::string_view arg) -> std::optional<console_argument> {
if(arg == "true") { if(arg == "true") {
return ConsoleArgument(true); return console_argument(true);
} else if(arg == "false") { } else if(arg == "false") {
return ConsoleArgument(false); return console_argument(false);
} else if(is_numeric(arg)) { } else if(is_numeric(arg)) {
return ConsoleArgument(std::stoi(arg.data())); return console_argument(std::stoi(arg.data()));
} }
return std::nullopt; return std::nullopt;
}; };
std::vector<ConsoleArgument> arguments; std::vector<console_argument> arguments;
for(int i = 1; i < tokens.size(); i++) { for(int i = 1; i < tokens.size(); i++) {
if(auto arg = try_parse_argument(tokens[i]); arg) if(auto arg = try_parse_argument(tokens[i]); arg)
arguments.push_back(*arg); arguments.push_back(*arg);
} }
console::Arguments args; console::invoke_command(tokens[0], arguments);
args.arguments = arguments;
console::invoke_command(tokens[0], args);
} }
void console::register_variable(const std::string_view name, bool& variable) { void prism::console::register_variable(const std::string_view name, bool& variable) {
registered_variables.try_emplace(name.data(), RegisteredVariable(variable)); registered_variables.try_emplace(name.data(), RegisteredVariable(variable));
} }

View file

@ -27,15 +27,15 @@
using prism::engine; using prism::engine;
engine::engine(const int argc, char* argv[]) { engine::engine(const int argc, char* argv[]) {
console::info(System::Core, "Prism Engine loading..."); log::info(System::Core, "Prism Engine loading...");
console::register_command("test_cmd", console::ArgumentFormat(0), [](const console::Arguments&) { console::register_command("test_cmd", console::argument_format(0), [](const console::arguments&) {
console::info(System::Core, "Test cmd!"); log::info(System::Core, "Test cmd!");
}); });
console::register_variable("rs_dynamic_resolution", render_options.dynamic_resolution); console::register_variable("rs_dynamic_resolution", render_options.dynamic_resolution);
console::register_command("quit", console::ArgumentFormat(0), [this](const console::Arguments&) { console::register_command("quit", console::argument_format(0), [this](const console::arguments&) {
quit(); quit();
}); });
@ -134,7 +134,7 @@ Scene* engine::load_scene(const file::Path& path) {
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load scene from {}!", path); prism::log::error(System::Core, "Failed to load scene from {}!", path);
return nullptr; return nullptr;
} }
@ -227,7 +227,7 @@ Animation engine::load_animation(const file::Path& path) {
auto file = file::open(path, true); auto file = file::open(path, true);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load animation from {}!", path); prism::log::error(System::Core, "Failed to load animation from {}!", path);
return {}; return {};
} }
@ -287,7 +287,7 @@ void engine::load_cutscene(const file::Path& path) {
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load cutscene from {}!", path); prism::log::error(System::Core, "Failed to load cutscene from {}!", path);
return; return;
} }
@ -362,7 +362,7 @@ Object engine::add_prefab(Scene& scene, const file::Path& path, const std::strin
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load prefab from {}!", path); prism::log::error(System::Core, "Failed to load prefab from {}!", path);
return NullObject; return NullObject;
} }

View file

@ -21,7 +21,7 @@ std::optional<file::File> file::open(const file::Path path, const bool binary_mo
auto str = get_file_path(path).string(); auto str = get_file_path(path).string();
FILE* file = fopen(str.c_str(), binary_mode ? "rb" : "r"); FILE* file = fopen(str.c_str(), binary_mode ? "rb" : "r");
if(file == nullptr) { if(file == nullptr) {
console::error(System::File, "Failed to open file handle from {}!", str); prism::log::error(System::File, "Failed to open file handle from {}!", str);
return {}; return {};
} }

View file

@ -97,7 +97,7 @@ UIElement* ui::Screen::find_element(const std::string& id) {
ui::Screen::Screen(const file::Path path) { ui::Screen::Screen(const file::Path path) {
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load UI from {}!", path); prism::log::error(System::Core, "Failed to load UI from {}!", path);
return; return;
} }

View file

@ -165,14 +165,14 @@ VKAPI_ATTR VkBool32 VKAPI_CALL DebugCallback(
const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
void *pUserData) { void *pUserData) {
console::debug(System::GFX, pCallbackData->pMessage); prism::log::debug(System::GFX, pCallbackData->pMessage);
return VK_FALSE; return VK_FALSE;
} }
VkResult name_object(VkDevice device, VkObjectType type, uint64_t object, std::string_view name) { VkResult name_object(VkDevice device, VkObjectType type, uint64_t object, std::string_view name) {
if(object == 0x0) { if(object == 0x0) {
console::error(System::GFX, "Failed to name object {}", name); prism::log::error(System::GFX, "Failed to name object {}", name);
return VK_ERROR_DEVICE_LOST; return VK_ERROR_DEVICE_LOST;
} }
@ -537,7 +537,7 @@ void GFXVulkan::copy_texture(GFXTexture* texture, void* data, GFXSize size) {
} }
void GFXVulkan::copy_texture(GFXTexture* from, GFXTexture* to) { void GFXVulkan::copy_texture(GFXTexture* from, GFXTexture* to) {
console::error(System::GFX, "Copy Texture->Texture unimplemented!"); prism::log::error(System::GFX, "Copy Texture->Texture unimplemented!");
} }
void GFXVulkan::copy_texture(GFXTexture* from, GFXBuffer* to) { void GFXVulkan::copy_texture(GFXTexture* from, GFXBuffer* to) {
@ -1688,7 +1688,7 @@ void GFXVulkan::resetDescriptorState() {
void GFXVulkan::cacheDescriptorState(GFXVulkanPipeline* pipeline, VkDescriptorSetLayout layout) { void GFXVulkan::cacheDescriptorState(GFXVulkanPipeline* pipeline, VkDescriptorSetLayout layout) {
uint64_t hash = getDescriptorHash(pipeline); uint64_t hash = getDescriptorHash(pipeline);
console::debug(System::GFX, "Caching descriptor hash {}", std::to_string(hash)); prism::log::debug(System::GFX, "Caching descriptor hash {}", std::to_string(hash));
vkDeviceWaitIdle(device); vkDeviceWaitIdle(device);
@ -1703,7 +1703,7 @@ void GFXVulkan::cacheDescriptorState(GFXVulkanPipeline* pipeline, VkDescriptorSe
VkResult error = vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet); VkResult error = vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet);
if(error == VK_ERROR_OUT_OF_POOL_MEMORY) { if(error == VK_ERROR_OUT_OF_POOL_MEMORY) {
console::error(System::GFX, "ERROR: COULD NOT CACHE BECAUSE OUT OF DESCRIPTOR SETS."); prism::log::error(System::GFX, "ERROR: COULD NOT CACHE BECAUSE OUT OF DESCRIPTOR SETS.");
} }
if(error != VK_SUCCESS) if(error != VK_SUCCESS)

View file

@ -20,7 +20,7 @@ enum class Level {
Debug Debug
}; };
namespace console { namespace prism::log {
inline void internal_format(std::string &msg, const std::string &arg) { inline void internal_format(std::string &msg, const std::string &arg) {
auto pos = msg.find_first_of("{}"); auto pos = msg.find_first_of("{}");
msg.replace(pos, 2, arg); msg.replace(pos, 2, arg);

View file

@ -6,7 +6,7 @@
#include "string_utils.hpp" #include "string_utils.hpp"
#include "utility.hpp" #include "utility.hpp"
void console::process_message(const Level level, const System system, const std::string_view message) { void prism::log::process_message(const Level level, const System system, const std::string_view message) {
auto now = std::chrono::system_clock::now(); auto now = std::chrono::system_clock::now();
std::time_t t_c = std::chrono::system_clock::to_time_t(now); std::time_t t_c = std::chrono::system_clock::to_time_t(now);

View file

@ -162,7 +162,7 @@ void ImGuiPass::load_font(const std::string_view filename) {
io.Fonts->AddFontFromMemoryTTF(font_file->cast_data<unsigned char>(), font_file->size(), 15.0 * platform::get_window_dpi(0)); io.Fonts->AddFontFromMemoryTTF(font_file->cast_data<unsigned char>(), font_file->size(), 15.0 * platform::get_window_dpi(0));
ImGui::GetIO().FontGlobalScale = 1.0 / platform::get_window_dpi(0); ImGui::GetIO().FontGlobalScale = 1.0 / platform::get_window_dpi(0);
} else { } else {
console::error(System::Renderer, "Failed to load font file for imgui!"); prism::log::error(System::Renderer, "Failed to load font file for imgui!");
return; return;
} }
} }

View file

@ -13,7 +13,7 @@
ShaderSource get_shader(std::string filename, bool skinned, bool cubemap) { ShaderSource get_shader(std::string filename, bool skinned, bool cubemap) {
auto shader_file = file::open(file::internal_domain / filename); auto shader_file = file::open(file::internal_domain / filename);
if(!shader_file.has_value()) { if(!shader_file.has_value()) {
console::error(System::Renderer, "Failed to open shader file {}!", filename); prism::log::error(System::Renderer, "Failed to open shader file {}!", filename);
return {}; return {};
} }

View file

@ -887,7 +887,7 @@ void Renderer::createPostPipelines() {
void Renderer::createFontTexture() { void Renderer::createFontTexture() {
auto file = file::open(file::app_domain / "font.fp", true); auto file = file::open(file::app_domain / "font.fp", true);
if(file == std::nullopt) { if(file == std::nullopt) {
console::error(System::Renderer, "Failed to load font file!"); prism::log::error(System::Renderer, "Failed to load font file!");
return; return;
} }

View file

@ -54,7 +54,7 @@ const std::vector<uint32_t> compile_glsl_to_spv(const std::string_view source_st
includer.pushExternalLocalDirectory(path); includer.pushExternalLocalDirectory(path);
if (!Shader.parse(&Resources, 100, false, messages, includer)) { if (!Shader.parse(&Resources, 100, false, messages, includer)) {
console::error(System::Renderer, "{}", Shader.getInfoLog()); prism::log::error(System::Renderer, "{}", Shader.getInfoLog());
return {}; return {};
} }
@ -63,7 +63,7 @@ const std::vector<uint32_t> compile_glsl_to_spv(const std::string_view source_st
Program.addShader(&Shader); Program.addShader(&Shader);
if(!Program.link(messages)) { if(!Program.link(messages)) {
console::error(System::None, "Failed to link shader: {} {} {}", source_string.data(), Shader.getInfoLog(), Shader.getInfoDebugLog()); prism::log::error(System::None, "Failed to link shader: {} {} {}", source_string.data(), Shader.getInfoLog(), Shader.getInfoDebugLog());
return {}; return {};
} }
@ -78,7 +78,7 @@ const std::vector<uint32_t> compile_glsl_to_spv(const std::string_view source_st
std::optional<ShaderSource> ShaderCompiler::compile(const ShaderLanguage from_language, const ShaderStage shader_stage, const ShaderSource& shader_source, const ShaderLanguage to_language, const CompileOptions& options) { std::optional<ShaderSource> ShaderCompiler::compile(const ShaderLanguage from_language, const ShaderStage shader_stage, const ShaderSource& shader_source, const ShaderLanguage to_language, const CompileOptions& options) {
if(from_language != ShaderLanguage::GLSL) { if(from_language != ShaderLanguage::GLSL) {
console::error(System::Renderer, "Non-supported input language!"); prism::log::error(System::Renderer, "Non-supported input language!");
return std::nullopt; return std::nullopt;
} }
@ -97,7 +97,7 @@ std::optional<ShaderSource> ShaderCompiler::compile(const ShaderLanguage from_la
auto spirv = compile_glsl_to_spv(shader_source.as_string(), lang, options); auto spirv = compile_glsl_to_spv(shader_source.as_string(), lang, options);
if(spirv.empty()) { if(spirv.empty()) {
console::error(System::Renderer, "SPIRV generation failed!"); prism::log::error(System::Renderer, "SPIRV generation failed!");
return std::nullopt; return std::nullopt;
} }

View file

@ -7,7 +7,7 @@ namespace file {
using Path = std::filesystem::path; using Path = std::filesystem::path;
} }
namespace console { namespace prism::log {
inline void internal_format(std::string& msg, const file::Path& arg) { inline void internal_format(std::string& msg, const file::Path& arg) {
auto pos = msg.find_first_of("{}"); auto pos = msg.find_first_of("{}");
msg.replace(pos, 2, arg.string()); msg.replace(pos, 2, arg.string());

View file

@ -751,7 +751,7 @@ void CommonEditor::set_undo_stack(UndoStack *stack) {
bool mesh_readable(const file::Path path) { bool mesh_readable(const file::Path path) {
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Renderer, "Failed to load mesh from {}!", path); prism::log::error(System::Renderer, "Failed to load mesh from {}!", path);
return false; return false;
} }
@ -764,7 +764,7 @@ bool mesh_readable(const file::Path path) {
bool material_readable(const file::Path path) { bool material_readable(const file::Path path) {
auto file = file::open(path); auto file = file::open(path);
if(!file.has_value()) { if(!file.has_value()) {
console::error(System::Core, "Failed to load material from {}!", path); prism::log::error(System::Core, "Failed to load material from {}!", path);
return false; return false;
} }
@ -1057,13 +1057,13 @@ void CommonEditor::drawConsole() {
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Run")) { if(ImGui::Button("Run")) {
console::parse_and_invoke_command(command_buffer); prism::console::parse_and_invoke_command(command_buffer);
command_buffer.clear(); command_buffer.clear();
} }
ImGui::BeginChild("console_output", ImVec2(-1, -1), true); ImGui::BeginChild("console_output", ImVec2(-1, -1), true);
for(const auto& message : console::stored_output) for(const auto& message : prism::log::stored_output)
ImGui::TextWrapped("%s", message.c_str()); ImGui::TextWrapped("%s", message.c_str());
ImGui::EndChild(); ImGui::EndChild();
@ -1140,7 +1140,7 @@ void CommonEditor::save_thumbnail_cache() {
FILE* file = fopen("thumbnail-cache", "wb"); FILE* file = fopen("thumbnail-cache", "wb");
if(file == nullptr) { if(file == nullptr) {
console::error(System::Core, "Failed to write thumbnail cache!"); prism::log::error(System::Core, "Failed to write thumbnail cache!");
return; return;
} }

View file

@ -13,7 +13,7 @@ bool has_extension(const std::filesystem::path path, const std::string_view exte
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if(argc < 2) { if(argc < 2) {
console::error(System::Core, "Not enough arguments!"); prism::log::error(System::Core, "Not enough arguments!");
return -1; return -1;
} }
@ -34,7 +34,7 @@ int main(int argc, char* argv[]) {
std::ofstream out(outname + ".glsl"); std::ofstream out(outname + ".glsl");
out << buffer.rdbuf(); out << buffer.rdbuf();
console::info(System::Core, "Successfully written {} to {}.", source_path, destination_path); prism::log::info(System::Core, "Successfully written {} to {}.", source_path, destination_path);
return 0; return 0;
} else { } else {
@ -60,7 +60,7 @@ int main(int argc, char* argv[]) {
const auto compiled_source = shader_compiler.compile(ShaderLanguage::GLSL, stage, buffer.str(), language, options); const auto compiled_source = shader_compiler.compile(ShaderLanguage::GLSL, stage, buffer.str(), language, options);
if(!compiled_source.has_value()) { if(!compiled_source.has_value()) {
console::error(System::Core, "Error when compiling {}!", source_path); prism::log::error(System::Core, "Error when compiling {}!", source_path);
return -1; return -1;
} }
@ -83,7 +83,7 @@ int main(int argc, char* argv[]) {
break; break;
} }
console::info(System::Core, "Successfully written shader from {} to {}.", source_path, destination_path); prism::log::info(System::Core, "Successfully written shader from {} to {}.", source_path, destination_path);
return 0; return 0;
} }