C instance creation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
project(GryphnMetalImpl)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
|
||||
|
19
rendering_api/metal/src/core/instance/metal_instance.cpp
Normal file
19
rendering_api/metal/src/core/instance/metal_instance.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#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;
|
||||
}
|
10
rendering_api/metal/src/core/instance/metal_instance.h
Normal file
10
rendering_api/metal/src/core/instance/metal_instance.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <Metal/Metal.hpp>
|
||||
#include <AppKit/AppKit.hpp>
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
struct gnPlatformInstance {
|
||||
NS::View* metalContentView;
|
||||
MTL::RenderPipelineState* framebufferRenderer, *testSquareRenderer;
|
||||
};
|
@@ -1,3 +1,4 @@
|
||||
#include "utils/gryphn_bool.h"
|
||||
#include <core/gryphn_support.h>
|
||||
|
||||
GN_EXPORT gnBool gnAPISupportsFn(gnFeature feature) {
|
||||
|
Reference in New Issue
Block a user