diff options
| author | Qwerasd <qwerasd205@users.noreply.github.com> | 2025-06-20 15:16:31 -0600 |
|---|---|---|
| committer | Qwerasd <qwerasd205@users.noreply.github.com> | 2025-06-20 15:18:41 -0600 |
| commit | ea7a91e2ba77da472de2d95a8aec1f1fb8b24ed1 (patch) | |
| tree | 70f19ad0f9995982e0acb23e7b1c91e1233842c4 /pkg | |
| parent | 9d00018f8b48c5623ed9798f23d3f01f62779ed6 (diff) | |
style(renderer): explicit error sets
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/opengl/Texture.zig | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/opengl/Texture.zig b/pkg/opengl/Texture.zig index 833a9bb4d..4a1d61433 100644 --- a/pkg/opengl/Texture.zig +++ b/pkg/opengl/Texture.zig @@ -7,15 +7,16 @@ const glad = @import("glad.zig"); id: c.GLuint, -pub fn active(index: c_uint) !void { +pub fn active(index: c_uint) errors.Error!void { glad.context.ActiveTexture.?(index + c.GL_TEXTURE0); try errors.getError(); } /// Create a single texture. -pub fn create() !Texture { +pub fn create() errors.Error!Texture { var id: c.GLuint = undefined; glad.context.GenTextures.?(1, &id); + try errors.getError(); return .{ .id = id }; } @@ -107,7 +108,7 @@ pub const Binding = struct { glad.context.GenerateMipmap.?(@intFromEnum(b.target)); } - pub fn parameter(b: Binding, name: Parameter, value: anytype) !void { + pub fn parameter(b: Binding, name: Parameter, value: anytype) errors.Error!void { switch (@TypeOf(value)) { c.GLint => glad.context.TexParameteri.?( @intFromEnum(b.target), @@ -129,7 +130,7 @@ pub const Binding = struct { format: Format, typ: DataType, data: ?*const anyopaque, - ) !void { + ) errors.Error!void { glad.context.TexImage2D.?( @intFromEnum(b.target), level, @@ -154,7 +155,7 @@ pub const Binding = struct { format: Format, typ: DataType, data: ?*const anyopaque, - ) !void { + ) errors.Error!void { glad.context.TexSubImage2D.?( @intFromEnum(b.target), level, @@ -178,7 +179,7 @@ pub const Binding = struct { y: c.GLint, width: c.GLsizei, height: c.GLsizei, - ) !void { + ) errors.Error!void { glad.context.CopyTexSubImage2D.?( @intFromEnum(b.target), level, |
