Skip to content

Add bindings for glfw Vulkan functions#39

Merged
hazeycode merged 1 commit intozig-gamedev:mainfrom
Fincap:vulkan-bindings
Sep 14, 2025
Merged

Add bindings for glfw Vulkan functions#39
hazeycode merged 1 commit intozig-gamedev:mainfrom
Fincap:vulkan-bindings

Conversation

@Fincap
Copy link
Contributor

@Fincap Fincap commented Sep 14, 2025

Added bindings for remaining unimplemented Vulkan functions:

  • glfwGetInstanceProcAddress
  • glfwGetPhysicalDevicePresentationSupport
  • glfwCreateWindowSurface

Library user will need to supply their own instance, device, surface, and allocation callback pointers. The types for Vulkan objects VkInstance and VkPhysicalDevice are just aliased to ?*const anyopaque, and the types for Vulkan structs VkAllocationCallbacks and VkSurfaceKHR were aliased to anyopaque. The main intent of these aliases is to provide clarity on the expected Vulkan types and ensure the bindings function signatures are mostly aligned with the glfw API (https://www.glfw.org/docs/3.3/group__vulkan.html).

I've tested getInstanceProcAddress to confirm that it retrieves function pointers correctly, and that those function pointers can be called correctly when cast to the command signature, however I didn't go all the way to creating a new Vulkan instance because I don't have the SDK set up on my current computer.

Fixes #18

@hazeycode hazeycode requested a review from Copilot September 14, 2025 10:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Zig bindings for three remaining GLFW Vulkan functions to enable Vulkan surface creation and function pointer retrieval. These bindings provide a complete interface for using GLFW with Vulkan in Zig applications.

  • Added type aliases for Vulkan objects (VkInstance, VkPhysicalDevice, VkAllocationCallbacks, VkSurfaceKHR)
  • Implemented bindings for glfwGetInstanceProcAddress, glfwGetPhysicalDevicePresentationSupport, and glfwCreateWindowSurface
  • Added proper error handling for all three functions following the existing pattern

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hazeycode hazeycode merged commit 3a3f0d2 into zig-gamedev:main Sep 14, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no binding for glfwGetInstanceProcAddress

3 participants