Render
VulkanExample 构造
- vkCreateInstance
- vkCreateDebugReportCallbackEXT
- vkCreateDevice
- vkGetDeviceQueue
- vkCreateCommandPool
- createBuffer: VBO
- createBuffer: IBO
- Create framebuffer attachments
- vkCreateImage * 2
- vkGetImageMemoryRequirements_vkAllocateMemory_vkBindImageMemory
- vkCreateImageView
- vkCreateImage * 2
- Create renderpass
- vkCreateRenderPass
- vkCreateFramebuffer
- Prepare graphics pipeline
- vkCreateDescriptorSetLayout
- vkCreatePipelineLayout
- vkCreatePipelineCache
- vkCreateGraphicsPipelines
- Command buffer creation
- vkAllocateCommandBuffers
- vkBeginCommandBuffer
- vkCmdBeginRenderPass
- vkCmdSetViewport
- vkCmdBindPipeline
- vkCmdBindVertexBuffers
- vkCmdBindIndexBuffer
- vkCmdPushConstants
- vkCmdDrawIndexed
- vkCmdEndRenderPass
- vkEndCommandBuffer
- submitWork: 提交到队列
- vkCreateFence
- vkQueueSubmit
- vkWaitForFences
- vkDestroyFence
- vkDeviceWaitIdle
- 保存渲染结果(Copy framebuffer image to host visible image)
- vkCreateImage
- vkGetImageMemoryRequirements_vkAllocateMemory_vkBindImageMemory
- vkAllocateCommandBuffers
- vkBeginCommandBuffer
- insertImageMemoryBarrier
- vkCmdCopyImage
- insertImageMemoryBarrier
- vkEndCommandBuffer
- submitWork
- vkGetImageSubresourceLayout
- vkMapMemory
- 将数据写入本地磁盘(imagedata)
- vkUnmapMemory
- vkFreeMemory
- vkDestroyImage
- vkQueueWaitIdle
VulkanExample析构
- vkDestroyBuffer
- vkFreeMemory
- vkDestroyImageView
- vkDestroyImage
- vkDestroyRenderPass
- vkDestroyFramebuffer
- vkDestroyPipelineLayout
- vkDestroyDescriptorSetLayout
- vkDestroyPipeline
- vkDestroyPipelineCache
- vkDestroyCommandPool
- vkDestroyShaderModule
- vkDestroyDevice
- vkDestroyDebugReportCallback
- vkDestroyInstance
shader
- VS: 正常渲染三角形
- FS: 正常渲染
小结
本节主要讲如何将渲染结果保存到本地硬盘. 即从GPU显存(framebuffer)复制数据到内存的教程. 主要还是使用MemoryBarrier. 没有新东西, 复习了一下vulkan管线.
Render
VulkanExample 构造
- vkCreateInstance
- vkCreateDebugReportCallbackEXT
- vkCreateDevice
- vkGetDeviceQueue
- vkCreateCommandPool
- Prepare storage buffers
- 输入数据:std::vector<uint32_t> computeInput
- 输出数据:std::vector<uint32_t> computeOutput
- 没见过的std使用方法
- std::generate(computeInput.begin(), computeInput.end(), [&n] { return n++; });
- Copy input data to VRAM using a staging buffer
- createBuffer
- vkMapMemory
- vkFlushMappedMemoryRanges
- vkUnmapMemory
- createBuffer
- vkAllocateCommandBuffers
- vkBeginCommandBuffer
- vkCmdCopyBuffer
- vkEndCommandBuffer
- vkCreateFence
- vkQueueSubmit
- vkWaitForFences
- vkDestroyFence
- vkFreeCommandBuffers
- Prepare compute pipeline
- vkCreateDescriptorPool
- vkCreateDescriptorSetLayout
- vkAllocateDescriptorSets
- writeDescriptorSet
- vkUpdateDescriptorSets
- vkCreatePipelineCache
- vkCreateComputePipelines
- vkAllocateCommandBuffers
- vkCreateFence
- Command buffer creation
- vkBeginCommandBuffer
- vkCmdPipelineBarrier
- vkCmdBindPipeline
- vkCmdBindDescriptorSets
- vkCmdDispatch
- vkCmdPipelineBarrier
- Read back to host visible buffer
- vkCmdCopyBuffer
- vkCmdPipelineBarrier
- vkEndCommandBuffer
- vkResetFences
- vkQueueSubmit
- vkWaitForFences
- Make device writes visible to the host
- vkMapMemory
- vkInvalidateMappedMemoryRanges
- memcpy
- vkUnmapMemory
- vkQueueWaitIdle
- LOG(“Compute output:\n”): 控制台输出
- vkDestroyBuffer
- vkFreeMemory
VulkanExample析构
- vkDestroyPipelineLayout
- vkDestroyDescriptorSetLayout
- vkDestroyDescriptorPool
- vkDestroyPipeline
- vkDestroyPipelineCache
- vkDestroyFence
- vkDestroyCommandPool
- vkDestroyShaderModule
- vkDestroyDevice
- vkDestroyDebugReportCallback
- vkDestroyInstance
shader
- comp: 将输入从新赋值再输出
小结
本节主要讲如何将CS计算结果保存到本地硬盘. 与上一节差不多,复习一下CS管线的代码。