Skip to content

Commit

Permalink
Harmonize name with GLFW PR
Browse files Browse the repository at this point in the history
Fix #3
  • Loading branch information
eliemichel committed Sep 24, 2024
1 parent 142e87a commit f152c71
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/hello-glfw3webgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
GLFWwindow* window = glfwCreateWindow(640, 480, "Learn WebGPU", NULL, NULL);

// Here we create our WebGPU surface from the window!
WGPUSurface surface = glfwGetWGPUSurface(instance, window);
WGPUSurface surface = glfwCreateWindowWGPUSurface(instance, window);
printf("surface = %p", (void*)surface);

// Terminate GLFW
Expand Down
2 changes: 1 addition & 1 deletion glfw3webgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
# include <GLFW/glfw3native.h>
#endif

WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window) {
WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* window) {
switch (glfwGetPlatform()) {

#ifdef GLFW_EXPOSE_NATIVE_X11
Expand Down
19 changes: 16 additions & 3 deletions glfw3webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,23 @@
extern "C" {
#endif

/**
* Get a WGPUSurface from a GLFW window.
/*! @brief Creates a WebGPU surface for the specified window.
*
* This function creates a WGPUSurface object for the specified window.
*
* If the surface cannot be created, this function returns `NULL`.
*
* It is the responsibility of the caller to destroy the window surface. The
* window surface must be destroyed using `wgpuSurfaceRelease`.
*
* @param[in] instance The WebGPU instance to create the surface in.
* @param[in] window The window to create the surface for.
* @return The handle of the surface. This is set to `NULL` if an error
* occurred.
*
* @ingroup webgpu
*/
WGPUSurface glfwGetWGPUSurface(WGPUInstance instance, GLFWwindow* window);
WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* window);

#ifdef __cplusplus
}
Expand Down

0 comments on commit f152c71

Please sign in to comment.