9#include <unordered_map>
41 [[nodiscard]]
static std::shared_ptr<Shader>
create(
const Descriptor& desc);
46 const std::string&
get_name() const noexcept;
59 Shader(const Descriptor& desc);
60 virtual ~
Shader() = default;
65 std::vector<uint32_t>
get_code(std::filesystem::path path);
76 void compile(const std::filesystem::path& sourcePath, const std::filesystem::path& targetPath,
Stage stage);
83 void parse(const std::vector<uint32_t>& buf);
86 std::
string entry_point_;
93 std::filesystem::path
path;
着色器阶段.
Definition: Shader.h:20
Stage get_stage() const noexcept
获取阶段.
Definition: Shader.cpp:153
void parse(const std::vector< uint32_t > &buf)
将 GLSL 编译为 SPIR-V.
Definition: Shader.cpp:233
Stage
着色器阶段.
Definition: Shader.h:26
static std::shared_ptr< Shader > create(const Descriptor &desc)
创建着色器阶段.
Definition: Shader.cpp:125
const std::string & get_entry_point() const noexcept
获取入口点名称.
Definition: Shader.cpp:148
std::vector< uint32_t > get_code(std::filesystem::path path)
获取 SPIR-V 代码, 若未编译则先进行编译.
Definition: Shader.cpp:162
void compile(const std::filesystem::path &sourcePath, const std::filesystem::path &targetPath, Stage stage)
将 GLSL 编译为 SPIR-V.
Definition: Shader.cpp:192
const std::string & get_name() const noexcept
获取名称.
Definition: Shader.cpp:143
std::filesystem::path path
GLSL 源码文件或 SPIR-V 文件路径.
Definition: Shader.h:93