diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-07-27 21:46:48 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-07-27 21:46:48 +0000 |
| commit | 6ad56662c4440aa77ccef0f9e28582b35a20e764 (patch) | |
| tree | 69072ba9452bf4fb51e18f1e5a070d1a4066e132 /src/renderdoc.zig | |
| parent | add libav StreamSource (diff) | |
| download | glsl-view-renderdoc.tar.gz glsl-view-renderdoc.zip | |
add optional renderdoc integrationrenderdoc
Diffstat (limited to '')
| -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); + } +} |
