Adjust formatting of new code to fit in with the rest of the code

This commit is contained in:
Sebastian Emanuel Dawid 2025-08-27 00:46:35 +02:00
parent 44f8a80ade
commit 54fcbc8220
6 changed files with 28 additions and 14 deletions

View File

@ -2020,12 +2020,14 @@ VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance,
} // autoreleasepool } // autoreleasepool
} }
typedef struct WGPUSurfaceSourceMetalLayer { typedef struct WGPUSurfaceSourceMetalLayer
{
WGPUChainedStruct chain; WGPUChainedStruct chain;
void * layer; void * layer;
} WGPUSurfaceSourceMetalLayer; } WGPUSurfaceSourceMetalLayer;
WGPUSurface _glfwCreateWindowWGPUSurfaceCocoa(WGPUInstance instance, _GLFWwindow* window) { WGPUSurface _glfwCreateWindowWGPUSurfaceCocoa(WGPUInstance instance, _GLFWwindow* window)
{
[window->ns.view setLayer:window->ns.layer]; [window->ns.view setLayer:window->ns.layer];
[window->ns.view setWantsLayer:YES]; [window->ns.view setWantsLayer:YES];

View File

@ -335,12 +335,14 @@ typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const c
typedef struct WGPUInstanceImpl* WGPUInstance; typedef struct WGPUInstanceImpl* WGPUInstance;
typedef struct WGPUSurfaceImpl* WGPUSurface; typedef struct WGPUSurfaceImpl* WGPUSurface;
typedef struct WGPUStringView { typedef struct WGPUStringView
{
char const * data; char const * data;
size_t length; size_t length;
} WGPUStringView; } WGPUStringView;
typedef enum WGPUSType { typedef enum WGPUSType
{
WGPUSType_ShaderSourceSPIRV = 0x00000001, WGPUSType_ShaderSourceSPIRV = 0x00000001,
WGPUSType_ShaderSourceWGSL = 0x00000002, WGPUSType_ShaderSourceWGSL = 0x00000002,
WGPUSType_RenderPassMaxDrawCount = 0x00000003, WGPUSType_RenderPassMaxDrawCount = 0x00000003,
@ -353,12 +355,14 @@ typedef enum WGPUSType {
WGPUSType_Force32 = 0x7FFFFFFF WGPUSType_Force32 = 0x7FFFFFFF
} WGPUSType; } WGPUSType;
typedef struct WGPUChainedStruct { typedef struct WGPUChainedStruct
{
struct WGPUChainedStruct const * next; struct WGPUChainedStruct const * next;
WGPUSType sType; WGPUSType sType;
} WGPUChainedStruct; } WGPUChainedStruct;
typedef struct WGPUSurfaceDescriptor { typedef struct WGPUSurfaceDescriptor
{
WGPUChainedStruct const * nextInChain; WGPUChainedStruct const * nextInChain;
WGPUStringView label; WGPUStringView label;
} WGPUSurfaceDescriptor; } WGPUSurfaceDescriptor;

View File

@ -29,12 +29,14 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
GLFWAPI void glfwSetWGPUInstanceCreateSurfaceAddr(WGPUSurface (*addr)(WGPUInstance, const WGPUSurfaceDescriptor*)) { GLFWAPI void glfwSetWGPUInstanceCreateSurfaceAddr(WGPUSurface (*addr)(WGPUInstance, const WGPUSurfaceDescriptor*))
{
_GLFW_REQUIRE_INIT() _GLFW_REQUIRE_INIT()
_glfw.wgpu.instanceCreateSurface = addr; _glfw.wgpu.instanceCreateSurface = addr;
} }
GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* handle) { GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindow* handle)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL) _GLFW_REQUIRE_INIT_OR_RETURN(NULL)
_GLFWwindow* window = (_GLFWwindow*)handle; _GLFWwindow* window = (_GLFWwindow*)handle;

View File

@ -2562,13 +2562,15 @@ VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance,
return err; return err;
} }
typedef struct WGPUSurfaceSourceWindowsHWND { typedef struct WGPUSurfaceSourceWindowsHWND
{
WGPUChainedStruct chain; WGPUChainedStruct chain;
void * hinstance; void * hinstance;
void * hwnd; void * hwnd;
} WGPUSurfaceSourceWindowsHWND; } WGPUSurfaceSourceWindowsHWND;
WGPUSurface _glfwCreateWindowWGPUSurfaceWin32(WGPUInstance instance, _GLFWwindow *window) { WGPUSurface _glfwCreateWindowWGPUSurfaceWin32(WGPUInstance instance, _GLFWwindow *window)
{
WGPUSurfaceSourceWindowsHWND windowsSurface; WGPUSurfaceSourceWindowsHWND windowsSurface;
windowsSurface.chain.sType = WGPUSType_SurfaceSourceWindowsHWND; windowsSurface.chain.sType = WGPUSType_SurfaceSourceWindowsHWND;
windowsSurface.chain.next = NULL; windowsSurface.chain.next = NULL;

View File

@ -3326,13 +3326,15 @@ VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance,
return err; return err;
} }
typedef struct WGPUSurfaceSourceWaylandSurface { typedef struct WGPUSurfaceSourceWaylandSurface
{
WGPUChainedStruct chain; WGPUChainedStruct chain;
void * display; void * display;
void * surface; void * surface;
} WGPUSurfaceSourceWaylandSurface; } WGPUSurfaceSourceWaylandSurface;
WGPUSurface _glfwCreateWindowWGPUSurfaceWayland(WGPUInstance instance, _GLFWwindow* window) { WGPUSurface _glfwCreateWindowWGPUSurfaceWayland(WGPUInstance instance, _GLFWwindow* window)
{
WGPUSurfaceSourceWaylandSurface waylandSurface; WGPUSurfaceSourceWaylandSurface waylandSurface;
waylandSurface.chain.sType = WGPUSType_SurfaceSourceWaylandSurface; waylandSurface.chain.sType = WGPUSType_SurfaceSourceWaylandSurface;
waylandSurface.chain.next = NULL; waylandSurface.chain.next = NULL;

View File

@ -3282,13 +3282,15 @@ VkResult _glfwCreateWindowSurfaceX11(VkInstance instance,
} }
} }
typedef struct WGPUSurfaceSourceXCBWindow { typedef struct WGPUSurfaceSourceXCBWindow
{
WGPUChainedStruct chain; WGPUChainedStruct chain;
void * connection; void * connection;
uint32_t window; uint32_t window;
} WGPUSurfaceSourceXCBWindow; } WGPUSurfaceSourceXCBWindow;
typedef struct WGPUSurfaceSourceXlibWindow { typedef struct WGPUSurfaceSourceXlibWindow
{
WGPUChainedStruct chain; WGPUChainedStruct chain;
void * display; void * display;
uint64_t window; uint64_t window;