OpenGL backend: implement render passes (#73)

Probably not the most efficient implementation, but works.

Issues:

* Doesn't seem to render until the second frame. No clue why, yet.
* Hardcoded 640x480 in more places.
* Creates new FBOs for every subpass every frame. Should be done at Framebuffer build or CommandBuffer build time.
This commit is contained in:
Kai Ninomiya
2017-07-11 17:49:20 -07:00
committed by GitHub
parent 3df6441a8c
commit e66fcd8b0e
6 changed files with 132 additions and 15 deletions

View File

@@ -19,7 +19,9 @@
namespace backend {
namespace opengl {
void Init(void* (*getProc)(const char*), nxtProcTable* procs, nxtDevice* device);
void HACKCLEAR();
void HACKCLEAR(nxtDevice device);
void InitBackbuffer(nxtDevice device);
void CommitBackbuffer(nxtDevice device);
}
}
@@ -42,11 +44,18 @@ namespace utils {
void GetProcAndDevice(nxtProcTable* procs, nxtDevice* device) override {
glfwMakeContextCurrent(window);
backend::opengl::Init(reinterpret_cast<void*(*)(const char*)>(glfwGetProcAddress), procs, device);
backendDevice = *device;
backend::opengl::InitBackbuffer(backendDevice);
}
void SwapBuffers() override {
backend::opengl::CommitBackbuffer(backendDevice);
glfwSwapBuffers(window);
backend::opengl::HACKCLEAR();
backend::opengl::HACKCLEAR(backendDevice);
}
private:
nxtDevice backendDevice = nullptr;
};
BackendBinding* CreateOpenGLBinding() {