aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-11-11 11:12:24 +0000
committers-ol <s+removethis@s-ol.nu>2021-11-11 11:30:45 +0000
commite397acef3d6d6902a5d0a90abb1c78b3cd6cb326 (patch)
tree432a4bd9eeb152e1195a5149a6421b4968006953 /src
parentbetter pragma error messages (diff)
downloadglsl-view-e397acef3d6d6902a5d0a90abb1c78b3cd6cb326.tar.gz
glsl-view-e397acef3d6d6902a5d0a90abb1c78b3cd6cb326.zip
remove/ignore unused variables
Diffstat (limited to 'src')
-rw-r--r--src/control.zig5
-rw-r--r--src/debug_gl.zig3
-rw-r--r--src/gl.zig1
-rw-r--r--src/main.zig11
-rw-r--r--src/output.zig8
5 files changed, 22 insertions, 6 deletions
diff --git a/src/control.zig b/src/control.zig
index 0d3356b..c282e7a 100644
--- a/src/control.zig
+++ b/src/control.zig
@@ -173,6 +173,8 @@ pub const ControlServer = struct {
msg: c.lo_message,
userdata: ?*c_void,
) callconv(.C) c_int {
+ _ = msg;
+
const self = @ptrCast(*ControlServer, @alignCast(@alignOf(ControlServer), userdata.?));
const path = _path[0..c.strlen(_path)];
const types = _types[0..@intCast(u32, argc)];
@@ -189,10 +191,13 @@ pub const ControlServer = struct {
}
fn handle_bundle_start(time: c.lo_timetag, userdata: ?*c_void) callconv(.C) c_int {
+ _ = time;
+ _ = userdata;
return 1;
}
fn handle_bundle_end(userdata: ?*c_void) callconv(.C) c_int {
+ _ = userdata;
return 1;
}
};
diff --git a/src/debug_gl.zig b/src/debug_gl.zig
index 03078df..eb6276a 100644
--- a/src/debug_gl.zig
+++ b/src/debug_gl.zig
@@ -15,6 +15,9 @@ fn glDebugMessage(
_message: [*c]const u8,
user: ?*const c_void,
) callconv(.C) void {
+ _ = id;
+ _ = user;
+
switch (typ) {
c.GL_DEBUG_TYPE_ERROR,
c.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR,
diff --git a/src/gl.zig b/src/gl.zig
index 4c91b50..9f437c5 100644
--- a/src/gl.zig
+++ b/src/gl.zig
@@ -459,6 +459,7 @@ pub const FramebufferObject = struct {
}
pub fn unbind(self: FramebufferObject) void {
+ _ = self;
c.glBindFramebuffer(c.GL_FRAMEBUFFER, 0);
}
diff --git a/src/main.zig b/src/main.zig
index cf85732..460b6a8 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -12,7 +12,7 @@ const c_allocator = @import("std").heap.c_allocator;
var window: *c.GLFWwindow = undefined;
fn errorCallback(err: c_int, description: [*c]const u8) callconv(.C) void {
- panic("Error: {}\n", .{description});
+ panic("Error {}: {}\n", .{err, description});
}
pub fn main() !void {
@@ -59,7 +59,7 @@ pub fn main() !void {
var outputs = try std.ArrayList(*out.Output).initCapacity(&arena.allocator, config.outputs.len);
defer outputs.deinit();
- for (config.outputs) |output_config, i| {
+ for (config.outputs) |output_config| {
try outputs.append(out.Output.create(&arena.allocator, output_config, &constants));
}
defer for (outputs.items) |output| {
@@ -117,12 +117,11 @@ pub fn main() !void {
c.glClear(c.GL_COLOR_BUFFER_BIT);
const now_time = c.glfwGetTime();
- const elapsed = now_time - prev_time;
prev_time = now_time;
const stat = try shader_file.stat();
if (stat.mtime > last_stat.mtime) {
- try reloadShader(&main_program, shader_file, config.fragment, stat.size);
+ try reloadShader(&main_program, config.fragment, stat.size);
try cache.refresh();
last_stat = stat;
}
@@ -181,7 +180,7 @@ fn loadFile(writer: anytype, dir: []const u8, filename: []const u8) !void {
var include_path = parts.next().?;
if (include_path[0] != '"' or include_path[include_path.len - 1] != '"') {
std.debug.warn("{}:{}: Invalid #pragma include\n", .{file_path, line_number});
- std.debug.warn("{}:{}: {}\n", .{line});
+ std.debug.warn("{}:{}: {}\n", .{file_path, line_number, line});
continue;
}
include_path = include_path[1 .. include_path.len - 1];
@@ -191,7 +190,7 @@ fn loadFile(writer: anytype, dir: []const u8, filename: []const u8) !void {
continue;
} else {
std.debug.warn("{}:{}: Unknown #pragma directive '{}'\n", .{file_path, line_number, pragma});
- std.debug.warn("{}:{}: {}\n", .{line});
+ std.debug.warn("{}:{}: {}\n", .{file_path, line_number, line});
}
}
diff --git a/src/output.zig b/src/output.zig
index 2aa6802..f4c33d7 100644
--- a/src/output.zig
+++ b/src/output.zig
@@ -125,6 +125,11 @@ pub const WindowOutput = struct {
const userptr = c.glfwGetWindowUserPointer(win).?;
const self = @ptrCast(*WindowOutput, @alignCast(@alignOf(WindowOutput), userptr));
+ _ = self;
+ _ = scancode;
+ _ = action;
+ _ = mods;
+
switch (key) {
// c.GLFW_KEY_F => // toggle fullscreen
// c.GLFW_KEY_LEFT => // cycle through monitors
@@ -137,5 +142,8 @@ pub const WindowOutput = struct {
const userptr = c.glfwGetWindowUserPointer(win).?;
const self = @ptrCast(*WindowOutput, @alignCast(@alignOf(WindowOutput), userptr));
self.resized = true;
+
+ _ = width;
+ _ = height;
}
};