3.3.1 ios copyTextureToBuffers 调用闪退

做截屏功能的时候,按照例子写了一个demo,在ios上会闪退
我的手机是ios14.8
报错如下

例子代码如下

onButton_Capture() {
    const renderTex = this._renderTex = new RenderTexture();
    const size = view.getVisibleSize();
    renderTex.reset({
        width: size.width,
        height: size.height,
    });

    let nodeCamera = this.node.getChildByName('Camera')
    let camera = nodeCamera.getComponent(Camera);
    camera.targetTexture = renderTex;
    let width = renderTex.width;
    let height = renderTex.height;
    const gfxTexture = renderTex.getGFXTexture();
    if (!gfxTexture) {
        return null;
    }
    const gfxDevice = director.root.device;

    const bufferViews: ArrayBufferView[] = [];
    const regions: gfx.BufferTextureCopy[] = [];

    const region0 = new gfx.BufferTextureCopy();
    region0.texOffset.x = 0;
    region0.texOffset.y = 0;
    region0.texExtent.width = width;
    region0.texExtent.height = height;
    regions.push(region0);

    const buffer = new Uint8Array(width * height * 4);
    bufferViews.push(buffer);

    gfxDevice?.copyTextureToBuffers(gfxTexture, bufferViews, regions);
}

我看到一个类似的情况,但是官方没有回复,麻烦官方人员看看是什么情况
Creator 3.3.1 在 iOS 端重复进入游戏,出现异常闪退

这个问题我可以处理,需要你关闭 Metal API 验证。后面的问题就祝你好运了,反正我们是不支持的,获取到的是 000

image

关闭这个验证我试过了,也会闪退,只是没有cpu access for textures的报错了

我们没有上面的问题,拍照截图自己定制了