Jump to content
  • Advertisement
w359405949

3D [Metal]readpixel (MTLTexture::getpixels) on a separate thread.

This topic is 385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

///////////////////////////
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.

Edited by w359405949

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!