glfw: Change error unions into normal returns, in accordance with the new guarantee to never encounter 'GLFW_NOT_INITIALIZED', and update tests

This commit is contained in:
InKryption 2021-11-22 20:21:46 +01:00 committed by Stephen Gutekanst
parent 88e0d37325
commit b35a7b4fad
3 changed files with 40 additions and 51 deletions

View file

@ -24,8 +24,7 @@ const internal_debug = @import("internal_debug.zig");
/// Possible errors include glfw.Error.NotInitialized.
///
/// @thread_safety This function may be called from any thread.
// TODO: Consider whether to retain error here, despite us guaranteeing the absence of 'GLFW_NOT_INITIALIZED'
pub inline fn vulkanSupported() Error!bool {
pub inline fn vulkanSupported() bool {
internal_debug.assertInitialized();
const supported = c.glfwVulkanSupported();
getError() catch unreachable; // Only error 'GLFW_NOT_INITIALIZED' is impossible
@ -234,7 +233,7 @@ test "vulkanSupported" {
try glfw.init(.{});
defer glfw.terminate();
_ = try glfw.vulkanSupported();
_ = glfw.vulkanSupported();
}
test "getRequiredInstanceExtensions" {