BerstanioDev
unread,Dec 8, 2025, 12:59:23 PM (9 days ago) Dec 8Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to angleproject
I'm not well versed in graphics programming and ANGLE, but I think I identified the following issue (on iOS):
When calling `glTexImage2D` a lot of times in a single frame (e.g. during game launch preparing textures), I noticed the memory consumption steadily increase up to 1.2GB and then iOS killed the application. I identified the following allocating path:
- rx::(anonymous namespace)::UploadTextureContents
- rx::(anonymous namespace)::UploadTextureContentsWithStagingBuffer
- rx::(anonymous namespace)::CopyTextureContentsToStagingBuffer
- rx::mtl::Buffer::Buffer
- rx::mtl::Buffer::reset
- rx::mtl::ContextDevice::newBufferWithLength
After digging a bit through the code, I noticed the following:
`getBlitCommandEncoderWithoutEndingRenderEncoder` is called, but when it does, it will imidiatly return `return &mBlitEncoder;`. This leads to `flushCommandBufferIfNeeded` never being called, which should track that the attached resources to a command buffer don't exceed 400mb.
Adding `flushCommandBufferIfNeeded();` at the start of `getBlitCommandEncoderWithoutEndingRenderEncoder` fixed the issue for me.
I'm not sure, if that is really the root cause or whether there are better ways to fix this.
If necessary, I can try to provide a minimal reproducer.