mirror of
https://github.com/glfw/glfw.git
synced 2025-08-30 18:41:48 +00:00
Add WebGPU support for Windows
This commit is contained in:
parent
205bf6c768
commit
4cbb4db70c
@ -669,7 +669,8 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowWin32,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsWin32,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportWin32,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceWin32
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceWin32,
|
||||
.createWindowWGPUSurface = _glfwCreateWindowWGPUSurfaceWin32
|
||||
};
|
||||
|
||||
*platform = win32;
|
||||
|
@ -544,6 +544,8 @@ void _glfwGetRequiredInstanceExtensionsWin32(char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
WGPUSurface _glfwCreateWindowWGPUSurfaceWin32(WGPUInstance instance, _GLFWwindow* window);
|
||||
|
||||
void _glfwFreeMonitorWin32(_GLFWmonitor* monitor);
|
||||
void _glfwGetMonitorPosWin32(_GLFWmonitor* monitor, int* xpos, int* ypos);
|
||||
void _glfwGetMonitorContentScaleWin32(_GLFWmonitor* monitor, float* xscale, float* yscale);
|
||||
|
@ -2562,6 +2562,26 @@ VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance,
|
||||
return err;
|
||||
}
|
||||
|
||||
typedef struct WGPUSurfaceSourceWindowsHWND {
|
||||
WGPUChainedStruct chain;
|
||||
void * hinstance;
|
||||
void * hwnd;
|
||||
} WGPUSurfaceSourceWindowsHWND;
|
||||
|
||||
WGPUSurface _glfwCreateWindowWGPUSurfaceWin32(WGPUInstance instance, _GLFWwindow *window) {
|
||||
WGPUSurfaceSourceWindowsHWND windowsSurface;
|
||||
windowsSurface.chain.sType = WGPUSType_SurfaceSourceWindowsHWND;
|
||||
windowsSurface.chain.next = NULL;
|
||||
windowsSurface.hinstance = _glfw.win32.instance;
|
||||
windowsSurface.hwnd = window->win32.handle;
|
||||
|
||||
WGPUSurfaceDescriptor surfaceDescriptor;
|
||||
surfaceDescriptor.nextInChain = &windowsSurface.chain;
|
||||
surfaceDescriptor.label = (WGPUStringView){ NULL, SIZE_MAX };
|
||||
|
||||
return wgpuInstanceCreateSurface(instance, &surfaceDescriptor);
|
||||
}
|
||||
|
||||
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user