我正在使用 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());
有谁知道如何解决这个问题?