Metal Programming Guide PDF Download file - Programming Ebook

Latest

Download Programming Ebook

Facebook Page

Tuesday, December 5, 2017

Metal Programming Guide PDF Download file

Metal Programming Guide
Metal Programming Guide



Book Details 
             TitleMetal Programming Guide
      ISBN-10942568347
         Author: Janie Clayton
     Publisher: Hacking with Swift
    Language: English
        SubjectSwift / Computers & Technology / Programming / Apple Programming
No. of pages: 198
         Format: PDF



Preface 

In 2014, Apple announced a game-changing innovation that shook up 30 years of established paradigms and caused general excitement in the field of computing. Then, 10 minutes later, it introduced Swift. 

If you ask most Cocoa developers what the most exciting development was of 2014, they will overwhelmingly mention Swift. But Swift was not the only innovation Apple announced that year—the game-changer it announced was Metal, a new GPU programming framework. For decades, the default low-level graphics framework on iOS was OpenGL ES. OpenGL had grown very limited and crufty over the years. It did not take full advantage of the GPU. It did not allow general-purpose GPU programming as the newer APIs and frameworks did. Rather than adopt of one those frameworks, Apple opted to do what it usually does and roll its own implementation.

Over the years, I have seen many people attempt to pick up Metal and fail. They have different reasons for picking up Metal. Many want to prove they can learn something difficult. Some are interested in how low-level graphics work. Some want to do scientific computing. Graphics programming is an incredibly large and diverse topic, and it’s easy to get overwhelmed by the vast amount of information out there to learn. This book is the product of my years-long attempts at learning graphics programming and gaining an understanding of where people tend to get lost and give up. 

Who Should Read This Book 


Swift 4 Programming Cookbook Full Source Code


This book is targeted primarily at iOS programmers who are interested in graphics programming but don’t know quite where to begin. The book’s format was born of many years of frustration in my attempt to learn OpenGL. There were a multitude of books that went over the framework in loving detail but never made clear what someone could do with the framework. They assumed a knowledge of terminology such as textures and projection matrices that led to a lot of confusion for someone just getting started. 

This book assumes a base knowledge of Swift. If your intention is simply to understand the concepts, you can get by without being a Swift expert. However, if you’re new to iOS and are counting on this book to explain Swift and Xcode, then this book is not the best place to start. There are a number of great resources out there for learning Swift and iOS concepts. 

This book is not targeted at people who are pushing the boundaries of what Metal can do. Metal is a very broad topic, and this book focuses on an overview of the topic to give newcomers enough information to get started. It does not delve into the nuances of building a Unity-level gaming engine or highly complex recurrent neural networks. If you have such goals, this book is a good first step and should provide you with a solid foundation to build your knowledge on. 

How This Book Is Organized 

In this book, we discuss the Metal programming framework. There are two components to this framework: graphics and compute. This book provides a conceptual overview of the concepts necessary to create something useful along with specific code implementations in Metal. At the beginning of the book are foundational chapters that explain concepts you need to understand in order to work with later chapters. It can be tempting to jump directly into the final chapters on neural networking, but those chapters assume that you have read most of the ones before them and will not make sense if you don’t have a cursory understanding of the concepts introduced earlier. 

Part I, “Metal Basics,” covers introductory Metal and graphics concepts. Chapters 1, 2, and 3 correlate to much of what you would find in an introductory Metal tutorial on a website or at a conference. 

In Part II, “Rendering and Graphics,” you move into more graphics-specific libraries and concepts. Chapters 4 through 14 cover specific Metal classes, mathematics, and an introduction to the Metal Shading Language. Some of these chapters are applicable to both graphics and data processing, which is discussed in Part III, “Data Parallel Programming.” 

Part III introduces you to the Metal compute pipeline. Chapters 15 through 20 detail the Metal compute pipeline and give an overview of practical applications of GPGPU programming. Following is a brief description of each chapter. Part I focuses on the history and foundation of Metal graphics programming: 

• Chapter 1, “What Is Metal?,” gives a general introduction of Metal programming and a history of graphics programming. It also explains the scope of this book. 

• Chapter 2, “Overview of Rendering and Raster Graphics,” details how the Metal render pipeline works under the hood. This chapter gives you an idea about how all the parts connect together.

 • Chapter 3, “Your First Metal Application (Hello, Triangle!),” gives a bare-bones project to introduce you to all the Metal objects necessary to get the most basic Metal project up and running. Part II introduces the Metal render pipeline and concepts necessary to implement 3D graphics on the iPhone. 

• Chapter 4, “Essential Mathematics for Graphics,” gives a refresher of mathematical concepts used in shader programming. This chapter is meant as a gentle refresher for readers who have not used a TI-83 in at least 10 years, but it should be useful to anyone. 

• Chapter 5, “Introduction to Shaders,” walks you through implementing a slightly more complex shader. This chapter helps you to learn how to adapt algorithms and shaders in other languages to your applications. 

• Chapter 6, “Metal Resources and Memory Management,” goes over MTLResource objects and how they play into memory management. 

• Chapter 7, “Libraries, Functions, and Pipeline States,” explains how Metal shaders are compiled and accessed by the CPU.

 • Chapter 8, “2D Drawing,” goes a step beyond Chapter 3 and gives a more in-depth explanation of the objects necessary to create a 2D application. 

• Chapter 9, “Introduction to 3D Drawing,” gives an overview of 3D graphics programming concepts. 

• Chapter 10, “Advanced 3D Drawing,” explains how to apply these 3D graphics concepts to your Metal applications. 

• Chapter 11, “Interfacing with Model I/O,” explores Apple’s framework for importing 3D models and assets from programs such as Blender and Maya. 

• Chapter 12, “Texturing and Sampling,” explains how to import a texture and apply it to a model object. 

• Chapter 13, “Multipass Rendering Techniques,” gives details about how to implement more computationally expensive rendering techniques without destroying your performance. 

• Chapter 14, “Geometry Unleashed: Tessellation in Metal,” discusses how to take advantage of tessellation to utilize less detailed meshes. Part III introduces how to use the GPU for general-purpose computing, specifically image processing and neural networks. 

• Chapter 15, “The Metal Compute Pipeline,” gives the details on how the compute encoder differs from the render encoder and how to set up a data parallel Metal application. 

• Chapter 16, “Image Processing in Metal,” goes over some foundational image processing concepts. 

• Chapter 17, “Machine Vision,” builds on the foundational concepts introduced in the previous chapter to create computer vision applications. 

• Chapter 18, “Metal Performance Shaders Framework,” gives the details on what objects exist in the Metal Performance Shaders framework to implement image processing and linear algebra. 

• Chapter 19, “Neural Network Concepts,” explains what a neural network is and gives an overview of the components necessary to build one. 

• Chapter 20, “Convolutional Neural Networks,” teaches you how to take advantage of the Metal Performance Shaders to build convolutional neural network graphs. 

Example Code Throughout the book, many code examples are available to test the contents in each chapter. It is recommended that you download the sample code while you read this book. It can give you good hands-on experience and provide you with valuable insight to understand the contents of each chapter. 

The sample code was written in Swift 4 with Xcode 9. It is the author’s intention to maintain the code for future versions of Swift and Xcode. The sample code is intended to supplement the material in this book and for each project to build on the previous ones. 

The source code in this book can be found on GitHub at https://github.com/RedQueenCoder/Metal-Programming-Guide.



No comments:

Post a Comment