RHI uploadTexture failed in MacOS Metal backend
Unsolved
QML and Qt Quick
-
Recently I'm using Qt RHI to draw some graphics, which use textures. When I use Metal as the backend on MacOS and update the texture in the render function, the App crashed with the following error. However, it works fine on Windows platform when using DirectX as the backend. Does anyone know what the reason is?
error: -[AGXG13GFamilyCommandBuffer blitCommandEncoderCommon:]:833: failed assertion `A command encoder is already encoding to this command buffer'
Code Snippet:
void TextureRenderer::render(QRhiCommandBuffer *cb) { QRhiResourceUpdateBatch *batch = _rhi->nextResourceUpdateBatch(); // .... // update vertices and matrix uniforms // .... // update texture _textureImage = crateTextureImage(); batch->uploadTexture(_texture.get(), _textureImage); cb->resourceUpdate(batch); // draw graphics cb->draw(...); cb->endPass(); }