瀏覽代碼

synchronize opengl context access on osx between threads

Palana 11 年之前
父節點
當前提交
b70df7607c
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      libobs-opengl/gl-cocoa.m

+ 2 - 0
libobs-opengl/gl-cocoa.m

@@ -227,12 +227,14 @@ void gl_update(device_t device)
 
 void device_entercontext(device_t device)
 {
+	CGLLockContext([device->plat->context CGLContextObj]);
 	[device->plat->context makeCurrentContext];
 }
 
 void device_leavecontext(device_t device)
 {
 	[NSOpenGLContext clearCurrentContext];
+	CGLUnlockContext([device->plat->context CGLContextObj]);
 }
 
 void device_load_swapchain(device_t device, swapchain_t swap)