Revert "Try loading surface creation function via dlsym instead"

This reverts commit cb0c28908f.
This commit is contained in:
Sebastian Emanuel Dawid 2025-08-15 23:39:30 +02:00
parent cb0c28908f
commit 37812b7e36
4 changed files with 17 additions and 11 deletions

View File

@ -6531,6 +6531,19 @@ 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

@ -402,8 +402,6 @@ GLFWAPI int glfwInit(void)
if (!_glfwSelectPlatform(_glfw.hints.init.platformID, &_glfw.platform)) if (!_glfwSelectPlatform(_glfw.hints.init.platformID, &_glfw.platform))
return GLFW_FALSE; return GLFW_FALSE;
_glfwLoadWGPUInstanceCreateSurfaceAddr();
if (!_glfw.platform.init()) if (!_glfw.platform.init())
{ {
terminate(); terminate();

View File

@ -1051,8 +1051,6 @@ GLFWbool _glfwInitVulkan(int mode);
void _glfwTerminateVulkan(void); void _glfwTerminateVulkan(void);
const char* _glfwGetVulkanResultString(VkResult result); const char* _glfwGetVulkanResultString(VkResult result);
void _glfwLoadWGPUInstanceCreateSurfaceAddr(void);
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint); size_t _glfwEncodeUTF8(char* s, uint32_t codepoint);
char** _glfwParseUriList(char* text, int* count); char** _glfwParseUriList(char* text, int* count);

View File

@ -28,14 +28,11 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(_GLFW_WIN32)
// TODO: Implement Window version GLFWAPI void glfwSetWGPUInstanceCreateSurfaceAddr(WGPUSurface (*addr)(WGPUInstance, const WGPUSurfaceDescriptor*)) {
#else _GLFW_REQUIRE_INIT()
#include <dlfcn.h> _glfw.wgpu.instanceCreateSurface = addr;
void _glfwLoadWGPUInstanceCreateSurfaceAddr() {
_glfw.wgpu.instanceCreateSurface = dlsym(RTLD_DEFAULT, "wgpuInstanceCreateSurface");
} }
#endif
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)