Turn instance into a handle

This commit is contained in:
Greg Wells
2025-06-03 13:23:28 -04:00
parent cbfd6743f6
commit ed781c1d63
22 changed files with 56 additions and 52 deletions

View File

@@ -1,7 +1,7 @@
#include <core/debugger/gryphn_debugger.h>
// these do nothing because I am too lazy to write a debugger for metal at this point in time
gnReturnCode gnCreateDebuggerFn(gnDebugger* debugger, gnInstance* instance, const struct gnDebuggerInfo_t info) {
gnReturnCode gnCreateDebuggerFn(gnDebugger* debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info) {
return GN_SUCCESS;
}
void gnDestroyDebuggerFn(gnDebugger* instance) {

View File

@@ -5,7 +5,7 @@
#include "core/instance/gryphn_instance.h"
#include <core/debugger/gryphn_debugger.h>
gnReturnCode gnCreateOutputDeviceFn(gnOutputDevice* outputDevice, gnInstance* instance, struct gnOutputDeviceInfo_t deviceInfo) {
gnReturnCode gnCreateOutputDeviceFn(gnOutputDevice* outputDevice, gnInstanceHandle instance, struct gnOutputDeviceInfo_t deviceInfo) {
outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice));
outputDevice->outputDevice->device = deviceInfo.physicalDevice.physicalDevice->device.retain;
outputDevice->outputDevice->queueCount = deviceInfo.queueInfoCount;

View File

@@ -3,7 +3,7 @@
#include "metal_output_devices.h"
#include "core/window_surface/gryphn_surface.h"
gnPhysicalDevice* gnGetPhysicalDevicesFn(gnInstance* instance, uint32_t* deviceCount) {
gnPhysicalDevice* gnGetPhysicalDevicesFn(gnInstanceHandle instance, uint32_t* deviceCount) {
NSArray *devices = MTLCopyAllDevices();
*deviceCount = [devices count];
gnPhysicalDevice* devicesList = (gnPhysicalDevice*)malloc(sizeof(gnPhysicalDevice) * *deviceCount);

View File

@@ -4,11 +4,11 @@
// #include "bridge/metal_bridge.h"
gnReturnCode gnCreateInstanceFn(gnInstance* instance, gnInstanceInfo instanceInfo) {
gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instanceInfo) {
if (instance->instance == NULL) instance->instance = malloc(sizeof(gnPlatformInstance));
return GN_SUCCESS;
}
void gnDestroyInstanceFn(gnInstance* instance) {
void gnDestroyInstanceFn(gnInstanceHandle instance) {
free(instance->instance);
}

View File

@@ -8,7 +8,7 @@
#import <Metal/Metal.h>
#import <CoreGraphics/CoreGraphics.h>
gnReturnCode gnCreateMacOSWindowSurfaceFn(struct gnWindowSurface_t* windowSurface, gnInstance* instance, struct gnMacOSWindowSurfaceInfo_t createInfo) {
gnReturnCode gnCreateMacOSWindowSurfaceFn(struct gnWindowSurface_t* windowSurface, gnInstanceHandle instance, struct gnMacOSWindowSurfaceInfo_t createInfo) {
windowSurface->windowSurface = malloc(sizeof(gnPlatformWindowSurface));
windowSurface->windowSurface->layer = createInfo.layer;
return GN_SUCCESS;