moving stuff around

This commit is contained in:
2026-09-21 01:15:58 -07:00
parent 650b4d813f
commit 4d037e1250
34 changed files with 37 additions and 37 deletions
+56
View File
@@ -0,0 +1,56 @@
#pragma once
#include <memory>
#include <sophia/types.hpp>
#include <span>
#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& fromSPIRV(std::vector<u32> spirv);
Builder& fromSPIRV(std::span<const u32> spirv);
Builder& setStage(ShaderStage shaderStage);
std::unique_ptr<Shader> build();
private:
std::string path;
std::vector<u32> embeddedSpirv;
ShaderStage stage;
bool stageSet = false;
bool precompiled = false;
bool embedded = false;
};
} // namespace sophia