conversion functions

This commit is contained in:
Greg Wells
2025-05-25 21:59:23 -04:00
parent f026653800
commit 8049055415
2 changed files with 18 additions and 0 deletions

View File

@@ -1,5 +1,10 @@
#pragma once #pragma once
#include "core/window_surface/gryphn_surface.h" #include "core/window_surface/gryphn_surface.h"
#import <QuartzCore/QuartzCore.h>
typedef struct gnPlatformWindowSurface_t{ typedef struct gnPlatformWindowSurface_t{
} gnPlatformWindowSurface; } gnPlatformWindowSurface;
MTLPixelFormat mtlGryphnFormatToVulkanFormat(gnImageFormat format);
CGColorSpaceRef mtlGryphnColorSpaceToVulkanColorSpace(gnColorSpace colorSpace);

View File

@@ -21,3 +21,16 @@ gnReturnCode gnCreateMacOSWindowSurfaceFn(struct gnWindowSurface_t* windowSurfac
windowSurface->windowSurface = malloc(sizeof(gnPlatformWindowSurface)); windowSurface->windowSurface = malloc(sizeof(gnPlatformWindowSurface));
return GN_SUCCESS; return GN_SUCCESS;
} }
MTLPixelFormat mtlGryphnFormatToVulkanFormat(gnImageFormat format) {
switch (format) {
case GN_FORMAT_BGRA8_SRGB: { return MTLPixelFormatBGRA8Unorm_sRGB; }
default: return MTLPixelFormatInvalid;
}
}
CGColorSpaceRef mtlGryphnColorSpaceToVulkanColorSpace(gnColorSpace colorSpace) {
switch (colorSpace) {
case GN_COLOR_SPACE_SRGB_NONLINEAR: { return CGColorSpaceCreateWithName(kCGColorSpaceSRGB); }
}
}