Vulkan中framebuffer和image之间有什么区别? [英] What is the difference between framebuffer and image in Vulkan?
问题描述
我知道framebuffer是渲染管道的最终目的地,而swapchain包含许多图像。那么这两件事之间的关系是什么?哪一个是实际的渲染目标?帧缓冲区后来是否会在图像视图中附加当前帧的最终图片?如果是这样,它将如何转移?
I've known that framebuffer is the final destination of the rendering pipeline and swapchain contains many image. So what is the relation between those two things? Which one is the actual render target? And does the framebuffer later attach the final picture of the current frame on the image view? If so, how will it transfer?
通过油漆或图表描述这一点会很高兴。
Describing this via paint or diagram would be pleased.
推荐答案
-
VkFramebuffer
+VkRenderPass
定义渲染目标。VkFramebuffer
+VkRenderPass
defines the render target.渲染过程定义哪些附件将用颜色书写。
Render pass defines which attachment will be written with colors.
VkFramebuffer
定义哪个VkImageView
将是附件。VkImageView
定义VkImage
的哪一部分到使用。VkImageView
defines which part ofVkImage
to use.VkImage
定义哪个VkMemory
使用和texel的格式。VkImage
defines whichVkMemory
is used and a format of the texel.或者可能在相反的顺序:
Or maybe in opposite sequence:
-
VkMemory
只是一个N字节序列记忆。
VkMemory
is just a sequence of N bytes in memory.
VkImage
对象添加到它,例如有关格式的信息(因此您可以通过纹素而不是字节来解决)。VkImage
object adds to it e.g. information about the format (so you can address by texels, not bytes).VkImageView
对象帮助选择部分VkImage
(如stringView,arrayView或whathaveyou)也可以帮助匹配某些不兼容的界面(通过动态转换格式)。VkImageView
object helps select part of theVkImage
(like stringView, arrayView or whathaveyou) also can help to match to some incompatible interface (by converting format on the fly).VkFramebuffer
使用附件绑定VkImageView
。VkRenderpass
定义将附件引入所以它不像你不使用图像。你可以通过Vulkan Framebuffer。
So it's not like you do not use an image. You do, through the Vulkan Framebuffer.
交换链图像与任何其他图像没有区别。除了驱动程序是图像的所有者。你不能直接销毁它或自己分配它。您只需在获取和当前操作之间从驱动程序借用它。
Swapchain image is no different from any other image. Except that the driver is the owner of the image. You can't destroy it directly or allocate it yourself. You just borrow it from the driver for the duration between acquire and present operation.
为了缓冲和提前渲染,有(通常)更多的交换链图像。对于每张图片,AFAIK你需要一个单独的
VkFramebuffer
( 令人讨厌,但与下面实际发生的事情更加一致)。There's (usually) more of the swapchain images for the purposes of buffering and advance rendering. AFAIK you would need a separate
VkFramebuffer
for each image (which is annoying, but more in tune with what actually happens underneath).(这里肯定有一个漂亮的图表。也许以后......)
(There's definitely a pretty diagram in this. Maybe later...)
这篇关于Vulkan中framebuffer和image之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-