Jump to content
  • Advertisement
w359405949

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!