Compare commits

..

1 Commits

Author SHA1 Message Date
Sebastian Dawid
379e5d1617
Merge b0b39d678e into 8e15281d34 2025-09-29 09:42:46 +00:00
4 changed files with 3 additions and 35 deletions

View File

@ -73,16 +73,8 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
WGPUSurface surface = glfwCreateWindowWGPUSurface(instance, window);
if (!surface)
{
fprintf(stderr, "Error: Failed to create WebGPU surface.\n");
wgpuInstanceRelease(instance);
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_FAILURE);
}
WGPUAdapter adapter; WGPUAdapter adapter;
WGPUSurface surface = glfwCreateWindowWGPUSurface(instance, window);
WGPUDevice device; WGPUDevice device;
WGPUQueue queue; WGPUQueue queue;
bool success = false; bool success = false;

View File

@ -6536,19 +6536,6 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
#if defined(WEBGPU_H_) #if defined(WEBGPU_H_)
/*! @brief Provide the address of the `wgpuInstanceCreateSurface` function to GLFW.
*
* This function passes the address provided for the `wgpuInstanceCreateSurface` function
* to GLFW.
*
* @param[in] addr The address of the `wgpuInstanceCreateSurface` function.
*
* @since Added in version 3.5
*
* @ingroup webgpu
*/
GLFWAPI void glfwSetWGPUInstanceCreateSurfaceAddr(WGPUSurface (*addr)(WGPUInstance, const WGPUSurfaceDescriptor*));
/*! @brief Creates a WebGPU surface for the specified window. /*! @brief Creates a WebGPU surface for the specified window.
* *
* This function creates a WebGPU surface for the specified window. * This function creates a WebGPU surface for the specified window.

View File

@ -367,8 +367,7 @@ typedef struct WGPUSurfaceDescriptor
WGPUStringView label; WGPUStringView label;
} WGPUSurfaceDescriptor; } WGPUSurfaceDescriptor;
typedef WGPUSurface (*PFN_wgpuInstanceCreateSurface)(WGPUInstance, const WGPUSurfaceDescriptor*); extern WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, const WGPUSurfaceDescriptor* descriptor) __attribute((weak));
#define wgpuInstanceCreateSurface _glfw.wgpu.instanceCreateSurface
#include "platform.h" #include "platform.h"
@ -915,10 +914,6 @@ struct _GLFWlibrary
GLFWbool EXT_headless_surface; GLFWbool EXT_headless_surface;
} vk; } vk;
struct {
PFN_wgpuInstanceCreateSurface instanceCreateSurface;
} wgpu;
struct { struct {
GLFWmonitorfun monitor; GLFWmonitorfun monitor;
GLFWjoystickfun joystick; GLFWjoystickfun joystick;

View File

@ -29,12 +29,6 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
GLFWAPI void glfwSetWGPUInstanceCreateSurfaceAddr(WGPUSurface (*addr)(WGPUInstance, const WGPUSurfaceDescriptor*))
{
_GLFW_REQUIRE_INIT()
_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)
@ -43,7 +37,7 @@ GLFWAPI WGPUSurface glfwCreateWindowWGPUSurface(WGPUInstance instance, GLFWwindo
assert(window != NULL); assert(window != NULL);
assert(instance != NULL); assert(instance != NULL);
assert(_glfw.wgpu.instanceCreateSurface != NULL); assert(&wgpuInstanceCreateSurface != NULL);
if (window->context.client != GLFW_NO_API) if (window->context.client != GLFW_NO_API)
{ {