diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-03-16 15:43:38 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-16 15:43:38 +0000 |
| commit | 9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61 (patch) | |
| tree | 0d145f8333a4ab3f2b1c895751d7291ccb3c3663 /src/gl.zig | |
| parent | drop libyaml, configure via args (diff) | |
| download | glsl-view-9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61.tar.gz glsl-view-9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61.zip | |
formatting
Diffstat (limited to 'src/gl.zig')
| -rw-r--r-- | src/gl.zig | 44 |
1 files changed, 38 insertions, 6 deletions
@@ -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); |
