
Vulkan Tutorial Alexander Overvoorde August 2018 Contents 1 Introduction 7 About....................................7 E-book....................................8 Tutorial structure . .8 2 Overview 10 Origin of Vulkan . 10 What it takes to draw a triangle . 11 Step 1 - Instance and physical device selection . 11 Step 2 - Logical device and queue families . 11 Step 3 - Window surface and swap chain . 12 Step 4 - Image views and framebuffers . 12 Step 5 - Render passes . 12 Step 6 - Graphics pipeline . 13 Step 7 - Command pools and command buffers . 13 Step 8 - Main loop . 14 Summary . 14 API concepts . 15 Coding conventions . 15 Validation layers . 15 3 Development environment 17 Windows . 17 Vulkan SDK . 17 GLFW . 19 GLM.................................. 19 Setting up Visual Studio . 21 Linux .................................... 27 Vulkan SDK . 27 GLFW . 28 GLM.................................. 30 Setting up a makefile project . 30 MacOS . 34 Vulkan SDK . 34 1 GLFW . 34 GLM.................................. 36 Setting up Xcode . 36 4 Base code 42 General structure . 42 Resource management . 44 Integrating GLFW . 44 5 Instance 47 Creating an instance . 47 Checking for extension support . 49 Cleaning up . 50 6 Validation layers 51 What are validation layers? . 51 Using validation layers . 52 Message callback . 54 Configuration . 60 7 Physical devices and queue families 61 Selecting a physical device . 61 Base device suitability checks . 63 Queue families . 65 8 Logical device and queues 67 Introduction . 67 Specifying the queues to be created . 68 Specifying used device features . 68 Creating the logical device . 68 Retrieving queue handles . 70 9 Window surface 71 Window surface creation . 71 Querying for presentation support . 73 Creating the presentation queue . 74 10 Swap chain 76 Checking for swap chain support . 76 Querying details of swap chain support . 78 Choosing the right settings for the swap chain . 80 Surface format . 80 Presentation mode . 82 Swap extent . 83 Creating the swap chain . 84 Retrieving the swap chain images . 88 2 11 Image views 90 12 Introduction 93 13 Shader modules 97 Vertex shader . 98 Fragment shader . 100 Per-vertex colors . 101 Compiling the shaders . 102 Loading a shader . 104 Creating shader modules . 105 Shader stage creation . 106 14 Fixed functions 108 Vertex input . 108 Input assembly . 109 Viewports and scissors . 109 Rasterizer . 111 Multisampling . 112 Depth and stencil testing . 113 Color blending . 113 Dynamic state . 115 Pipeline layout . 116 Conclusion . 116 15 Render passes 118 Setup . 118 Attachment description . 119 Subpasses and attachment references . 120 Render pass . 121 16 Conclusion 123 17 Framebuffers 126 18 Command buffers 129 Command pools . 129 Command buffer allocation . 131 Starting command buffer recording . 132 Starting a render pass . 133 Basic drawing commands . 134 Finishing up . 135 19 Rendering and presentation 136 Setup . 136 Synchronization . 136 Semaphores . 137 3 Acquiring an image from the swap chain . 138 Submitting the command buffer . 139 Subpass dependencies . 140 Presentation . 141 Frames in flight . 144 Conclusion . 149 20 Swap chain recreation 150 Introduction . 150 Recreating the swap chain . 150 Suboptimal or out-of-date swap chain . 153 Handling resizes explicitly . 155 Handling minimization . 156 21 Vertex input description 157 Introduction . 157 Vertex shader . 157 Vertex data . 158 Binding descriptions . 159 Attribute descriptions . 159 Pipeline vertex input . 161 22 Vertex buffer creation 162 Introduction . 162 Buffer creation . 162 Memory requirements . 164 Memory allocation . 166 Filling the vertex buffer . 167 Binding the vertex buffer . 168 23 Staging buffer 171 Introduction . 171 Transfer queue . 171 Abstracting buffer creation . 172 Using a staging buffer . 173 Conclusion . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages293 Page
-
File Size-