-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
523 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <unistd.h> | ||
|
||
#ifdef _WIN32 | ||
#include <cstdio> | ||
#endif | ||
|
||
namespace merian { | ||
|
||
inline std::string temporary_file() { | ||
#ifdef _WIN32 | ||
return std::tmpnam(nullptr); | ||
#else | ||
// std::tmpnam is deprecated | ||
const char* tem_dir_name = std::getenv("TMPDIR"); | ||
std::string tmp_file_name_template = (tem_dir_name != nullptr) ? tem_dir_name : ""; | ||
#ifdef P_tmpdir | ||
if (tmp_file_name_template.empty()) { | ||
tmp_file_name_template = P_tmpdir; | ||
} | ||
#endif | ||
if (tmp_file_name_template.empty()) { | ||
tmp_file_name_template = "/tmp"; | ||
} | ||
|
||
tmp_file_name_template += "/merianXXXXXX"; | ||
const int fd = mkstemp(const_cast<char*>(tmp_file_name_template.c_str())); | ||
if (fd > 0) { | ||
// immediately close again... | ||
close(fd); | ||
} | ||
|
||
return tmp_file_name_template; | ||
#endif | ||
} | ||
|
||
} // namespace merian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include "merian/vk/shader/shader_compiler.hpp" | ||
#include <map> | ||
|
||
namespace merian { | ||
|
||
// Uses shaderc executable to compile shaders. | ||
class SystemGlslcCompiler : public ShaderCompiler { | ||
public: | ||
// Include paths for the merian-nodes library are automatically added | ||
SystemGlslcCompiler(const ContextHandle& context, | ||
const std::vector<std::string>& include_paths = {}, | ||
const std::map<std::string, std::string>& macro_definitions = {}); | ||
|
||
~SystemGlslcCompiler(); | ||
|
||
std::vector<uint32_t> compile_glsl(const std::string& source, | ||
const std::string& source_name, | ||
const vk::ShaderStageFlagBits shader_kind) override; | ||
|
||
bool available() const override; | ||
|
||
private: | ||
const ContextHandle context; | ||
}; | ||
|
||
} // namespace merian |
Oops, something went wrong.