# The GPU - UW Extension Certificate Program in Game Development ...

Software and s/w Development

Dec 2, 2013 (5 years and 2 months ago)

176 views

UW EXTENSION

CERTIFICATE PROGRAM IN

GAME DEVELOPMENT

2
ND

QUARTER:

ADVANCED GRAPHICS

The GPU

Goals

1.
Understand how the GPU works (high
-
level)

2.
Review the basic rendering pipeline

GPU as a state machine

GPU records state and renders based on that state

Examples of state:

Resources: textures and geometry

Transformations

Alpha blending function

Render targets

State management can be complex

Multiple components must cooperate with each other

Redundant/inappropriate state changes can hurt
perf

GPU as a sequential command processor

GPU reads commands from a FIFO and runs them

CPU fills the FIFO, GPU consumes it

There is a lag between CPU and GPU

Depends on the FIFO length and run
-
time timings

If the FIFO is typically empty, the CPU is bottleneck

But there’s no lag

If the FIFO is typically full, the GPU is bottleneck

This allows CPU to do “other stuff” while GPU works

High
-
performance games require paying attention

GPU render algorithm

Convert all vertices into an internal representation

Run the vertex pipeline or vertex shader

Group internal vertices into triangles

Clip (cut) triangles to the view frustum

Rasterize the triangles into pixels

Convert the pixels into colors

Run the pixel pipeline or pixel shader

Apply colors to the output render target

What does the state specify?

It specifies how to perform all rendering operations:

Input data (geometry, textures…)

Output data (render target)

Vertex pipeline transform

Grouping, clipping and rasterization parameters

Pixel pipeline transformation

Z
-
buffer and stencil operation values

Blending formula: applying colors to render target

Sometimes, multiple states affect a single operation

Sometimes, a single state affects multiple operations

Vertex and pixel pipelines

Why move calculations between them?

It’s good for balancing the computation load

Typically there are many more pixels than vertices

Pixel stage allows us to add some detail in a balanced way,
without multiplying the calculations

Mind the extreme cases:

Far
-
away object

Many vertices with fewer pixels

Close
-
up object

Many pixels with fewer vertices

State
-
based or fully programmable (
shaders
)