aboutsummaryrefslogtreecommitdiffstats
path: root/src/gl.zig
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 /src/gl.zig
parentdrop libyaml, configure via args (diff)
downloadglsl-view-9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61.tar.gz
glsl-view-9b12a73dc3e4f6cf9ba26b74b8a963a103e42d61.zip
formatting
Diffstat (limited to 'src/gl.zig')
-rw-r--r--src/gl.zig44
1 files changed, 38 insertions, 6 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);