filament: readPixels on iOS/Metal returns buffer with only zeros

I am using readPixels with a callback on iOS/Metal. The PixelBuffer uses PixelDataFormat::RGBA and PixelDataType::UBYTE. I am reserving an uint8_t array of size width * height * 4 for the storage, and call renderer->readPixels(0, 0, width, height, std::move(pb)).

The swapchain has SwapChain::CONFIG_TRANSPARENT | SwapChain::CONFIG_READABLE as parameters, and I have metalLayer.opaque = NO to match that.

Unfortunately, when the callback fires, the buffer is all zeros. Any ideas?

(will try on other backends tomorrow).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 35 (13 by maintainers)

Most upvoted comments

Just to confirm that this solves the readPixels issue for me; thanks!

I think I localised the issue, and of course it wasn’t filament’ fault, but I’ll need to double check on the device where I first encountered it. Thanks for spending time on this, in any case.