diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-01-22 16:11:33 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-01-22 16:11:33 +0000 |
| commit | 25e9c84b55593da4950b2c9ccac818c606a5321f (patch) | |
| tree | 27f949b82aeeb725025d9099cf7a14767b4a0135 /src/debug_gl.zig | |
| download | glsl-view-25e9c84b55593da4950b2c9ccac818c606a5321f.tar.gz glsl-view-25e9c84b55593da4950b2c9ccac818c606a5321f.zip | |
initial commit
Diffstat (limited to 'src/debug_gl.zig')
| -rw-r--r-- | src/debug_gl.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/debug_gl.zig b/src/debug_gl.zig new file mode 100644 index 0000000..2fdcda0 --- /dev/null +++ b/src/debug_gl.zig @@ -0,0 +1,16 @@ +const c = @import("c.zig"); +const std = @import("std"); +const os = std.os; +const panic = std.debug.panic; +const builtin = @import("builtin"); + +pub const is_on = if (builtin.mode == builtin.Mode.ReleaseFast) c.GL_FALSE else c.GL_TRUE; + +pub fn assertNoError() void { + if (builtin.mode != builtin.Mode.ReleaseFast) { + const err = c.glGetError(); + if (err != c.GL_NO_ERROR) { + panic("GL error: {}\n", .{err}); + } + } +} |
