mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21:14:35 +00:00
Minor coding style changes
This commit is contained in:
parent
1ae5376a31
commit
a2f8d94a7b
@ -6409,8 +6409,7 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
|
|||||||
* If the surface cannot be created, this function returns `NULL`.
|
* If the surface cannot be created, this function returns `NULL`.
|
||||||
*
|
*
|
||||||
* It is the responsibility of the caller to destroy the window surface. The
|
* It is the responsibility of the caller to destroy the window surface. The
|
||||||
* window surface must be destroyed using `wgpuSurfaceDrop` (wgpu-native) or
|
* window surface must be destroyed using `wgpuSurfaceRelease`.
|
||||||
* `wgpuSurfaceRelease` (Dawn/emscripten).
|
|
||||||
*
|
*
|
||||||
* @param[in] instance The WebGPU instance to create the surface in.
|
* @param[in] instance The WebGPU instance to create the surface in.
|
||||||
* @param[in] window The window to create the surface for.
|
* @param[in] window The window to create the surface for.
|
||||||
|
59
src/webgpu.c
59
src/webgpu.c
@ -74,20 +74,19 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo
|
|||||||
{
|
{
|
||||||
id metal_layer = NULL;
|
id metal_layer = NULL;
|
||||||
NSWindow* ns_window = glfwGetCocoaWindow(window);
|
NSWindow* ns_window = glfwGetCocoaWindow(window);
|
||||||
[ns_window.contentView setWantsLayer : YES] ;
|
[ns_window.contentView setWantsLayer : YES];
|
||||||
metal_layer = [CAMetalLayer layer];
|
metal_layer = [CAMetalLayer layer];
|
||||||
[ns_window.contentView setLayer : metal_layer] ;
|
[ns_window.contentView setLayer : metal_layer];
|
||||||
return wgpuInstanceCreateSurface(
|
return wgpuInstanceCreateSurface(
|
||||||
instance,
|
instance,
|
||||||
&(WGPUSurfaceDescriptor){
|
&(WGPUSurfaceDescriptor){
|
||||||
.label = NULL,
|
.label = NULL,
|
||||||
.nextInChain =
|
.nextInChain =
|
||||||
(const WGPUChainedStruct*)&(
|
(const WGPUChainedStruct*)&(
|
||||||
WGPUSurfaceDescriptorFromMetalLayer) {
|
WGPUSurfaceDescriptorFromMetalLayer) {
|
||||||
.chain =
|
.chain = (WGPUChainedStruct){
|
||||||
(WGPUChainedStruct){
|
.next = NULL,
|
||||||
.next = NULL,
|
.sType = WGPUSType_SurfaceDescriptorFromMetalLayer,
|
||||||
.sType = WGPUSType_SurfaceDescriptorFromMetalLayer,
|
|
||||||
},
|
},
|
||||||
.layer = metal_layer,
|
.layer = metal_layer,
|
||||||
},
|
},
|
||||||
@ -100,14 +99,13 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo
|
|||||||
return wgpuInstanceCreateSurface(
|
return wgpuInstanceCreateSurface(
|
||||||
instance,
|
instance,
|
||||||
&(WGPUSurfaceDescriptor){
|
&(WGPUSurfaceDescriptor){
|
||||||
.label = NULL,
|
.label = NULL,
|
||||||
.nextInChain =
|
.nextInChain =
|
||||||
(const WGPUChainedStruct*)&(
|
(const WGPUChainedStruct*)&(
|
||||||
WGPUSurfaceDescriptorFromXlibWindow) {
|
WGPUSurfaceDescriptorFromXlibWindow) {
|
||||||
.chain =
|
.chain = (WGPUChainedStruct){
|
||||||
(WGPUChainedStruct){
|
.next = NULL,
|
||||||
.next = NULL,
|
.sType = WGPUSType_SurfaceDescriptorFromXlibWindow,
|
||||||
.sType = WGPUSType_SurfaceDescriptorFromXlibWindow,
|
|
||||||
},
|
},
|
||||||
.display = x11_display,
|
.display = x11_display,
|
||||||
.window = x11_window,
|
.window = x11_window,
|
||||||
@ -121,21 +119,19 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo
|
|||||||
return wgpuInstanceCreateSurface(
|
return wgpuInstanceCreateSurface(
|
||||||
instance,
|
instance,
|
||||||
&(WGPUSurfaceDescriptor){
|
&(WGPUSurfaceDescriptor){
|
||||||
.label = NULL,
|
.label = NULL,
|
||||||
.nextInChain =
|
.nextInChain =
|
||||||
(const WGPUChainedStruct*)&(
|
(const WGPUChainedStruct*)&(
|
||||||
WGPUSurfaceDescriptorFromWaylandSurface) {
|
WGPUSurfaceDescriptorFromWaylandSurface) {
|
||||||
.chain =
|
.chain = (WGPUChainedStruct){
|
||||||
(WGPUChainedStruct){
|
.next = NULL,
|
||||||
.next = NULL,
|
.sType = WGPUSType_SurfaceDescriptorFromWaylandSurface,
|
||||||
.sType =
|
|
||||||
WGPUSType_SurfaceDescriptorFromWaylandSurface,
|
|
||||||
},
|
|
||||||
.display = wayland_display,
|
|
||||||
.surface = wayland_surface,
|
|
||||||
},
|
},
|
||||||
|
.display = wayland_display,
|
||||||
|
.surface = wayland_surface,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#elif WGPU_TARGET == WGPU_TARGET_WINDOWS
|
#elif WGPU_TARGET == WGPU_TARGET_WINDOWS
|
||||||
{
|
{
|
||||||
HWND hwnd = glfwGetWin32Window(window);
|
HWND hwnd = glfwGetWin32Window(window);
|
||||||
@ -143,20 +139,19 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo
|
|||||||
return wgpuInstanceCreateSurface(
|
return wgpuInstanceCreateSurface(
|
||||||
instance,
|
instance,
|
||||||
&(WGPUSurfaceDescriptor){
|
&(WGPUSurfaceDescriptor){
|
||||||
.label = NULL,
|
.label = NULL,
|
||||||
.nextInChain =
|
.nextInChain =
|
||||||
(const WGPUChainedStruct*)&(
|
(const WGPUChainedStruct*)&(
|
||||||
WGPUSurfaceDescriptorFromWindowsHWND) {
|
WGPUSurfaceDescriptorFromWindowsHWND) {
|
||||||
.chain =
|
.chain = (WGPUChainedStruct){
|
||||||
(WGPUChainedStruct){
|
.next = NULL,
|
||||||
.next = NULL,
|
.sType = WGPUSType_SurfaceDescriptorFromWindowsHWND,
|
||||||
.sType = WGPUSType_SurfaceDescriptorFromWindowsHWND,
|
},
|
||||||
|
.hinstance = hinstance,
|
||||||
|
.hwnd = hwnd,
|
||||||
},
|
},
|
||||||
.hinstance = hinstance,
|
});
|
||||||
.hwnd = hwnd,
|
}
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#error "Unsupported WGPU_TARGET"
|
#error "Unsupported WGPU_TARGET"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user