Skip to content

Commit

Permalink
Expose a thinner method over GetRequiredInstanceExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnimuc authored and jayschwa committed Aug 10, 2019
1 parent e3330c4 commit 2a2c95f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/vulkan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@ Return whether the Vulkan loader has been found.
VulkanSupported() = Bool(ccall((:glfwVulkanSupported, libglfw), Cint, ()))

"""
GetRequiredInstanceExtensions()
GetRequiredInstanceExtensions() -> Vector{String}
Return a vector of names of Vulkan instance extensions.
"""
function GetRequiredInstanceExtensions()
count = Ref{Cuint}(0)
ptr = ccall((:glfwGetRequiredInstanceExtensions, libglfw), Ptr{Ptr{Cchar}}, (Ref{Cuint},), count)
return unsafe_string.(unsafe_wrap(Array, ptr, count[]))
ptr = GetRequiredInstanceExtensions(count)
return GC.@preserve ptr unsafe_string.(unsafe_wrap(Array, ptr, count[]))
end

"""
GetRequiredInstanceExtensions(count::Ref) -> Ptr{Cstring}
Return a Cstring pointer that can be directly passed to `VkInstanceCreateInfo`.
"""
function GetRequiredInstanceExtensions(count::Ref)
ptr = ccall((:glfwGetRequiredInstanceExtensions, libglfw), Ptr{Cstring}, (Ref{Cuint},), count)
end

"""
Expand Down

0 comments on commit 2a2c95f

Please sign in to comment.