got bored wrote some objectice C
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
#include <gryphn/gryphn.h>
|
|
||||||
#include <gryphn/gryphn_utils.h>
|
|
||||||
// #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;
|
|
||||||
}
|
|
@@ -1,10 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Metal/Metal.hpp>
|
#include <Metal/MTLRenderPipeline.h>
|
||||||
#include <AppKit/AppKit.hpp>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
struct GLFWwindow;
|
|
||||||
|
|
||||||
typedef struct gnPlatformInstance_t {
|
typedef struct gnPlatformInstance_t {
|
||||||
NS::View* metalContentView;
|
NSView* metalContentView;
|
||||||
MTL::RenderPipelineState* framebufferRenderer, *testSquareRenderer;
|
id<MTLRenderPipelineState> framebufferRenderer;
|
||||||
} gnPlatformInstance;
|
} gnPlatformInstance;
|
||||||
|
14
rendering_api/metal/src/core/instance/metal_instance.m
Normal file
14
rendering_api/metal/src/core/instance/metal_instance.m
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <gryphn/gryphn.h>
|
||||||
|
#include <gryphn/gryphn_utils.h>
|
||||||
|
#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);
|
||||||
|
}
|
Reference in New Issue
Block a user