This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

ghostty / pkg / opengl / errors.zig
967 B 33 lines
1const std = @import("std"); 2const c = @import("c.zig").c; 3const glad = @import("glad.zig"); 4 5pub const Error = error{ 6 InvalidEnum, 7 InvalidValue, 8 InvalidOperation, 9 InvalidFramebufferOperation, 10 OutOfMemory, 11 12 Unknown, 13}; 14 15/// getError returns the error (if any) from the last OpenGL operation. 16pub fn getError() Error!void { 17 return switch (glad.context.GetError.?()) { 18 c.GL_NO_ERROR => {}, 19 c.GL_INVALID_ENUM => Error.InvalidEnum, 20 c.GL_INVALID_VALUE => Error.InvalidValue, 21 c.GL_INVALID_OPERATION => Error.InvalidOperation, 22 c.GL_INVALID_FRAMEBUFFER_OPERATION => Error.InvalidFramebufferOperation, 23 c.GL_OUT_OF_MEMORY => Error.OutOfMemory, 24 else => Error.Unknown, 25 }; 26} 27 28/// mustError just calls getError but always results in an error being returned. 29/// If getError has no error, then Unknown is returned. 30pub fn mustError() Error!void { 31 try getError(); 32 return Error.Unknown; 33}