【问题标题】:cocos2d-x 3.17.2 utils::captureScreen failed assertion on iOS 13.1.3 on my iPad mini 5thcocos2d-x 3.17.2 utils::captureScreen 在我的 iPad mini 5th 上的 iOS 13.1.3 上断言失败
【发布时间】:2019-11-03 14:13:50
【问题描述】:

我正在使用 cocos2d-x 3.17.2 并在 iPad mini 5th iOS 13.1.3 上运行我的应用程序。

当我调用 utils::captureScreen 时,它会导致断言失败。

_validateGetBytes:29: 断言“不允许对具有 MTLResourceStorageModePrivate 存储模式的纹理的 CPU 访问”失败。

这似乎是一个与 MTLResourceStorageMode 相关的问题。

但我不知道如何解决这个问题。

我在 iOS 11.4.1 iPod touch 6th 和 iOS 12.4.3 iPad mini 2nd 上运行相同的代码,但这两种设备不会导致这个问题,它们运行完美。

这是我的代码。

 string path = FileUtils::getInstance()->getWritablePath().append("screenshot.jpg");
 Label *path_lbl = Label::createWithSystemFont(path, "", 20.0);
 const char* filename = path_lbl->getString().c_str();
 utils::captureScreen([&](bool succeed,const std::string &fileName){}, filename);

断言失败:ccUtils.cpp: Line 105

glReadPixels(0, 0, 宽度, 高度, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());

有人知道如何解决这个问题吗?

【问题讨论】:

标签: c++ cocos2d-x ios13 cocos2d-x-3.17


【解决方案1】:

glReadPixels() 的底层 Metal 实现违反了 iOS 13.1 中用于内存访问的 Metal 规则(自 13.3.1 起尚未修复)。

好消息是,这只是一个调试检查。当不附加到 Xcode 调试器时,它将“正常工作”。要让 Xcode 让它滑动,你可以:

  1. 转到编辑方案
  2. 在边栏中选择“运行”选项
  3. 转到“选项”选项卡
  4. 禁用 Metal API 验证

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多