///////////////////////////
id<MTLTexture> m_texture; // got from main/renader thread
void ReadPixels()
{
std::vector<uint8_t> buffer;
buffer.resize(bufferSize);
[m_texture getBytes:buffer.data() bytesPerRow:[m_texture 32] * 4 fromRegion:MTLRegionMake2D(0 0 32 32) mipmapLevel:0];
}
////////////////////////////////////////////
ReadPixels works well when called by main/render thread. it crashed in separate thread call.
i want to make MTLTexture::getbytes worked as opengles sharegroup/eagl sharecontext/egl. but i do not know the property way.
↧