Archived
1
Fork 0

Merge branch 'master' of https://github.com/redstrate/prism into master

This commit is contained in:
redstrate 2020-09-20 22:39:16 -04:00
commit dc3cbfeab8
8 changed files with 26 additions and 12 deletions

View file

@ -8,6 +8,7 @@
#include <filesystem>
#include "log.hpp"
#include "file_utils.hpp"
namespace file {
enum class Domain {
@ -103,8 +104,6 @@ namespace file {
std::vector<std::byte> data;
};
using Path = std::filesystem::path;
/** Sets the domain path to a location in the filesystem.
@param domain The domain type.
@param mode The access mode.
@ -134,11 +133,5 @@ namespace file {
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;

View file

@ -279,7 +279,7 @@ public:
// check for runtime support
virtual bool is_supported() { return false; }
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 bool supports_feature([[maybe_unused]] const GFXFeature feature) { return true; }

View file

@ -20,7 +20,9 @@ class GFXVulkanPipeline;
class GFXVulkan : public GFX {
public:
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;

View file

@ -547,7 +547,7 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate
const bool fragment_use_shader_source = info.shaders.fragment_path.empty();
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));
}
@ -559,7 +559,7 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate
}
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));
}

View file

@ -1,6 +1,7 @@
#include "transform.hpp"
#include <cmath>
#include <limits>
#include "math.hpp"

View file

@ -7,6 +7,7 @@ set(SRC
include/aabb.hpp
include/path.hpp
include/format.hpp
include/file_utils.hpp
src/string_utils.cpp)

View 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());
}
}

View file

@ -1,9 +1,11 @@
#include <fstream>
#include <sstream>
#include <filesystem>
#include "shadercompiler.hpp"
#include "log.hpp"
#include "string_utils.hpp"
#include "file_utils.hpp"
bool has_extension(const std::filesystem::path path, const std::string_view extension) {
return string_contains(path.filename().string(), extension);