Compare commits

...

2 Commits

Author SHA1 Message Date
Sebastian Dawid
8bbf3b9039
Merge 95e1dcce2e into 8e15281d34 2025-10-01 07:06:37 +00:00
Sebastian Emanuel Dawid
95e1dcce2e Add metal layer creation that was previously missing. 2025-10-01 09:06:03 +02:00
2 changed files with 12 additions and 1 deletions

View File

@ -26,7 +26,6 @@ set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
include(FetchContent)
FetchContent_Declare(
webgpu
GIT_REPOSITORY https://github.com/eliemichel/WebGPU-distribution.git
@ -36,6 +35,7 @@ FetchContent_Declare(
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(webgpu)
message("${CMAKE_SYSTEM_PROCESSOR}")
add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL})
add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL})

View File

@ -2028,6 +2028,17 @@ typedef struct WGPUSurfaceSourceMetalLayer
WGPUSurface _glfwCreateWindowWGPUSurfaceCocoa(WGPUInstance instance, _GLFWwindow* window)
{
window->ns.layer = [CAMetalLayer layer];
if (!window->ns.layer)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to create layer for view");
return NULL;
}
if (window->ns.scaleFramebuffer)
[window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
[window->ns.view setLayer:window->ns.layer];
[window->ns.view setWantsLayer:YES];