mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user