aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-03-16 15:43:38 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-16 15:43:38 +0000
commit9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61 (patch)
tree0d145f8333a4ab3f2b1c895751d7291ccb3c3663
parentdrop libyaml, configure via args (diff)
downloadglsl-view-9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61.tar.gz
glsl-view-9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61.zip
formatting
-rw-r--r--src/gl.zig44
-rw-r--r--src/video.zig4
-rw-r--r--src/video/hap.zig18
3 files changed, 55 insertions, 11 deletions
diff --git a/src/gl.zig b/src/gl.zig
index a24fabf..bb8d3e5 100644
--- a/src/gl.zig
+++ b/src/gl.zig
@@ -73,7 +73,13 @@ pub const Texture = struct {
c.glDeleteTextures(1, &self.id);
}
- pub fn allocate(self: *const Texture, width: i32, height: i32, depth: i32, format: c.GLenum) void {
+ pub fn allocate(
+ self: *const Texture,
+ width: i32,
+ height: i32,
+ depth: i32,
+ format: c.GLenum,
+ ) void {
c.glBindTexture(@intFromEnum(self.type), self.id);
defer c.glBindTexture(@intFromEnum(self.type), 0);
@@ -98,7 +104,14 @@ pub const Texture = struct {
}
}
- pub fn setLayer(self: *const Texture, width: i32, height: i32, layer: i32, format: c.GLenum, data: [*]const u8) void {
+ pub fn setLayer(
+ self: *const Texture,
+ width: i32,
+ height: i32,
+ layer: i32,
+ format: c.GLenum,
+ data: [*]const u8,
+ ) void {
c.glBindTexture(@intFromEnum(self.type), self.id);
defer c.glBindTexture(@intFromEnum(self.type), 0);
@@ -131,7 +144,14 @@ pub const Texture = struct {
}
}
- pub fn setLayerCompressed(self: *const Texture, width: i32, height: i32, layer: i32, format: c.GLenum, data: []const u8) void {
+ pub fn setLayerCompressed(
+ self: *const Texture,
+ width: i32,
+ height: i32,
+ layer: i32,
+ format: c.GLenum,
+ data: []const u8,
+ ) void {
c.glBindTexture(@intFromEnum(self.type), self.id);
defer c.glBindTexture(@intFromEnum(self.type), 0);
@@ -473,7 +493,11 @@ pub const CachedUniform = struct {
value: ?*UniformValue,
location: c.GLint,
- pub fn init(allocator: std.mem.Allocator, shader: ShaderProgram, name: []const u8) !CachedUniform {
+ pub fn init(
+ allocator: std.mem.Allocator,
+ shader: ShaderProgram,
+ name: []const u8,
+ ) !CachedUniform {
var index: c.GLuint = undefined;
const nameZ = try tmpZ(name);
@@ -506,7 +530,11 @@ pub const CachedUniform = struct {
}
// deinit self WITHOUT freeing contained resources
- pub fn move(self: *CachedUniform, to: *CachedUniform, allocator: std.mem.Allocator) CachedUniform {
+ pub fn move(
+ self: *CachedUniform,
+ to: *CachedUniform,
+ allocator: std.mem.Allocator,
+ ) CachedUniform {
to.deinit(allocator);
to.buffer = self.buffer;
to.value = self.value;
@@ -516,7 +544,11 @@ pub const CachedUniform = struct {
return self;
}
- pub fn tryMove(self: *CachedUniform, dest: *CachedUniform, allocator: std.mem.Allocator) bool {
+ pub fn tryMove(
+ self: *CachedUniform,
+ dest: *CachedUniform,
+ allocator: std.mem.Allocator,
+ ) bool {
if (@as(UniformType, self.value.?.*) != dest.value.?.*) return false;
dest.deinit(allocator);
diff --git a/src/video.zig b/src/video.zig
index 9cf50eb..d93a444 100644
--- a/src/video.zig
+++ b/src/video.zig
@@ -27,14 +27,14 @@ pub fn loadVideo(progress_root: std.Progress.Node, filename: [*:0]const u8, text
} else unreachable;
const codec_par = video_stream.codecpar.*;
- std.debug.print("loading codec, size {}x{}, ~{} frames\n", .{ codec_par.width, codec_par.height, video_stream.nb_frames });
var packet = c.av_packet_alloc();
defer c.av_packet_free(&packet);
const allocator = std.heap.c_allocator;
- const is_hap = codec_par.codec_tag == c.MKTAG('H', 'a', 'p', '1') or codec_par.codec_tag == c.MKTAG('H', 'a', 'p', '5');
+ const is_hap = codec_par.codec_tag == c.MKTAG('H', 'a', 'p', '1') or
+ codec_par.codec_tag == c.MKTAG('H', 'a', 'p', '5');
const decoder = if (is_hap and build_config.have_hap)
try hap.HAPDecoder.init(allocator, codec_par)
else
diff --git a/src/video/hap.zig b/src/video/hap.zig
index 70b194a..6cc8716 100644
--- a/src/video/hap.zig
+++ b/src/video/hap.zig
@@ -21,7 +21,10 @@ pub const HAPDecoder = struct {
format: ?c.HapTextureFormat,
gl_format: c.GLenum,
- pub fn init(allocator: std.mem.Allocator, codec_par: c.AVCodecParameters) dec.Errors!*dec.Decoder {
+ pub fn init(
+ allocator: std.mem.Allocator,
+ codec_par: c.AVCodecParameters,
+ ) dec.Errors!*dec.Decoder {
const self = try allocator.create(HAPDecoder);
self.* = .{
@@ -55,7 +58,12 @@ pub const HAPDecoder = struct {
);
}
- fn launchThread(workfn: c.HapDecodeWorkFunction, p: ?*anyopaque, count: c_uint, info: ?*anyopaque) callconv(.C) void {
+ fn launchThread(
+ workfn: c.HapDecodeWorkFunction,
+ p: ?*anyopaque,
+ count: c_uint,
+ info: ?*anyopaque,
+ ) callconv(.C) void {
_ = info;
var i: c_uint = 0;
@@ -64,7 +72,11 @@ pub const HAPDecoder = struct {
}
}
- pub fn processPacket(decoder: *dec.Decoder, packet: *c.AVPacket, texture: ?*const gl.Texture) dec.Errors!bool {
+ pub fn processPacket(
+ decoder: *dec.Decoder,
+ packet: *c.AVPacket,
+ texture: ?*const gl.Texture,
+ ) dec.Errors!bool {
const self: *HAPDecoder = @fieldParentPtr("decoder", decoder);
var textureCount: u32 = undefined;