diff --git a/rendering_api/metal/src/core/surface/metal_surface.h b/rendering_api/metal/src/core/surface/metal_surface.h index 4bee575..23e5227 100644 --- a/rendering_api/metal/src/core/surface/metal_surface.h +++ b/rendering_api/metal/src/core/surface/metal_surface.h @@ -1,5 +1,10 @@ #pragma once #include "core/window_surface/gryphn_surface.h" +#import typedef struct gnPlatformWindowSurface_t{ } gnPlatformWindowSurface; + + +MTLPixelFormat mtlGryphnFormatToVulkanFormat(gnImageFormat format); +CGColorSpaceRef mtlGryphnColorSpaceToVulkanColorSpace(gnColorSpace colorSpace); diff --git a/rendering_api/metal/src/core/surface/metal_surface.m b/rendering_api/metal/src/core/surface/metal_surface.m index 65f24f8..fc2af32 100644 --- a/rendering_api/metal/src/core/surface/metal_surface.m +++ b/rendering_api/metal/src/core/surface/metal_surface.m @@ -21,3 +21,16 @@ gnReturnCode gnCreateMacOSWindowSurfaceFn(struct gnWindowSurface_t* windowSurfac windowSurface->windowSurface = malloc(sizeof(gnPlatformWindowSurface)); 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); } + } +}