浏览代码

bug fix

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
53bdd6e2
共有 2 个文件被更改,包括 7 次插入16 次删除
  1. 19
      engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.mm
  2. 4
      engine/src/shell/platform/unity/windows/uiwidgets_system.cc

19
engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.mm


}
}
FML_DCHECK(gl_context_ != nullptr);
FML_DCHECK(gl_context_ != nullptr && gl_resource_context_ != nullptr);
}
UnitySurfaceManager::~UnitySurfaceManager() { ReleaseNativeRenderContext(); }

bool UnitySurfaceManager::MakeCurrentResourceContext()
{
if (gl_resource_context_ == nullptr)
{
[gl_context_ makeCurrentContext];
}
else
{
[gl_resource_context_ makeCurrentContext];
}
[gl_resource_context_ makeCurrentContext];
return true;
}

void UnitySurfaceManager::ReleaseNativeRenderContext()
{
if (gl_resource_context_ != nullptr)
{
CGLReleaseContext(gl_resource_context_.CGLContextObj);
gl_resource_context_ = nullptr;
}
FML_DCHECK(gl_resource_context_);
CGLReleaseContext(gl_resource_context_.CGLContextObj);
gl_resource_context_ = nullptr;
FML_DCHECK(gl_context_);
CGLReleaseContext(gl_context_.CGLContextObj);

4
engine/src/shell/platform/unity/windows/uiwidgets_system.cc


void UIWidgetsSystem::GfxWorkerCallback(int eventId, void* data) {
const fml::closure task(std::move(gfx_worker_tasks_[eventId]));
{
std::scoped_lock(task_mutex_);
std::scoped_lock lock(task_mutex_);
gfx_worker_tasks_.erase(eventId);
}
task();

{
std::scoped_lock(task_mutex_);
std::scoped_lock lock(task_mutex_);
last_task_id_++;
gfx_worker_tasks_[last_task_id_] = task;
}

正在加载...
取消
保存