headless_ios.m raw
1 // SPDX-License-Identifier: Unlicense OR MIT
2
3 // +build darwin,ios
4
5 @import OpenGLES;
6
7 #include <CoreFoundation/CoreFoundation.h>
8 #include "_cgo_export.h"
9
10 void gio_headless_releaseContext(CFTypeRef ctxRef) {
11 CFBridgingRelease(ctxRef);
12 }
13
14 CFTypeRef gio_headless_newContext(void) {
15 EAGLContext *ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
16 if (ctx == nil) {
17 return nil;
18 }
19 return CFBridgingRetain(ctx);
20 }
21
22 void gio_headless_clearCurrentContext(CFTypeRef ctxRef) {
23 [EAGLContext setCurrentContext:nil];
24 }
25
26 void gio_headless_makeCurrentContext(CFTypeRef ctxRef) {
27 EAGLContext *ctx = (__bridge EAGLContext *)ctxRef;
28 [EAGLContext setCurrentContext:ctx];
29 }
30
31 void gio_headless_prepareContext(CFTypeRef ctxRef) {
32 }
33