take a bulldozer to some code
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "core/gryphn_rendering_api.h"
|
||||
|
||||
#ifdef GN_PLATFORM_LINUX
|
||||
#include <platform/platform_linux/gryphn_platform_linux.h>
|
||||
#include "platform_linux/gryphn_platform_linux.h"
|
||||
#endif
|
||||
|
||||
#ifdef GN_PLATFORM_MACOS
|
||||
@@ -10,16 +10,14 @@
|
||||
#endif
|
||||
|
||||
#ifdef GN_PLATFORM_WINDOWS
|
||||
#include <platform/platform_windows/gryphn_platform_windows.h>
|
||||
#include "platform_windows/gryphn_platform_windows.h"
|
||||
#endif
|
||||
|
||||
#include <core/gryphn_rendering_api.h>
|
||||
gnRenderingAPI* gnGetSupportedRenderingAPIs(int* count);
|
||||
|
||||
std::vector<gnRenderingAPI> gnGetSupportedRenderingAPIS();
|
||||
void* gnPlatformLoadDLL(gnString name);
|
||||
void* gnLoadFunctionPtr(void* dll, gnString name);
|
||||
|
||||
template <typename function>
|
||||
void gnPlatformLoadDLLFunction(void *dll, function& func, gnString name) {
|
||||
func = (function)gnLoadFunctionPtr(dll, name);
|
||||
}
|
||||
// #ifdef __cplusplus
|
||||
// template <typename function>
|
||||
// void gnPlatformLoadDLLFunction(void *dll, function& func, gnString name) {
|
||||
// func = (function)gnLoadFunctionPtr(dll, name);
|
||||
// }
|
||||
// #endif
|
||||
|
33
src/platform/platform_macos/gryphn_platform_macos.c
Normal file
33
src/platform/platform_macos/gryphn_platform_macos.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifdef GN_PLATFORM_MACOS
|
||||
#undef GN_UTILS_CPP
|
||||
#include "core/gryphn_rendering_api.h"
|
||||
#include "core/instance/init/gryphn_dynamic_library.h"
|
||||
#include "dlfcn.h"
|
||||
|
||||
gnRenderingAPI renderingAPIs[3] = {
|
||||
GN_RENDERINGAPI_METAL,
|
||||
GN_RENDERINGAPI_VULKAN,
|
||||
GN_RENDERINGAPI_SOFTWARE
|
||||
};
|
||||
|
||||
gnRenderingAPI* gnGetSupportedRenderingAPIs(int* count) {
|
||||
*count = 3;
|
||||
return renderingAPIs;
|
||||
}
|
||||
|
||||
struct gnDynamicLibrary_t* gnLoadDynamicLibrary(const gnString path) {
|
||||
struct gnDynamicLibrary_t* dll = malloc(sizeof(struct gnDynamicLibrary_t));
|
||||
dll->dllPtr = dlopen(gnToCString(gnCombineStrings(path, ".dylib")), RTLD_LAZY),
|
||||
dll->isValid = true
|
||||
if (dll->dllPtr == NULL) dll->isValid = false;
|
||||
return dll;
|
||||
}
|
||||
void* gnLoadFunctionPtr(struct gnDynamicLibrary_t* dll, const char* name) {
|
||||
if (dll->isValid == false) return NULL;
|
||||
return dlsym(dll->dllPtr, name);
|
||||
}
|
||||
void gnUnloadDynamicLibrary(struct gnDynamicLibrary_t* dll) {
|
||||
if (dll->isValid) dlclose(dll->dllPtr);
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,17 +0,0 @@
|
||||
#ifdef GN_PLATFORM_MACOS
|
||||
#include <platform/platform_macos/gryphn_platform_macos.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
std::vector<gnRenderingAPI> gnGetSupportedRenderingAPIS() {
|
||||
return { GN_RENDERINGAPI_METAL, GN_RENDERINGAPI_VULKAN };
|
||||
}
|
||||
|
||||
void* gnPlatformLoadDLL(gnString name) {
|
||||
return dlopen(gnToCString(name + ".dylib"), RTLD_LAZY);
|
||||
}
|
||||
|
||||
void* gnLoadFunctionPtr(void *dll, gnString name) {
|
||||
return dlsym(dll, gnToCString(name));
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,11 +1,3 @@
|
||||
#pragma once
|
||||
#include <core/gryphn_rendering_api.h>
|
||||
#include <utils/strings/gryphn_string.h>
|
||||
#include <vector>
|
||||
#include <dlfcn.h>
|
||||
|
||||
namespace NS {
|
||||
struct Window;
|
||||
struct View;
|
||||
}
|
||||
// #include "AppKit/NSView.hpp"
|
||||
|
Reference in New Issue
Block a user