这个系列是GAMES106-现代图形绘制流水线原理与实践(GAMES 106: Intro to Modern Rendering Pipeline)的同步课程笔记。课程内容涉及现代图形绘制流水线的基础原理,实践方法,以及优化技巧。本节课主要介绍Vulkan的绘制对象创建、内存管理以及调试方法和工具。
Vulkan对象创建
Vulkan中的重要对象包括FrameBuffer、Buffer、Pipeline、DescriptorSets以及DescriptorPool等。
![](https://search.pstatic.net/common?src=https://i.imgur.com/UZLZEHH.png)
创建Vulkan对象的方法都非常相似,一般包括4个参数:
LogicDevice
:Vulkan对象的逻辑设备VkObjectCreateInfo
:Vulkan对象相关的描述符userAllocator
:内存分配器用于内存管理- Object对象地址
调用函数后会返回VkResult
描述创建对象的过程是否成功。
![](https://search.pstatic.net/common?src=https://i.imgur.com/EURRJya.png)
RenderPass
RenderPass定义了一次图形绘制的最小单元。
![](https://search.pstatic.net/common?src=https://i.imgur.com/KRRzOYs.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/OC7fQeX.png)
FrameBuffer
FrameBuffer定义了绘制输出的相关信息。
![](https://search.pstatic.net/common?src=https://i.imgur.com/mqcQBfL.png)
Buffer
Buffer包含了顶点、索引等各种信息。
![](https://search.pstatic.net/common?src=https://i.imgur.com/2o7ng0u.png)
Pipeline
![](https://search.pstatic.net/common?src=https://i.imgur.com/OjYc2a7.png)
Image
![](https://search.pstatic.net/common?src=https://i.imgur.com/DNX5Ury.png)
PipelineLayout
![](https://search.pstatic.net/common?src=https://i.imgur.com/qkZWg9C.png)
Vulkan内存管理
Vulkan在创建对象时可以由用户指定内存分配器来实现手动内存管理。在渲染中我们需要区分CPU和GPU上的内存。
![](https://search.pstatic.net/common?src=https://i.imgur.com/qhlkJhY.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/Yrb5Xrm.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/CUP7MT7.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/gCAzWaF.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/9PMJ72r.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/S8S03wv.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/MfTwis9.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/1OZp2MO.png)
Vulkan绘制
![](https://search.pstatic.net/common?src=https://i.imgur.com/EwVzk8r.png)
调试工具及方法
![](https://search.pstatic.net/common?src=https://i.imgur.com/l3Hohhg.png)
![](https://search.pstatic.net/common?src=https://i.imgur.com/gF4Yy6z.png)
Reference
PREVIOUS绘制流水线原理I