namespace gfx::drivers;
// OpenGL Extensions
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
#if !defined(__MINGW32__)
#define GL_GLEXT_PROTOTYPES
import "Display"
-#if defined(__unix__)
+#if defined(__unix__) || defined(__APPLE__)
#ifndef __ANDROID__
import "XInterface"
if(useSingleGLContext) return true;
#if defined(__WIN32__)
wglMakeCurrent(oglSystem.hdc, oglSystem.glrc);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
//if(previous) return true;
// printf("Making SYSTEM current\n");
/*#if defined(__APPLE__)
if(useSingleGLContext) return;
#if defined(__WIN32__)
wglMakeCurrent(null, null);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
// printf("Making NULL current\n");
#if defined(__ANDROID__)
#else
if(useSingleGLContext) return true;
#if defined(__WIN32__)
wglMakeCurrent(oglDisplay.hdc, oglDisplay.glrc);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
// if(previous) glXMakeCurrent(xGlobalDisplay, None, null);
// printf(" Making DISPLAY current\n");
#if defined(__ANDROID__)
if(oglDisplay.memDC) DeleteDC(oglDisplay.memDC);
if(oglDisplay.memBitmap) DeleteObject(oglDisplay.memBitmap);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
#else
if(oglDisplay.shapePixmap)
}
}
}
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
egl_init_display(guiApp.desktop.windowHandle);
result = true;
ReleaseDC(oglSystem.hwnd, oglSystem.hdc);
DestroyWindow(oglSystem.hwnd);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
egl_term_display();
#else
}
else
ReleaseDC(display.window, oglDisplay.hdc);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
#else
XVisualInfo * visualInfo = null;
if(!useSingleGLContext)
#if defined(__WIN32__)
wglMakeCurrent(null, null);
- #elif defined(__unix__)
+ #elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
result = true;
#else
}
ReleaseDC(display.window, hdc);
}
-#elif defined(__unix__)
+#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
result = true;
#else
CreateDisplay(display);
#if defined(__WIN32__)
wglMakeCurrent(oglDisplay.hdc, oglDisplay.glrc);
-#elif defined(__unix__)
+#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
width = eglWidth;
height = eglHeight;
*/
ReleaseDC(0, hdc);
-#elif defined(__unix__)
+#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
#else
XTransform transform =
#if defined(__WIN32__)
//wglSwapLayerBuffers(oglDisplay.hdc,WGL_SWAP_MAIN_PLANE);
SwapBuffers(oglDisplay.hdc);
-#elif defined(__unix__)
+#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
eglSwapBuffers(eglDisplay, eglSurface);
#else
#if defined(__WIN32__)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#elif defined(__APPLE__)
+#define set _set
+#include <mach/mach.h>
+#include <mach/task.h>
+#include <mach/semaphore.h>
+#undef set
#else
#include <semaphore.h>
#endif
#if defined(__WIN32__)
handle = CreateSemaphore(null, 0, 1, null);
#elif defined(__APPLE__)
- semaphore_create(current_task(), &semaphore, SYNC_POLICY_FIFO, 0);
+ semaphore_create(mach_task_self(), &semaphore, SYNC_POLICY_FIFO, 0);
#else
sem_init(&semaphore, 0, 0);
#endif
#if defined(__WIN32__)
if(handle) CloseHandle(handle);
#elif defined(__APPLE__)
- semaphore_destroy(current_task(), &semaphore);
+ semaphore_destroy(mach_task_self(), semaphore);
#else
sem_destroy(&semaphore);
#endif
if(handle) CloseHandle(handle);
handle = CreateSemaphore(null, initCount, value, null);
#elif defined(__APPLE__)
- semaphore_destroy(semaphore);
- semaphore_create(current_task(), &semaphore, SYNC_POLICY_FIFO, 0);
+ semaphore_destroy(mach_task_self(), semaphore);
+ semaphore_create(mach_task_self(), &semaphore, SYNC_POLICY_FIFO, 0);
count = value;
#else
sem_destroy(&semaphore);