万本电子书0元读

万本电子书0元读

顶部广告

Learning Vulkan电子书

售       价:¥

26人正在读 | 0人评论 6.2

作       者:Parminder Singh

出  版  社:Packt Publishing

出版时间:2016-12-01

字       数:631.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Discover how to build impressive 3D graphics with the next-generation graphics API—Vulkan About This Book Get started with the Vulkan API and its programming techniques using the easy-to-follow examples to create stunning 3D graphics Understand memory management in Vulkan and implement image and buffer resources Get hands-on with the drawing process and synchronization, and render a 3D graphics scene with the Vulkan graphics pipeline Who This Book Is For This book is ideal for graphic programmers who want to get up and running with Vulkan. It’s also great for programmers who have experience with OpenGL and other graphic APIs who want to take advantage of next generation APIs. A good knowledge of C/C++ is expected. What You Will Learn Learn fundamentals of Vulkan programing model to harness the power of modern GPU devices. Implement device, command buffer and queues to get connected with the physical hardware. Explore various validation layers and learn how to use it for debugging Vulkan application. Get a grip on memory management to control host and device memory operations. Understand and implement buffer and image resource types in Vulkan. Define drawing operations in the Render pass and implement graphics pipeline. Manage GLSL shader using SPIR-V and update the shader resources with de*or sets and push constants. Learn the drawing process, manage resources with synchronization objects and render 3D scene output on screen with Swapchain. Bring realism to your rendered 3D scene with textures, and implement linear and optimal textures In Detail Vulkan, the next generation graphics and compute API, is the latest offering by Khronos. This API is the successor of OpenGL and unlike OpenGL, it offers great flexibility and high performance capabilities to control modern GPU devices. With this book, you'll get great insights into the workings of Vulkan and how you can make stunning graphics run with minimum hardware requirements. We begin with a brief introduction to the Vulkan system and show you its distinct features with the successor to the OpenGL API. First, you will see how to establish a connection with hardware devices to query the available queues, memory types, and capabilities offered. Vulkan is verbose, so before diving deep into programing, you’ll get to grips with debugging techniques so even first-timers can overcome error traps using Vulkan’s layer and extension features. You’ll get a grip on command buffers and acquire the knowledge to record various operation commands into command buffer and submit it to a proper queue for GPU processing. We’ll take a detailed look at memory management and demonstrate the use of buffer and image resources to create drawing textures and image views for the presentation engine and vertex buffers to store geometry information. You'll get a brief overview of SPIR-V, the new way to manage shaders, and you'll define the drawing operations as a single unit of work in the Render pass with the help of attachments and subpasses. You'll also create frame buffers and build a solid graphics pipeline, as well as making use of the synchronizing mechanism to manage GPU and CPU hand-shaking. By the end, you’ll know everything you need to know to get your hands dirty with the coolest Graphics API on the block. Style and approach This book takes a practical approach to guide you through the Vulkan API, and you will get to build an application throughout the course of the book. Since you are expected to be familiar with C/C++, there is not much hand-holding throughout the course of the book.
目录展开

Learning Vulkan

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

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部