Merge branch 'master' of https://github.com/redstrate/prism into master
This commit is contained in:
commit
dc3cbfeab8
8 changed files with 26 additions and 12 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
|
#include "file_utils.hpp"
|
||||||
|
|
||||||
namespace file {
|
namespace file {
|
||||||
enum class Domain {
|
enum class Domain {
|
||||||
|
@ -103,8 +104,6 @@ namespace file {
|
||||||
std::vector<std::byte> data;
|
std::vector<std::byte> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Path = std::filesystem::path;
|
|
||||||
|
|
||||||
/** Sets the domain path to a location in the filesystem.
|
/** Sets the domain path to a location in the filesystem.
|
||||||
@param domain The domain type.
|
@param domain The domain type.
|
||||||
@param mode The access mode.
|
@param mode The access mode.
|
||||||
|
@ -134,11 +133,5 @@ namespace file {
|
||||||
inline Path internal_domain = "/internal", app_domain = "/app";
|
inline Path internal_domain = "/internal", app_domain = "/app";
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace console {
|
|
||||||
inline void internal_format(std::string& msg, const file::Path& arg) {
|
|
||||||
auto pos = msg.find_first_of("{}");
|
|
||||||
msg.replace(pos, 2, arg.string());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::array<std::string, 3> domain_data;
|
inline std::array<std::string, 3> domain_data;
|
||||||
|
|
|
@ -279,7 +279,7 @@ public:
|
||||||
// check for runtime support
|
// check for runtime support
|
||||||
virtual bool is_supported() { return false; }
|
virtual bool is_supported() { return false; }
|
||||||
virtual GFXContext required_context() { return GFXContext::None; }
|
virtual GFXContext required_context() { return GFXContext::None; }
|
||||||
virtual ShaderLanguage accepted_shader_language() {}
|
virtual ShaderLanguage accepted_shader_language() { return ShaderLanguage::GLSL; }
|
||||||
virtual const char* get_name() { return nullptr; }
|
virtual const char* get_name() { return nullptr; }
|
||||||
|
|
||||||
virtual bool supports_feature([[maybe_unused]] const GFXFeature feature) { return true; }
|
virtual bool supports_feature([[maybe_unused]] const GFXFeature feature) { return true; }
|
||||||
|
|
|
@ -20,7 +20,9 @@ class GFXVulkanPipeline;
|
||||||
class GFXVulkan : public GFX {
|
class GFXVulkan : public GFX {
|
||||||
public:
|
public:
|
||||||
bool is_supported() { return true; }
|
bool is_supported() { return true; }
|
||||||
GFXContext required_context() { return GFXContext::Vulkan; }const char* get_name() override;
|
ShaderLanguage accepted_shader_language() override { return ShaderLanguage::SPIRV; }
|
||||||
|
GFXContext required_context() { return GFXContext::Vulkan; }
|
||||||
|
const char* get_name() override;
|
||||||
|
|
||||||
bool initialize(const GFXCreateInfo& info) override;
|
bool initialize(const GFXCreateInfo& info) override;
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate
|
||||||
const bool fragment_use_shader_source = info.shaders.fragment_path.empty();
|
const bool fragment_use_shader_source = info.shaders.fragment_path.empty();
|
||||||
|
|
||||||
if (vertex_use_shader_source) {
|
if (vertex_use_shader_source) {
|
||||||
auto& vertex_shader_vector = std::get<std::vector<uint32_t>>(info.shaders.vertex_src);
|
auto& vertex_shader_vector = info.shaders.vertex_src.as_bytecode();
|
||||||
|
|
||||||
vertex_module = createShaderModule(vertex_shader_vector.data(), vertex_shader_vector.size() * sizeof(uint32_t));
|
vertex_module = createShaderModule(vertex_shader_vector.data(), vertex_shader_vector.size() * sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fragment_use_shader_source) {
|
if (fragment_use_shader_source) {
|
||||||
auto& fragment_shader_vector = std::get<std::vector<uint32_t>>(info.shaders.fragment_src);
|
auto& fragment_shader_vector = info.shaders.fragment_src.as_bytecode();
|
||||||
|
|
||||||
fragment_module = createShaderModule(fragment_shader_vector.data(), fragment_shader_vector.size() * sizeof(uint32_t));
|
fragment_module = createShaderModule(fragment_shader_vector.data(), fragment_shader_vector.size() * sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "transform.hpp"
|
#include "transform.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "math.hpp"
|
#include "math.hpp"
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ set(SRC
|
||||||
include/aabb.hpp
|
include/aabb.hpp
|
||||||
include/path.hpp
|
include/path.hpp
|
||||||
include/format.hpp
|
include/format.hpp
|
||||||
|
include/file_utils.hpp
|
||||||
|
|
||||||
src/string_utils.cpp)
|
src/string_utils.cpp)
|
||||||
|
|
||||||
|
|
15
engine/utility/include/file_utils.hpp
Normal file
15
engine/utility/include/file_utils.hpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace file {
|
||||||
|
using Path = std::filesystem::path;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace console {
|
||||||
|
inline void internal_format(std::string& msg, const file::Path& arg) {
|
||||||
|
auto pos = msg.find_first_of("{}");
|
||||||
|
msg.replace(pos, 2, arg.string());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#include "shadercompiler.hpp"
|
#include "shadercompiler.hpp"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
|
#include "file_utils.hpp"
|
||||||
|
|
||||||
bool has_extension(const std::filesystem::path path, const std::string_view extension) {
|
bool has_extension(const std::filesystem::path path, const std::string_view extension) {
|
||||||
return string_contains(path.filename().string(), extension);
|
return string_contains(path.filename().string(), extension);
|
||||||
|
|
Reference in a new issue