aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2026-04-10 13:15:59 +0000
committers-ol <s+removethis@s-ol.nu>2026-04-10 13:15:59 +0000
commit33bdf463a081ec199516db006977cbc0f1d2182f (patch)
tree4b8611eedc9c7ddd86d18f80dd3fdbfad4945327 /src
parentpipe raw video to stdout (diff)
downloadglsl-view-33bdf463a081ec199516db006977cbc0f1d2182f.tar.gz
glsl-view-33bdf463a081ec199516db006977cbc0f1d2182f.zip
more TSV logging
Diffstat (limited to 'src')
-rw-r--r--src/tsv.zig40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/tsv.zig b/src/tsv.zig
index cc6d6d6..a199b90 100644
--- a/src/tsv.zig
+++ b/src/tsv.zig
@@ -22,7 +22,7 @@ fn get_or_init_client() *c.GlClient {
2000,
2000,
2000,
- ) orelse unreachable;
+ ) orelse @panic("failed to init tsv gl_client");
}
return global_client.?;
@@ -83,9 +83,9 @@ pub const TSVSource = struct {
2000,
2000,
2000,
- ) orelse return error.tsvError;
+ ) orelse return error.tsvErrorCreateClient;
- const guard = c.gl_client_find_image_data(client, self.name, false) orelse return error.notFound;
+ const guard = c.gl_client_find_image_data(client, self.name, false) orelse return error.tsvDataNotFound;
defer c.gl_client_image_data_guard_destroy(guard);
const metadata = c.gl_client_image_data_guard_read(guard) orelse return error.tsvError;
@@ -97,15 +97,16 @@ pub const TSVSource = struct {
);
while (!self.thread.quit) {
- self.update(client);
+ try self.update(client);
c.glFlush();
try std.Thread.yield();
}
}
- fn update(self: *TSVSource, client: *c.GlClient) void {
+ fn update(self: *TSVSource, client: *c.GlClient) !void {
if (!self.stream.shouldStep()) return;
- _ = c.gl_client_recv_image(
+
+ switch (c.gl_client_recv_image(
client,
self.name.ptr,
self.source.texture.id,
@@ -113,7 +114,12 @@ pub const TSVSource = struct {
false,
0,
null,
- );
+ )) {
+ c.RequiresUpdate, c.Found => {},
+ c.NotFound => return error.tsvRecvNotFound,
+ c.Error => return error.tsvRecvError,
+ else => unreachable,
+ }
}
};
@@ -129,7 +135,7 @@ pub const TSVOutput = struct {
config: *const Config,
allocator: std.mem.Allocator,
constants: *gl.Constants,
- ) *Output {
+ ) !*Output {
const self = allocator.create(TSVOutput) catch unreachable;
self.* = .{
@@ -140,14 +146,19 @@ pub const TSVOutput = struct {
.config = config,
};
- _ = c.gl_client_init_image(
+ switch (c.gl_client_init_image(
get_or_init_client(),
config.name,
@intCast(constants.config.width),
@intCast(constants.config.height),
c.R8G8B8A8,
true,
- );
+ )) {
+ c.RequiresUpdate, c.Found => {},
+ c.NotFound => return error.tsvCreateNotFound,
+ c.Error => return error.tsvCreateError,
+ else => unreachable,
+ }
return &self.output;
}
@@ -162,7 +173,7 @@ pub const TSVOutput = struct {
var fbo: c.GLint = undefined;
c.glGetIntegerv(c.GL_DRAW_FRAMEBUFFER_BINDING, &fbo);
- _ = c.gl_client_send_image(
+ switch (c.gl_client_send_image(
get_or_init_client(),
self.config.name,
texture_id,
@@ -170,7 +181,12 @@ pub const TSVOutput = struct {
false,
@intCast(fbo),
null,
- );
+ )) {
+ 1 => {},
+ 0 => std.debug.print("tsv send: no remote image\n", .{}),
+ else => |e| std.debug.print("tsv send: error {}\n", .{e}),
+ }
+
return false;
}