|
|
|
|
|
|
bool UnitySurfaceManager::ReleaseNativeRenderTexture() |
|
|
|
{ |
|
|
|
//release gl resources |
|
|
|
CVOpenGLTextureRelease(gl_tex_ref_); |
|
|
|
CVOpenGLTextureCacheRelease(gl_tex_cache_ref_); |
|
|
|
|
|
|
|
//release metal resources |
|
|
|
CFRelease(metal_tex_ref_); |
|
|
|
CFRelease(metal_tex_cache_ref_); |
|
|
|
|
|
|
|
//release pixel buffer |
|
|
|
CVPixelBufferRelease(pixelbuffer_ref); |
|
|
|
|
|
|
|
|
|
|
|
FML_DCHECK(gl_tex_ != 0); |
|
|
|
//gl_tex_ will be released in CVOpenGLTextureRelease |
|
|
|
//glDeleteTextures(1, &gl_tex_); |
|
|
|
|
|
|
|
//gl_tex_ is released in CVOpenGLTextureRelease |
|
|
|
|
|
|
|
CVOpenGLTextureCacheRelease(gl_tex_cache_ref_); |
|
|
|
|
|
|
|
CVOpenGLTextureRelease(gl_tex_ref_); |
|
|
|
//release metal resources |
|
|
|
//since ARC is enabled by default, no need to release the texture |
|
|
|
metal_tex_ = nullptr; |
|
|
|
|
|
|
|
CFRelease(metal_tex_ref_); |
|
|
|
|
|
|
|
CFRelease(metal_tex_cache_ref_); |
|
|
|
//since ARC is enabled by default, no need to release the texture |
|
|
|
metal_tex_ = nullptr; |
|
|
|
//release cv pixelbuffer |
|
|
|
CVPixelBufferRelease(pixelbuffer_ref); |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} // namespace uiwidgets |