hello
hello

Reputation: 11

Using CVPixelBuffer is only way to create CAMetalTexture(MTLTexture)?

In CVPixelBuffer, is there a way to create a texture by simply using a pointer other than copyMemory from the base address of the yuv data pointer to the y, u, v plane?

The method to create a texture by copyMemory takes about 0.5ms, but I want to get a better speed.

I know that OpenGL and DirextX have a way to get faster speeds by passing a pointer and having the GPU generate the texture.

Please tell me any method for faster texture creation

Upvotes: 0

Views: 1149

Answers (1)

Frank Rupprecht
Frank Rupprecht

Reputation: 10408

Welcome!

You can use a CVMetalTextureCache to create textures from CVPixelBuffers.

You need to create a texture cache first using CVMetalTextureCacheCreate and use it in CVMetalTextureCacheCreateTextureFromImage to create the texture (scroll down on the docu page for examples). You can (and should) create the texture cache once with the appropriate settings and re-use it every time you need to create a texture.

Upvotes: 1

Related Questions