Starting to unhardcode, pipelines are now created from outside
This commit is contained in:
parent
2b33897b4a
commit
dc3ac2fdf5
16 changed files with 386 additions and 159 deletions
38
engine/program/program.cpp
Normal file
38
engine/program/program.cpp
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue