Book Image

iOS 9 Game Development Essentials

By : Chuck Gaffney
Book Image

iOS 9 Game Development Essentials

By: Chuck Gaffney

Overview of this book

Table of Contents (15 chapters)
iOS 9 Game Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The basic Metal object/code structure


To finish off our talk about Apple Metal, let's look at an overview of the API's object and code structuring. We already briefly saw some shader code in the Metal Shading Language, so let's see how we can work with this API in our projects.

Objects

Purpose

Device

Reference to the GPU

Command queue

Serial sequence of command buffers

Command buffer

Contains GPU hardware commands

Command encoder

Translates API commands to GPU hardware commands

State

Framebuffer configuration, depth, samplers, blend, and so on

Code

Shaders (vertex, fragment, geometry, and tessellation)

Resources

Textures and Data Buffer Objects (vertices, constants, and so on)

The preceding table represents the various types of objects that we'd work with if writing a game directly in the Metal API. They are the Device, the State, the Command Buffer, our Shaders, Textures, and many more.

We can import the Metal API into ViewController.swift class with the following:

import Metal...