如何检测Core Image的硬件加速? [英] How to detect hardware acceleration for Core Image?

查看:112
本文介绍了如何检测Core Image的硬件加速?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我在CALayer动画期间使用"CIMotionBlur" CIFilter.问题是,当硬件加速不可用时,过滤器将无法正常工作:

In my app I'm using a "CIMotionBlur" CIFilter during CALayer animation. The problem is that the filter does not work properly when hardware acceleration is not available:

  • 在OS X安全模式下,动画期间该图层变为不可见;
  • 使用VMWare Fusion时,动画的运行速度令人难以忍受,并且使测试应用程序更加困难;

动画无需过滤器即可正常运行.我只想在硬件加速可用时应用过滤器.

Animation works fine without the filter. I'd like to apply filter only when hardware acceleration is available.

让我知道何时禁用过滤器的最高级别的API是什么? 我将在IOKit中寻找线索.

What's the highest level API that would let me know when to disable the filter? I'm going to look for clues in IOKit.

推荐答案

我在技术问答集QA1218
中找到了答案 如何分辨Quartz Extreme是否通过硬件加速了特定的显示器?"

I found the answer in Technical Q&A QA1218
"How do I tell if a particular display is being hardware accelerated by Quartz Extreme?"

就这么简单

NSNumber* curScreenNum = [self.window.screen.deviceDescription objectForKey:@"NSScreenNumber"];
if (CGDisplayUsesOpenGLAcceleration(curScreenNum.integerValue))
{
    // Do accelerated stuff
}

在我的情况下可以正常工作.

Works as expected in my cases.

这篇关于如何检测Core Image的硬件加速?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆