Is it possible to draw texture (if it is with correct width, height and pixel format) directly to frame buffer without using vertices and shaders in Vulkan?
Asked
Active
Viewed 4,318 times
17
-
To downvoters: I guess he is looking for something close to OpenGL's glDrawPixels() / glDrawBuffer() in Vulkan API, which enabled direct draw to framebuffer. While drawing a full screen textured quad with no perspective projections and no ZBuffer write is the straight forward solution, it is still a valid question. – Alex Byrth Aug 12 '16 at 17:17
-
6@NicolBolas Sorry, but you are very tough. Vulkan is terrible new and had a giant doc and huge structure to look at. It is not trivial in any way. And I guess the propose of StackOverflow is to build bridges between who knows and who don't know. – Alex Byrth Aug 13 '16 at 01:50
-
I agree with Alex here - there is a lot of documentation to look through, and if you haven't used Vulkan yet, and are reading the documentation to decide whether you want to use it, then you probably won't realise that the `vkCmdCopy*` commands are what you want. Most small samples show how to draw with indices and vertices, not direct texture copies. I have asked questions, which had sections in the documentation that could answer them, but I did not find them. – Andrew Williamson Aug 16 '16 at 02:04
1 Answers
13
You can do a vkCmdCopyImage
to copy from your vkImage
to a swapchain's vkImage
provided the vkSurface
supports being a TRANSFER_DST
as by the supportedUsageFlags
field from the result of vkGetPhysicalDeviceSurfaceCapabilitiesKHR
.
Otherwise you need to do a fullscreen render and grab the color data from the input image as a sampled texture or input attachment.

ratchet freak
- 47,288
- 5
- 68
- 106
-
You can also use `vkCmdBlitImage` if you want scaling, filtering or format conversions as well. `vkCmdCopyImage` just straight up takes a copy of the memory, which isn't always useful. – Quinchilion Aug 13 '16 at 13:47
-
But note that this requires the source format to support the `VK_FORMAT_FEATURE_BLIT_SRC_BIT` and the destination format to support the `VK_FORMAT_FEATURE_BLIT_DST_BIT`. This may not always be the case, so if you're going to use a blit, check these first. – Sascha Willems Aug 13 '16 at 14:36