logo资料库

Learning Vulkan 无水印pdf 0分.pdf

第1页 / 共529页
第2页 / 共529页
第3页 / 共529页
第4页 / 共529页
第5页 / 共529页
第6页 / 共529页
第7页 / 共529页
第8页 / 共529页
资料共529页,剩余部分请下载后查看
Cover
Table of Contents
Copyright
About the Author
Preface
1. Getting Started with the NextGen 3D Graphics API
Vulkan and its evolution
Vulkan versus OpenGL
Important jargons before we get started
Learning the fundamentals of Vulkan
Vulkan's execution model
Vulkan's queues
The object model
Object lifetime and command syntax
Error checking and validation
Understanding the Vulkan application
Driver
Application
WSI
SPIR-V
LunarG SDK
Getting started with the Vulkan programming model
Hardware initialization
Window presentation surfaces
Resource setup
Pipeline setup
Descriptor sets and descriptor pools
Shaders with SPIR-V
Pipeline management
Recording commands
Queue submission
Summary
2. Your First Vulkan Pseudo Program
Installing Vulkan
The Hello World!!! pseudocode
Initialization - a handshake with the device
Swapchain initialization - querying the WSI extension
Command buffer initialization - allocating command buffers
Resource objects - managing images and buffers
Creating a presentation surface - creating a swapchain
Creating a depth image
Resource allocation - allocating and binding device memory
Supplying shaders - shader compilation into SPIR-V
Building layouts - descriptor and pipeline layouts
Creating a Render Pass - defining a pass attribute
Framebuffer - connect drawing images to the Render Pass
Populating geometry - storing a vertex into GPU memory
Pipeline state management - creating pipelines
Defining states
Creating a graphics pipeline
Executing the Render Pass - drawing Hello World!!!
Acquiring the drawing surface
Preparing the Render Pass control structure
Render Pass execution
Queue submission and synchronization - sending jobs
Displaying with presentation layer - rendering a triangle
Fitting it all together
Summary
3. Shaking Hands with the Device
Getting started with the LunarG SDK
Setting up our first project with CMake
How to build the CMake file
Introduction to extensions
Querying layers and extensions
Creating a Vulkan instance
Enabling layers and extensions
Testing the enabled layers and extensions
Understanding physical and logical devices
Physical devices
Enumerating physical devices
Querying physical device extensions
Getting the properties of a physical device
Interrogating memory properties from the physical device
Logical device
Creating a logical device
Waiting on the host
Losing the device
Understanding queues and queue families
Querying queue families
Storing the graphics queue handle
Creating a queue
Implementing devices and queues all together
Summary
4. Debugging in Vulkan
Peeking into Vulkan debugging
Understanding LunarG validation layers and their features
Implementing debugging in Vulkan
Summary
5. Command Buffer and Memory Management in Vulkan
Getting started with command buffers
Explicit synchronization
Types of command in command buffers
Command buffers and queues
The order of execution
Understanding command pool and buffer APIs
Creating a command pool
Resetting a command pool
Destroying a command pool
Command buffer allocation
Resetting command buffers
Freeing command buffers
Recording command buffers
Queue submission
Queue waiting
Implementing the wrapper class for a command buffer
Implementing the command buffer allocation process
Recording the command buffer allocation process
How to use command buffer recording functions
Submitting the command to the queue
Managing memory in Vulkan
Host memory
Device memory
Allocating device memory
Freeing up device memory
Accessing device memory from the host
Lazily allocated memory
Summary
6. Allocating Image Resources and Building a Swapchain with WSI
Getting started with image resources
Image creation overview
Understanding image resources
Creating images
Destroying the created images
Understanding image layouts
Creating an image view
Destroying the image view
Memory allocation and binding image resources
Gathering memory allocation requirements
Allocating physical memory on the device
Binding the allocated memory to an image object
Introducing swapchains
Understanding the swapchain implementation flow
The swapchain implementation's class block diagram
Renderer - a window management custom class
Creating the presentation window
Initializing the renderer
Creating the command pool
Building swapchain and depth images
Rendering the presentation window
VulkanSwapChain - the swapchain manager
Querying swapchain extensions
Creating the surface with WSI and associating it with the created window
The graphics queue with present support
Querying swapchain image formats
Creating the swapchain
Swapchain surface capabilities and the presentation mode
Managing presentation mode information
Retrieving the swapchain's color images
Creating color image views
Creating a depth image
Introduction to tiling
Creating a depth buffer image object
Getting the depth image's memory requirements
Determining the type of memory
Allocating and binding physical memory to a depth image
Image layout transition
Image layout transition with memory barriers
Creating the image view
Summarizing the application flow
Initialization
Rendering - displaying the output window
Summary
7. Buffer Resource, Render Pass, Framebuffer, and Shaders with SPIR-V
Understanding the Vulkan buffer resource type
Creating the buffer resource object
Destroying the buffer
Creating a buffer view
Destroying the buffer view
Creating geometry with a buffer resource
Preparing geometry data
Creating a vertex buffer
Buffer creation overview
Implementing a buffer resource - creating the vertex buffer for the geometry
Understanding the code flow
Understanding a Render Pass
Attachments
Subpasses
Vulkan APIs for the Render Pass
Implementing the Render Pass
Using the Render Pass and creating the framebuffer
Implementing the framebuffer
Clearing the background color
Setting the background color in the Render Pass instance
Rendering the colored background
Working with a shader in Vulkan
Introduction to SPIR-V
Compiling a GLSL shader into SPIR-V
Offline compilation with the glslangValidator executable
Online compilation with SPIR-V tool libraries
Implementing a shader
Summary
8. Pipelines and Pipeline State Management
Getting started with pipelines
VulkanPipeline - the pipeline implementation class
Caching pipeline objects with a PCO
Creating a pipeline cache object
Merging pipeline caches
Retrieving data from pipeline caches
Implementing the PCO
Creating a graphics pipeline
Implementing a graphics pipeline
Destroying pipelines
Understanding compute pipelines
Pipeline State Objects (PSO) in Vulkan
Dynamic states
Implementing dynamic states
Vertex input states
Implementing vertex input states
Input assembly states
Implementing input assembly states
Primitive restart
Primitive topologies
Primitives topologies with no adjacency
Primitives topologies with adjacency
Rasterization
Rasterization states
Implementing rasterization states
Blending
Color blend states
Implementing color blend states
Viewport management
The viewport state
Implementing the viewport state
Depth and stencil tests
Depth and stencil states
Implementing depth stencil states
Multisample states
Implementing multisample states
Implementing the pipeline
Summary
9. Drawing Objects
Overview of the drawing process in Vulkan
Walking through the header declaration
Preparing the drawing object
Recording Render Pass commands
Beginning Render Pass instance recording
Transitioning to the next subpass
Finishing Render Pass instance recording
Implementation
Binding pipeline object
Implementation
Specifying drawing object geometry information
Implementation
Defining a dynamic viewport
Implementation
Scissoring
Implementation
Draw command
vkCmdDraw command
Implementing drawing object preparation
Rendering the drawing object
Acquiring the swapchain image
Executing the drawing command buffer object
Displaying the output with the presentation engine
Implementing drawing object rendering
Rendering an indexed geometry
Understanding synchronization primitives in Vulkan
Fences
Semaphores
Events
Resizing the display window
Summary
10. Descriptors and Push Constant
Understanding the concept of descriptors
VulkanDescriptor - a user-defined descriptor class
Descriptor set layout
Implementing the descriptor set layout
Destroying the descriptor set layout
Understanding pipeline layouts
Creating a pipeline layout
Implementing the pipeline layout creation
Destroying the pipeline layout
Implementing the pipeline layout destruction process
Descriptor pool
Creating a descriptor pool
Implementing the creation of the descriptor pool
Destroying the descriptor pool
Implementing the destruction of the descriptor pool
Creating the descriptor set resources
Creating the descriptor sets
Allocating the descriptor set object from the descriptor pool
Destroying the allocated descriptor set objects
Associating the resources with the descriptor sets
Implementing descriptor set creation
How to implement Uniforms in Vulkan?
Prerequisites
Execution model overview
Initialization
Shader implementation
Creating descriptors
Rendering
Binding the descriptor set
Update
Updating the transformation
Push constant updates
Defining the push constant resource in the shader
Updating the pipeline layout with the push constant
Updating the resource data
Summary
11. Drawing Textures
Image resource - a quick recap
Prerequisites for texture drawing
Specifying the texture coordinates
Updating the shader program
Loading the image files
Using the GLI library
Local image data structure
Implementing the image resource with linear tiling
Loading the image file
Creating the image object
Memory allocation and binding
Populating the allocated device memory
Creating the command buffer object
Setting the image layout
Submitting the command buffer
Creating an image sampler
Filtering
Wrapping modes
Creating the image view
Implementing the image resource with optimal tiling
Loading the image file
Buffer object memory allocation and binding
Populating the allocated device memory
Creating the image object
Image object memory allocation and binding
Creating a command buffer object
Setting the image layout
Buffer to image copy
Setting the optimal image layout
Submitting the command buffer
Creating an image sampler
Creating the image view
Copying data content between images and buffers
Updating the descriptor set
Summary
Learning Vulkan
Table of Contents Learning Vulkan Credits About the Author Acknowledgments About the Reviewer www.PacktPub.com Why subscribe? Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Downloading the color images of this book Errata Piracy Questions 1. Getting Started with the NextGen 3D Graphics API Vulkan and its evolution Vulkan versus OpenGL Important jargons before we get started Learning the fundamentals of Vulkan Vulkan's execution model Vulkan's queues The object model Object lifetime and command syntax Error checking and validation Understanding the Vulkan application Driver Application WSI SPIR-V LunarG SDK Getting started with the Vulkan programming model Hardware initialization Window presentation surfaces Resource setup
Pipeline setup Descriptor sets and descriptor pools Shaders with SPIR-V Pipeline management Recording commands Queue submission Summary 2. Your First Vulkan Pseudo Program Installing Vulkan The Hello World!!! pseudocode Initialization - a handshake with the device Swapchain initialization - querying the WSI extension Command buffer initialization - allocating command buffers Resource objects - managing images and buffers Creating a presentation surface - creating a swapchain Creating a depth image Resource allocation - allocating and binding device memory Supplying shaders - shader compilation into SPIR-V Building layouts - descriptor and pipeline layouts Creating a Render Pass - defining a pass attribute Framebuffer - connect drawing images to the Render Pass Populating geometry - storing a vertex into GPU memory Pipeline state management - creating pipelines Defining states Creating a graphics pipeline Executing the Render Pass - drawing Hello World!!! Acquiring the drawing surface Preparing the Render Pass control structure Render Pass execution Queue submission and synchronization - sending jobs Displaying with presentation layer - rendering a triangle Fitting it all together Summary 3. Shaking Hands with the Device Getting started with the LunarG SDK Setting up our first project with CMake How to build the CMake file Introduction to extensions Querying layers and extensions Creating a Vulkan instance Enabling layers and extensions Testing the enabled layers and extensions
Understanding physical and logical devices Physical devices Enumerating physical devices Querying physical device extensions Getting the properties of a physical device Interrogating memory properties from the physical device Logical device Creating a logical device Waiting on the host Losing the device Understanding queues and queue families Querying queue families Storing the graphics queue handle Creating a queue Implementing devices and queues all together Summary 4. Debugging in Vulkan Peeking into Vulkan debugging Understanding LunarG validation layers and their features Implementing debugging in Vulkan Summary 5. Command Buffer and Memory Management in Vulkan Getting started with command buffers Explicit synchronization Types of command in command buffers Command buffers and queues The order of execution Understanding command pool and buffer APIs Creating a command pool Resetting a command pool Destroying a command pool Command buffer allocation Resetting command buffers Freeing command buffers Recording command buffers Queue submission Queue waiting Implementing the wrapper class for a command buffer Implementing the command buffer allocation process Recording the command buffer allocation process How to use command buffer recording functions Submitting the command to the queue
Managing memory in Vulkan Host memory Device memory Allocating device memory Freeing up device memory Accessing device memory from the host Lazily allocated memory Summary Getting started with image resources Image creation overview Understanding image resources Creating images Destroying the created images Understanding image layouts Creating an image view Destroying the image view Memory allocation and binding image resources Gathering memory allocation requirements Allocating physical memory on the device Binding the allocated memory to an image object Introducing swapchains Understanding the swapchain implementation flow The swapchain implementation's class block diagram Renderer - a window management custom class Creating the presentation window Initializing the renderer Creating the command pool Building swapchain and depth images Rendering the presentation window VulkanSwapChain - the swapchain manager Querying swapchain extensions 6. Allocating Image Resources and Building a Swapchain with WSI Creating the surface with WSI and associating it with the created window The graphics queue with present support Querying swapchain image formats Creating the swapchain Swapchain surface capabilities and the presentation mode Managing presentation mode information Retrieving the swapchain's color images Creating color image views Creating a depth image Introduction to tiling
Creating a depth buffer image object Getting the depth image's memory requirements Determining the type of memory Allocating and binding physical memory to a depth image Image layout transition Image layout transition with memory barriers Creating the image view Summarizing the application flow Initialization Rendering - displaying the output window Summary Understanding the Vulkan buffer resource type Creating the buffer resource object Destroying the buffer Creating a buffer view Destroying the buffer view Creating geometry with a buffer resource 7. Buffer Resource, Render Pass, Framebuffer, and Shaders with SPIR-V Preparing geometry data Creating a vertex buffer Buffer creation overview Implementing a buffer resource - creating the vertex buffer for the geometry Understanding the code flow Understanding a Render Pass Attachments Subpasses Vulkan APIs for the Render Pass Implementing the Render Pass Using the Render Pass and creating the framebuffer Implementing the framebuffer Clearing the background color Setting the background color in the Render Pass instance Rendering the colored background Working with a shader in Vulkan Introduction to SPIR-V Compiling a GLSL shader into SPIR-V Offline compilation with the glslangValidator executable Online compilation with SPIR-V tool libraries Implementing a shader Summary 8. Pipelines and Pipeline State Management Getting started with pipelines
VulkanPipeline - the pipeline implementation class Caching pipeline objects with a PCO Creating a pipeline cache object Merging pipeline caches Retrieving data from pipeline caches Implementing the PCO Creating a graphics pipeline Implementing a graphics pipeline Destroying pipelines Understanding compute pipelines Pipeline State Objects (PSO) in Vulkan Dynamic states Implementing dynamic states Vertex input states Implementing vertex input states Input assembly states Implementing input assembly states Primitive restart Primitive topologies Primitives topologies with no adjacency Primitives topologies with adjacency Rasterization Rasterization states Implementing rasterization states Blending Color blend states Implementing color blend states Viewport management The viewport state Implementing the viewport state Depth and stencil tests Depth and stencil states Implementing depth stencil states Multisample states Implementing multisample states Implementing the pipeline Summary 9. Drawing Objects Overview of the drawing process in Vulkan Walking through the header declaration Preparing the drawing object Recording Render Pass commands
分享到:
收藏