stories/engine/program/program.cpp

39 lines
874 B
C++

#include "program.h"
Engine::Program::Program():
vertexShader(),
fragmentShader()
{}
std::size_t Engine::Program::codeSize(ShaderType type) const {
switch (type) {
case vertex:
return vertexShader.size();
case fragment:
return fragmentShader.size();
}
return 0;
}
const uint32_t* Engine::Program::code(ShaderType type) const {
switch (type) {
case vertex:
return reinterpret_cast<const uint32_t*>(vertexShader.data());
case fragment:
return reinterpret_cast<const uint32_t*>(fragmentShader.data());
}
return nullptr;
}
void Engine::Program::loadSPIRV(const std::string& path, ShaderType type) {
switch (type) {
case vertex:
vertexShader = readFile(path);
case fragment:
fragmentShader = readFile(path);
}
}