Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
baa57d4c
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
baa57d4c
编写于
4月 03, 2014
作者:
Z
Zachary Lund
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/jp9000/obs-studio
上级
e5b90acc
c2abb80c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
34 deletion
+12
-34
libobs-opengl/gl-cocoa.m
libobs-opengl/gl-cocoa.m
+12
-34
未找到文件。
libobs-opengl/gl-cocoa.m
浏览文件 @
baa57d4c
...
...
@@ -26,7 +26,6 @@
struct gl_windowinfo {
NSOpenGLContext *context;
NSView *view;
};
...
...
@@ -35,8 +34,6 @@ struct gl_platform {
struct gs_swap_chain swap;
};
static NSOpenGLContext *plat_context;
static NSOpenGLContext *gl_context_create(struct gs_init_data *info)
{
unsigned attrib_count = 0;
...
...
@@ -87,8 +84,7 @@ static NSOpenGLContext *gl_context_create(struct gs_init_data *info)
}
NSOpenGLContext
*context
;
context =
[[NSOpenGLContext
alloc
]
initWithFormat:pf
shareContext:plat_context
];
context =
[[NSOpenGLContext
alloc
]
initWithFormat:pf
shareContext:nil
];
[
pf
release
];
if
(!
context
)
{
blog
(
LOG_ERROR
,
"
Failed
to
create
context
");
...
...
@@ -103,29 +99,20 @@ static NSOpenGLContext *gl_context_create(struct gs_init_data *info)
static bool gl_init_default_swap(struct gl_platform *plat, device_t dev,
struct gs_init_data *info)
{
plat_context = nil;
struct gl_windowinfo *wi = gl_windowinfo_create(info);
if (!wi)
if(!(plat->context = gl_context_create(info)))
return false;
plat->swap.device = dev;
plat->swap.info = *info;
plat->swap.wi = wi;
plat->context = wi->context;
plat->swap.wi = gl_windowinfo_create(info);
plat_context = plat->context;
return true;
return plat->swap.wi != NULL;
}
struct gl_platform *gl_platform_create(device_t device,
struct gs_init_data *info)
{
struct gl_platform *plat = bmalloc(sizeof(struct gl_platform));
memset(plat, 0, sizeof(struct gl_platform));
struct gl_platform *plat = bzalloc(sizeof(struct gl_platform));
if(!gl_init_default_swap(plat, device, info))
goto fail;
...
...
@@ -155,6 +142,8 @@ void gl_platform_destroy(struct gl_platform *platform)
if(!platform)
return;
[platform->context release];
platform->context = nil;
gl_windowinfo_destroy(platform->swap.wi);
bfree(platform);
...
...
@@ -170,7 +159,6 @@ struct gl_windowinfo *gl_windowinfo_create(struct gs_init_data *info)
struct gl_windowinfo *wi = bzalloc(sizeof(struct gl_windowinfo));
wi->context = gl_context_create(info);
wi->view = info->window.view;
return wi;
...
...
@@ -181,27 +169,18 @@ void gl_windowinfo_destroy(struct gl_windowinfo *wi)
if(!wi)
return;
[wi->context release];
wi->context = nil;
wi->view = nil;
bfree(wi);
}
static inline NSOpenGLContext *current_context(device_t device)
{
if (device->cur_swap)
return device->cur_swap->wi->context;
return device->plat->context;
}
void gl_update(device_t device)
{
[
current_context(device)
update];
[
device->plat->context
update];
}
void device_entercontext(device_t device)
{
[
current_context(device)
makeCurrentContext];
[
device->plat->context
makeCurrentContext];
}
void device_leavecontext(device_t device)
...
...
@@ -220,12 +199,12 @@ void device_load_swapchain(device_t device, swapchain_t swap)
return;
device->cur_swap = swap;
[
current_context(device) makeCurrentContext
];
[
device->plat->context setView:swap->wi->view
];
}
void device_present(device_t device)
{
[
current_context(device)
flushBuffer];
[
device->plat->context
flushBuffer];
}
void gl_getclientsize(struct gs_swap_chain *swap, uint32_t *width,
...
...
@@ -238,8 +217,7 @@ void gl_getclientsize(struct gs_swap_chain *swap, uint32_t *width,
texture_t texture_create_from_iosurface(device_t device, void *iosurf)
{
IOSurfaceRef ref = (IOSurfaceRef)iosurf;
struct gs_texture_2d *tex = bmalloc(sizeof(struct gs_texture_2d));
memset(tex, 0, sizeof(struct gs_texture_2d));
struct gs_texture_2d *tex = bzalloc(sizeof(struct gs_texture_2d));
OSType pf = IOSurfaceGetPixelFormat(ref);
if (pf != 'BGRA')
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录