more objective c
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
#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
|
|
||||||
GN_EXPORT gnReturnCode gnCreateDebuggerFn(gnDebugger* debugger, gnInstance* instance, const gnDebuggerInfo_t info) {
|
|
||||||
return GN_SUCCESS;
|
|
||||||
}
|
|
||||||
GN_EXPORT void gnDestroyDebuggerFn(gnDebugger& instance) {
|
|
||||||
|
|
||||||
}
|
|
||||||
// I will at some point but if you have chosen the fate of writing this on a mac than you should really
|
|
||||||
// hate yourself
|
|
@@ -1,7 +1,27 @@
|
|||||||
// #include <core/output_device/gryphn_physical_output_device.h>
|
#include <core/output_device/gryphn_physical_output_device.h>
|
||||||
// #include <Metal/Metal.hpp>
|
#include <Metal/Metal.h>
|
||||||
// #include <core/metal_instance.h>
|
#include "metal_output_devices.h"
|
||||||
// #include "metal_output_devices.h"
|
#include "core/instance/metal_instance.h"
|
||||||
|
#include "core/instance/gryphn_instance.h"
|
||||||
|
|
||||||
|
gnReturnCode gnCreateOutputDeviceFn(gnOutputDevice* outputDevice, gnInstance* instance, struct gnOutputDeviceInfo_t deviceInfo) {
|
||||||
|
outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice));
|
||||||
|
outputDevice->outputDevice->device = deviceInfo.physicalDevice.physicalDevice->device.retain;
|
||||||
|
outputDevice->outputDevice->queueCount = deviceInfo.queueInfoCount;
|
||||||
|
outputDevice->outputDevice->queues = malloc(sizeof(id<MTLCommandQueue>) * deviceInfo.queueInfoCount);
|
||||||
|
for (int i = 0; i < deviceInfo.queueInfoCount; i++) {
|
||||||
|
outputDevice->outputDevice->queues[i] = outputDevice->outputDevice->device.newCommandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gnDestroyOutputDeviceFn(gnOutputDevice* device) {
|
||||||
|
for (int i = 0; i < device->outputDevice->queueCount; i++) {
|
||||||
|
[device->outputDevice->queues[i] release];
|
||||||
|
}
|
||||||
|
[device->outputDevice->device release];
|
||||||
|
}
|
||||||
|
|
||||||
// struct mtlFramebufferVertex {
|
// struct mtlFramebufferVertex {
|
||||||
// float x, y;
|
// float x, y;
|
@@ -10,6 +10,8 @@ struct gnPlatformPhysicalDevice_t {
|
|||||||
|
|
||||||
struct gnPlatformOutputDevice_t {
|
struct gnPlatformOutputDevice_t {
|
||||||
id<MTLDevice> device;
|
id<MTLDevice> device;
|
||||||
// MTLCommandQueue* commandQueue;
|
|
||||||
MTKView* contentView;
|
MTKView* contentView;
|
||||||
|
|
||||||
|
int queueCount;
|
||||||
|
id<MTLCommandQueue>* queues;
|
||||||
} gnPlatformOutputDevice;
|
} gnPlatformOutputDevice;
|
||||||
|
Reference in New Issue
Block a user