diff options
Diffstat (limited to 'src/renderdoc.zig')
| -rw-r--r-- | src/renderdoc.zig | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/renderdoc.zig b/src/renderdoc.zig new file mode 100644 index 0000000..9c3e80d --- /dev/null +++ b/src/renderdoc.zig @@ -0,0 +1,42 @@ +const c = @import("c.zig"); + +var rdoc_api: ?*c.RENDERDOC_API_1_1_2 = null; + +pub fn init() void { + const maybe_mod = c.dlopen("librenderdoc.so", c.RTLD_NOW | c.RTLD_NOLOAD); + if (maybe_mod) |mod| { + const getAPI: c.pRENDERDOC_GetAPI = @ptrCast(c.dlsym(mod, "RENDERDOC_GetAPI")); + const ret = getAPI.?(c.eRENDERDOC_API_Version_1_1_2, @ptrCast(&rdoc_api)); + if (ret != 1) unreachable; + } +} + +pub fn startCapture(glfwWindow: *c.GLFWwindow) void { + _ = glfwWindow; + if (rdoc_api) |api| { + // const window = c.glfwGetWaylandWindow(glfwWindow); + // const context = c.glfwGetEGLContext(glfwWindow); + // api.StartFrameCapture.?(context, window); + _ = api.StartFrameCapture.?(null, null); + } +} + +pub fn endCapture(glfwWindow: *c.GLFWwindow) void { + _ = glfwWindow; + if (rdoc_api) |api| { + // const window = c.glfwGetWaylandWindow(glfwWindow); + // const context = c.glfwGetEGLContext(glfwWindow); + // _ = api.EndFrameCapture.?(context, window); + _ = api.StartFrameCapture.?(null, null); + } +} + +pub fn discardCapture(glfwWindow: *c.GLFWwindow) void { + _ = glfwWindow; + if (rdoc_api) |api| { + // const window = c.glfwGetWaylandWindow(glfwWindow); + // const context = c.glfwGetEGLContext(glfwWindow); + // _ = api.DiscardFrameCapture.?(context, window); + _ = api.DiscardFrameCapture.?(null, null); + } +} |
