Big code changes

This commit is contained in:
2026-08-23 20:46:09 -07:00
parent 7243e13df5
commit 0cb0628101
25 changed files with 1645 additions and 227 deletions
+51
View File
@@ -0,0 +1,51 @@
#pragma once
#include <memory>
#include <sophia/types.hpp>
#include <string>
#include <vector>
namespace sophia {
enum class ShaderStage { VERTEX, FRAGMENT, COMPUTE };
class Shader {
public:
class Builder;
Shader(const Shader&) = delete;
Shader& operator=(const Shader&) = delete;
~Shader() = default;
const std::vector<u32>& getSpirv() const { return this->spirv; }
ShaderStage getStage() const { return this->stage; }
private:
Shader() = default;
void compile(const std::string& path, ShaderStage shaderStage);
void load(const std::string& path, ShaderStage shaderStage);
ShaderStage stage;
std::vector<u32> spirv;
};
class Shader::Builder {
public:
Builder() = default;
Builder& fromGLSL(const std::string& path);
Builder& fromSPIRV(const std::string& path);
Builder& setStage(ShaderStage shaderStage);
std::unique_ptr<Shader> build();
private:
std::string path;
ShaderStage stage;
bool stageSet = false;
bool precompiled = false;
};
} // namespace sophia