Skip to content

Instantly share code, notes, and snippets.

@codingstyle
Created January 24, 2017 07:49
Show Gist options
  • Save codingstyle/e88ce6c0097b708e27159a71b5d45c58 to your computer and use it in GitHub Desktop.
Save codingstyle/e88ce6c0097b708e27159a71b5d45c58 to your computer and use it in GitHub Desktop.
Metal texture copy and mipmap generation
id<MTLBlitCommandEncoder> blit = [currentCommandBuffer blitCommandEncoder];
[blit copyFromTexture:internalTexture sourceSlice:0 sourceLevel:0 sourceOrigin:MTLOriginMake(0, 0, 0) sourceSize:region.size toTexture:externalTexture destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(0, 0, 0)];
[blit generateMipmapsForTexture:externalTexture];
[blit endEncoding];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment