|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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); |
|
|
|