diff --git a/rendering_api/metal/src/core/instance/metal_instance.cpp b/rendering_api/metal/src/core/instance/metal_instance.cpp deleted file mode 100644 index 5f46251..0000000 --- a/rendering_api/metal/src/core/instance/metal_instance.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -// #include "bridge/metal_bridge.h" -#include "metal_instance.h" - -GN_EXPORT gnReturnCode gnCreateInstanceFn(gnInstance* instance) { - if (instance->instance == nullptr) instance->instance = new gnPlatformInstance(); - return GN_SUCCESS; -} - -GN_EXPORT void gnDestroyInstanceFn(gnInstance& instance) { - -} - -GN_EXPORT gnReturnCode gnCreateMacOSWindowSurfaceFn(gnInstance& instance, NS::Window* window, NS::View* view) { - if (instance.instance == nullptr) instance.instance = new gnPlatformInstance(); - instance.instance->metalContentView = view; - return GN_SUCCESS; -} diff --git a/rendering_api/metal/src/core/instance/metal_instance.h b/rendering_api/metal/src/core/instance/metal_instance.h index 44fe05a..703406a 100644 --- a/rendering_api/metal/src/core/instance/metal_instance.h +++ b/rendering_api/metal/src/core/instance/metal_instance.h @@ -1,10 +1,8 @@ #pragma once -#include -#include - -struct GLFWwindow; +#include +#include typedef struct gnPlatformInstance_t { - NS::View* metalContentView; - MTL::RenderPipelineState* framebufferRenderer, *testSquareRenderer; + NSView* metalContentView; + id framebufferRenderer; } gnPlatformInstance; diff --git a/rendering_api/metal/src/core/instance/metal_instance.m b/rendering_api/metal/src/core/instance/metal_instance.m new file mode 100644 index 0000000..69e0e5e --- /dev/null +++ b/rendering_api/metal/src/core/instance/metal_instance.m @@ -0,0 +1,14 @@ +#include +#include +#include "metal_instance.h" +// #include "bridge/metal_bridge.h" + + +gnReturnCode gnCreateInstanceFn(gnInstance* instance, gnInstanceInfo instanceInfo) { + if (instance->instance == NULL) instance->instance = malloc(sizeof(gnPlatformInstance)); + return GN_SUCCESS; +} + +void gnDestroyInstanceFn(gnInstance* instance) { + free(instance->instance); +}