The Modern Vulkan Cookbook - Preetish Kakkar - E-Book

The Modern Vulkan Cookbook E-Book

Preetish Kakkar

0,0
29,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Vulkan is a graphics API that gives the program total control of the GPU, allowing the GPU to be used to its full potential. This cookbook will uncover useful techniques for emerging new technologies, such as hybrid rendering, extended reality – mixed reality (MR), augmented reality (AR), virtual reality (VR) – and GPU-driven rendering, and even features a dedicated chapter to help you debug and profile your graphics applications with tips and tricks tested in real-world scenarios.
The book starts by explaining basic Vulkan concepts while guiding you through the implementation of a basic graphics engine. The building blocks presented in the first few chapters will then help you implement more advanced techniques and algorithms, while getting you acquainted with the inner workings of Vulkan. Gradually, you’ll discover how Vulkan can be used to build hybrid renderers as well as leveraged for the future of graphics with AR/VR/MR. Moreover, you’ll gain an understanding of how it can be debugged or measured for performance.
By the end of this book, you’ll be well versed in how to use Vulkan to write graphics applications and how graphics algorithms are implemented using Vulkan.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 351

Veröffentlichungsjahr: 2024

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



The Modern Vulkan Cookbook

A practical guide to 3D graphics and advanced real-time rendering techniques in Vulkan

Preetish Kakkar

Mauricio Maurer

The Modern Vulkan Cookbook

Copyright © 2024 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Rohit Rajkumar

Publishing Product Manager: Kaustubh Manglurkar

Book Project Manager: Sonam Pandey

Senior Editor: Nathanya Dias

Technical Editor: Reenish Kulshrestha

Copy Editor: Safis Editing

Indexer:Pratik Shirodkar

Production Designer: Prafulla Nikalje

DevRel Marketing Coordinators: Anamika Singh and Nivedita Pandey

First published: April 2024

Production reference: 1150324

Published by Packt Publishing Ltd.Grosvenor House 11 St Paul’s SquareBirmingham B3 1RB, UK

ISBN 978-1-80323-998-9

www.packtpub.com

To my mother, Subhash, for her sacrifices and unwavering support. Without her, the creation of this book would not have been possible.

– Preetish Kakkar

To my son, the light of my life.

– Mauricio Maurer

Contributors

About the authors

Preetish Kakkar is a senior computer graphics engineer with Adobe and works on the rendering engine that powers products such as Aero, Stager, and After Effects. He has worked at Microsoft, MathWorks, and Stryker, where he co-authored various rendering engines as well as using other engines such as Unreal and Unity. He has more than 15 years of software development experience along with 10+ years in 3D graphics, scientific visualization, and medical imaging.

In the journey of life, and in the path of my writing, I have been blessed with the unwavering support of some exceptional individuals. I am immensely grateful to my wife, Saloni, and my son, Aarush, who has been my rock and my sanctuary, and to my parents, who were my first teachers and my guiding lights. Their faith in me, their encouragement, and their love have been my strength and my inspiration.

Mauricio Maurer is a computer graphics engineer with nearly 20 years of experience working with 2D and 3D rendering, computational geometry, and rasterization in the fields of scientific visualization, CAD/CAM, and social networking. He is currently a graphics software engineer at Meta, helping to develop the next generation of AR/VR devices. Mauricio holds two master’s degrees in computer science with a specialization in computer graphics from SUNY Stony Brook, NY, and the Federal University of Parana, Brazil.

I would like to thank my wife, Silvye, without whom this work would not have been possible.

About the reviewers

Kevin Nappoly is a software engineer at Enduring Games, specializing in graphics/rendering, where he also leads engineering project efforts. He has shipped six games across multiple current and previous generations of consoles and PC. During his tenure, he has worked with Vulkan, DirectX 12, DirectX 11, OpenGL, and other proprietary graphics APIs, and is very much interested in the low-level optimizations that go into game engine architecture and design.

Mausam Yadav is a distinguished graduate of the National Institute of Technology (NITP) Patna, with a passion for technological innovation. As a Graphics Processing Unit (GPU) software engineer at Qualcomm, Mausam’s expertise and experience have established him as a leader in his field. His professional journey includes valuable contributions to prominent hardware and software companies such as Balize and Embinsys Technologies.

Mausam’s dedication to cutting-edge research in accelerator architecture and systems, coupled with his extensive work on GPUs and Graph Streaming Processor (GSP), has solidified his reputation as a trailblazer in the realm of technology.

Table of Contents

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Sections

Getting ready

How to do it…

How it works…

There’s more…

See also

Get in touch

Reviews

Share Your Thoughts

Download a free PDF copy of this book

1

Vulkan Core Concepts

Technical requirements

Getting to know the Vulkan API

Calling API functions

Getting ready

How to do it…

Learning about Vulkan objects

Getting ready

How to do it…

Using Volk to load Vulkan functions and extensions

Getting ready

How to do it…

Using Vulkan extensions correctly

Getting ready

How to do it…

Using the Validation Layer for error checking

Getting ready

How to do it…

Enumerating available instance layers

Getting ready

How to do it…

Enumerating available instance extensions

Getting ready

How to do it…

Initializing the Vulkan instance

Getting ready

How to do it…

Creating a surface

Getting ready

How to do it…

Enumerating Vulkan physical devices

Getting ready

How to do it…

Caching the properties of queue families

Getting ready

How to do it…

Enumerating physical device extensions

Getting ready

How to do it…

Reserving queue families

Getting ready

How to do it…

Creating a Vulkan logical device

Getting ready

How to do it…

Retrieving the queue object handle

Getting ready

How to do it…

Creating a command pool

Getting ready

How to do it…

Allocating, recording, and submitting commands

Getting ready

How to do it…

Reusing command buffers

Getting ready

How to do it…

Creating render passes

Getting ready

How to do it…

Creating framebuffers

Getting ready

How to do it…

Creating image views

Getting ready

How to do it…

The Vulkan graphics pipeline

How to do it...

Compiling shaders to SPIR-V

Getting ready

How to do it…

Dynamic states

Getting ready

How to do it…

Creating a graphics pipeline

Getting ready

How to do it…

Swapchain

Getting ready

How to do it…

Understanding synchronization in the swapchain – fences and semaphores

Getting ready

How to do it…

Populating submission information for presentation

Getting ready

How to do it…

Presenting images

Getting ready

How to do it…

Rendering a triangle

Getting ready

How to do it…

2

Working with Modern Vulkan

Technical requirements

Understanding Vulkan’s memory model

Getting ready

How to do it…

Instantiating the VMA library

How to do it…

Creating buffers

Getting ready

How to do it…

Uploading data to buffers

Getting ready

How to do it…

Creating a staging buffer

Getting ready

How to do it…

How to avoid data races using ring buffers

Getting ready

How to do it…

Setting up pipeline barriers

Getting ready

How to do it…

Creating images (textures)

Getting ready

How to do it…

Creating an image view

Getting ready

How to do it…

Creating a sampler

Getting ready

How to do it…

Providing shader data

Getting ready

How to do it…

Specifying descriptor sets with descriptor set layouts

Getting ready

How to do it…

Passing data to shaders using push constants

Getting ready

How to do it…

Creating a pipeline layout

Getting ready

How to do it…

Creating a descriptor pool

Getting ready

How to do it…

Allocating descriptor sets

Getting ready

How to do it…

Updating descriptor sets during rendering

Getting ready

How to do it…

Passing resources to shaders (binding descriptor sets)

Getting ready

How to do it…

Updating push constants during rendering

Getting ready

How to do it…

Customizing shader behavior with specialization constants

Getting ready

How to do it…

Implementing MDI and PVP

Implementing MDI

Getting ready

How to do it…

Using PVP

Getting ready

How to do it…

Adding flexibility to the rendering pipeline using dynamic rendering

Getting ready

How to do it…

Transferring resources between queue families

Getting ready

How to do it…

3

Implementing GPU-Driven Rendering

Technical requirements

Implementing GPU-driven line rendering

Getting ready

How to do it…

Expanding line-drawing techniques to render textual values from shaders

Getting ready

How to do it…

Drawing text using SDF

Getting ready

How to do it…

See also

Frustum culling using compute shaders

Getting ready

How to do it…

How it works…

4

Exploring Techniques for Lighting, Shading, and Shadows

Technical requirements

Implementing G-buffer for deferred rendering

Getting ready

How to do it...

Implementing screen space reflections

Getting ready

How to do it...

See also

Implementing shadow maps for real-time shadows

Getting ready

How to do it...

There’s more …

See also

Implementing screen space ambient occlusion

Getting ready

How to do it...

See also

Implementing a lighting pass for illuminating the scene

Getting ready

How to do it…

5

Deciphering Order-Independent Transparency

Technical requirements

Implementing Depth-Peeling

Getting ready

How to do it…

Implementing Dual Depth-Peeling

Getting ready

How to do it…

Implementing Linked-List Order-Independent Transparency

Getting ready

How to do it…

There’s more…

See also

Implementing Weighted Order-Independent Transparency

Getting ready

How to do it…

There’s more…

See also

6

Anti-Aliasing Techniques

Technical requirements

Enabling and using Vulkan’s MSAA

Getting ready

How to do it...

Applying FXAA

Getting ready

How to do it...

Utilizing TAA

Getting ready

How to do it...

Applying DLSS

Getting ready

How to do it...

See also

7

Ray Tracing and Hybrid Rendering

Technical requirements

Implementing a GPU ray tracer

Monte Carlo method

Getting ready

How to do it...

See also

Implementing hybrid rendering

Getting ready

How to do it...

8

Extended Reality with OpenXR

Technical requirements

Getting started with OpenXR

Getting ready

How to do it…

See also

How to implement single pass multiview rendering

Getting ready

How to do it…

Implementing static foveated rendering with a fragment density map

Getting ready

How to do it…

See also

Retrieving eye gaze information from OpenXR in your app

Getting ready

How to do it…

Implementing dynamic foveated rendering using Qualcomm’s fragment density map Offset extension

Getting ready

How to do it…

Using half floats to reduce memory load

Getting ready

How to do it…

9

Debugging and Performance Measurement Techniques

Technical requirements

Frame debugging

Getting ready

How to do it…

See also

Naming Vulkan objects for easy debugging

Getting ready

How to do it…

Printing values from shaders in Vulkan

Getting ready

How to do it…

Intercepting validation layer messages

Getting ready

How to do it…

Retrieving debug information from shaders

Getting ready

How to do it…

Measuring performance in Vulkan with timestamp queries

Getting ready

How to do it…

Index

Other Books You May Enjoy