Jinhee Lee
Jinhee Lee

Reputation: 11

How can I change texture on runtime with vulkan?

I'd like to make a video player with Vulkan and ffmpeg.

I already make a queue for frame data which extracted from video with ffmpeg and create vkImage from dequeued frame data.

The how I can the render vkImage and switch it per frame?

Upvotes: 0

Views: 1034

Answers (1)

ratchet freak
ratchet freak

Reputation: 48196

  1. upload the pixel data to a staging buffer

  2. acquire swapchain image

  3. in the command buffer do copy from staging buffer to acquired swapchain image.

  4. present

Add pipeline barriers for layout transitions and semaphores as needed.

You may need a second staging buffer to allow for double buffering.

This requires that the swapchain supports being a transfer_dest. If not then you must render a fullscreen quad and use the frame data as texture or input attachment.

Upvotes: 2

Related Questions