From a2f8d94a7b4e8cdef8e66914bee7abae5d6eca71 Mon Sep 17 00:00:00 2001 From: Elie Michel Date: Sun, 8 Oct 2023 10:23:37 +0200 Subject: [PATCH] Minor coding style changes --- include/GLFW/glfw3.h | 3 +-- src/webgpu.c | 59 ++++++++++++++++++++------------------------ 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 9a45689f..d7f3f08a 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -6409,8 +6409,7 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* 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 `wgpuSurfaceDrop` (wgpu-native) or - * `wgpuSurfaceRelease` (Dawn/emscripten). + * 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. diff --git a/src/webgpu.c b/src/webgpu.c index 28448722..1b4180ca 100644 --- a/src/webgpu.c +++ b/src/webgpu.c @@ -74,20 +74,19 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo { id metal_layer = NULL; NSWindow* ns_window = glfwGetCocoaWindow(window); - [ns_window.contentView setWantsLayer : YES] ; + [ns_window.contentView setWantsLayer : YES]; metal_layer = [CAMetalLayer layer]; - [ns_window.contentView setLayer : metal_layer] ; + [ns_window.contentView setLayer : metal_layer]; return wgpuInstanceCreateSurface( instance, &(WGPUSurfaceDescriptor){ - .label = NULL, + .label = NULL, .nextInChain = (const WGPUChainedStruct*)&( WGPUSurfaceDescriptorFromMetalLayer) { - .chain = - (WGPUChainedStruct){ - .next = NULL, - .sType = WGPUSType_SurfaceDescriptorFromMetalLayer, + .chain = (WGPUChainedStruct){ + .next = NULL, + .sType = WGPUSType_SurfaceDescriptorFromMetalLayer, }, .layer = metal_layer, }, @@ -100,14 +99,13 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo return wgpuInstanceCreateSurface( instance, &(WGPUSurfaceDescriptor){ - .label = NULL, + .label = NULL, .nextInChain = (const WGPUChainedStruct*)&( WGPUSurfaceDescriptorFromXlibWindow) { - .chain = - (WGPUChainedStruct){ - .next = NULL, - .sType = WGPUSType_SurfaceDescriptorFromXlibWindow, + .chain = (WGPUChainedStruct){ + .next = NULL, + .sType = WGPUSType_SurfaceDescriptorFromXlibWindow, }, .display = x11_display, .window = x11_window, @@ -121,21 +119,19 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo return wgpuInstanceCreateSurface( instance, &(WGPUSurfaceDescriptor){ - .label = NULL, + .label = NULL, .nextInChain = (const WGPUChainedStruct*)&( WGPUSurfaceDescriptorFromWaylandSurface) { - .chain = - (WGPUChainedStruct){ - .next = NULL, - .sType = - WGPUSType_SurfaceDescriptorFromWaylandSurface, -}, -.display = wayland_display, -.surface = wayland_surface, + .chain = (WGPUChainedStruct){ + .next = NULL, + .sType = WGPUSType_SurfaceDescriptorFromWaylandSurface, }, + .display = wayland_display, + .surface = wayland_surface, + }, }); - } + } #elif WGPU_TARGET == WGPU_TARGET_WINDOWS { HWND hwnd = glfwGetWin32Window(window); @@ -143,20 +139,19 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo return wgpuInstanceCreateSurface( instance, &(WGPUSurfaceDescriptor){ - .label = NULL, + .label = NULL, .nextInChain = (const WGPUChainedStruct*)&( WGPUSurfaceDescriptorFromWindowsHWND) { - .chain = - (WGPUChainedStruct){ - .next = NULL, - .sType = WGPUSType_SurfaceDescriptorFromWindowsHWND, + .chain = (WGPUChainedStruct){ + .next = NULL, + .sType = WGPUSType_SurfaceDescriptorFromWindowsHWND, + }, + .hinstance = hinstance, + .hwnd = hwnd, }, - .hinstance = hinstance, - .hwnd = hwnd, - }, - }); - } + }); + } #else #error "Unsupported WGPU_TARGET" #endif