Автор: Matthew Scarpino
Издательство: CRC Press
Год: 2025
Страниц: 385
Язык: английский
Формат: pdf (true)
Размер: 10.1 MB
The WebGPU Sourcebook: High-Performance Graphics and Machine Learning in the Browser explains how to code web applications that access the client’s graphics processor unit, or GPU. This makes it possible to render graphics in a browser at high speed and perform computationally-intensive tasks such as machine learning. By taking advantage of WebGPU, web developers can harness the same performance available to desktop developers.
The first part of the book introduces WebGPU at a high level, without graphics theory or heavy math. The chapters in the second part are focused on graphical rendering and the rest of the book focuses on compute shaders.
Because WebGPU enables web applications to access the GPU, it’s quite possible that this final hurdle may be overcome. As I learned more about the subject, I became impressed by how simple the API was. Unlike OpenGL, WebGPU doesn’t require vertex buffer objects and vertex array objects. Unlike Vulkan, WebGPU doesn’t require lengthy swapchain and surface configuration.
I’m thrilled to have the opportunity to present this fascinating subject, and I’ve split this book’s content into three parts. The first part introduces WebGPU at a high level, without graphical rendering or computation. This part consists of Chapters 1 and 2, which presents the many jаvascript objects that applications need to create in order to access the GPU.
The chapters in the second part are focused on graphical rendering. This begins in Chapter 3, which presents the overall rendering process and introduces the types of objects that need to be created in a graphical application. Chapter 4 goes further and discusses the WebGPU Shading Language (WGSL), which is needed to code vertex and fragment shaders for graphical applications.
Chapter 5 presents two topics that are vitally important when creating three-dimensional scenes. The first involves creating uniform buffers, which store data that remains constant during the rendering process. The second topic is transformations, which make it possible to move vertices within a scene. Transformations are also necessary to define the overall shape of the scene, called the viewing region.
While Chapter 5 focuses on setting the positions of objects, Chapter 6 focuses on setting their colors. Chapter 7 explores a few advanced topics related to WebGPU, including debugging, stencil maps, and accessing video.
The third part of the book focuses on compute shaders. Chapter 8 shows how to code and execute a compute application, and explains the important topic of work groups and group-local memory. Chapter 9 shows how compute shaders can be used to implement Machine Learning. To be specific, it shows how to code a compute application that uses neural networks to classify data.
Chapter 10 explains how WebGPU makes it possible to process images and video. Chapter 11 shows how to perform operations on large matrices, which include transposition, multiplication, and factorization. Chapter 12 explains how WebGPU applications can filter audio at high speed using the Fast Fourier Transform (FFT).
Appendices A and B present topics that aren’t discussed in the WebGPU standard, but may still be of interest to readers. Appendix A explains how to code WebGPU applications with TypeScript, which adds static typing and improved error checking. Appendix B discusses the fascinating topic of Google Dawn, which makes it possible to write WebGPU programs in C/C++.
This book walks through several examples of WebGPU usage. It also:
Discusses the classes and functions defined in the WebGPU API and shows how they're used in practice.
Explains the theory of graphical rendering and shows how to implement rendering inside a web application.
Examines the theory of neural networks (Machine Learning) and shows how to create a web application that trains and executes a neural network.
Скачать The WebGPU Sourcebook: High-Performance Graphics and Machine Learning in the Browser