Starting to unhardcode, pipelines are now created from outside

This commit is contained in:
Blue 2023-10-16 15:47:47 -03:00
parent 2b33897b4a
commit dc3ac2fdf5
Signed by: blue
GPG key ID: 9B203B252A63EE38
16 changed files with 386 additions and 159 deletions

View file

@ -0,0 +1,38 @@
#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);
}
}