i
i
i
i
i
i
i
i
Chapter 18
Graphics Hardware
“Thermal issues are going to force parallelism extraction into
the software domain, and that transition will result in a more
homogeneous computing environment. The current strategy of
CPU execution separated from GPU execution by DirectX or
OpenGL will be replaced by a massive number of similar cores
executing an instruction set that works well for a wide variety
of applications, including graphics. The question will not be
heterogenous versus homogeneous, it will be a question of whose
cores win the hearts and minds of software developers.”
—Gabe Newell, Valve, 2007
Despite the fact that graphics hardware is evolving at a rapid pace, there
are some general concepts and architectures that are commonly used in its
design. Our goal in this chapter is to give an understanding of the various
hardware elements of a graphics system and how they relate to one another.
Other parts of the book discuss these in terms of their use with particular
algorithms. Here, we discuss hardware on its own terms. We begin by
discussing how the contents of the color buffer get displayed on the monitor.
The various different buffers that can be a part of a real-time rendering
system are then discussed. After that, perspective-correct interpolation is
described. We continue with an overview of graphics architecture concepts,
followed by three case studies of specific graphics systems.
18.1 Buffers and Buffering
In Section 2.4, we saw that the colors of the pixels are located in a color
buffer. Visible primitives affect these pixels. Here, we will use a simple
model to describe how the contents of the color buffer end up on the mon-
itor. The memory of the frame buffer may be located in the same memory
as the CPU uses for its tasks, in dedicated frame-buffer memory, or in video
829
i
i
i
i
i
i
i
i
830 18. Graphics Hardware
Figure 18.1. A simple display system: The color buffer is scanned by the video controller,
which fetches the colors of the pixels. These colors are in turn used to control the
intensities on the output device.
memory that can contain any GPU data but is not directly accessible to
the CPU. The color buffer is a part of the frame buffer. It is in some way
connected to a video controller, that, in turn, is connected to the moni-
tor. This is illustrated in Figure 18.1. The video controller often includes
a digital-to-analog converter (DAC), since if an analog display device is
used, the digital pixel value must be converted to an analog equivalent.
Because digital-to-analog conversion operates on every pixel of each frame,
this system must be able to deal with high bandwidths. CRT-based dis-
plays are analog devices, and hence need analog input. LCD-based displays
are digital devices, but can usually take both analog and digital input. Per-
sonal computers use the digital visual interface (DVI) or DisplayPort digi-
tal interfaces, while consumer electronics devices such as game systems and
televisions commonly use the high-definition multimedia interface (HDMI)
standard.
The rate at which a cathode ray tube (CRT) monitor updates the image
is typically between 60 and 120 times per second (Hertz). The job of the
video controller is to scan through the color buffer, scanline by scanline, at
the same rate as the monitor, and to do this in synchronization with the
beam of the monitor. During a single refresh of the image, the colors of the
pixels in the color buffer are used to control the intensities of the monitor
beam. Note that the electron beam usually moves in a left-to-right and
up-to-down manner. Because of this, the beam does not contribute to the
image on the screen when it moves from the right side to the left. This is
called the horizontal retrace. Related to this is the line rate or horizontal
refresh rate, the amount of time it takes to complete one entire left-right-left
cycle. The vertical retrace is the movement of the beam from the bottom
to the upper left corner, i.e., its return to position to begin the next frame.
This is shown in Figure 18.2. The vertical refresh rate is the number of
times per second the monitor performs this process. Most viewers notice
flicker at rates less than 72 Hz (see Section 10.14 for more information on
this).
i
i
i
i
i
i
i
i
18.1. Buffers and Buffering 831
Figure 18.2. The horizontal and vertical retraces of a monitor. The color buffer shown
here has five scanlines of pixels. The scanning of the lines starts at the upper left
corner and proceeds one scanline at a time. At the end of a scanline it stops scanning
and moves to the line below the current line. This passage is called horizontal retrace.
When the bottom right corner is reached, the scanning ends and moves back to the
upper left corner in order to be able to scan the next frame. This movement is called
vertical retrace.
A liquid crystal display (LCD) usually updates at 60 Hertz. CRTs need
a higher refresh rate because the phosphor begins to dim as soon as the
electron beam passes it. LCD cells transmit light continuously, so do not
normally require higher refresh rates. They also do not need retrace time.
The concept of vertical sync still applies to LCDs, in the sense that the
effective update rate is affected by the speed at which frames are generated.
See Section 2.1 for how these rates interact.
Related to this topic is interlacing. Computer monitors are typically
noninterlaced, or what is commonly known as progressive scan. In televi-
sion, the horizontal lines are interlaced, so that during one vertical refresh,
the odd numbered lines are drawn, and during the next one, the even
numbered lines are drawn. Filtering computer animation for television is
nontrivial [230, 1202].
18.1.1 The Color Buffer
The color buffer usually has a few color modes, based on the number of
bytes representing the color. These modes include:
High color: two bytes per pixel, of which 15 or 16 bits are used for
the color, giving 32,768 or 65,536 colors, respectively.
True color or RGB color: three or four bytes per pixel, of which 24
bits are used for the color, giving 16, 777, 216 16.8 million different
colors.
The high color mode has 16 bits of color resolution to use. Typically,
this amount is split into at least 5 bits each for red, green, and blue,
giving 32 levels of color. This leaves one bit, which is usually given to the
green channel, resulting in a 5-6-5 division. The green channel is chosen
because it has the largest luminance effect on the eye, and so requires
greater precision.
i
i
i
i
i
i
i
i
832 18. Graphics Hardware
Figure 18.3. As the rectangle is shaded from white to black, banding appears. Although
each grayscale bar has a solid intensity level, each can appear to be darker on the left
and lighter on the right due to Mach banding.
High color has a speed advantage over true color. This is because two
bytes of memory per pixel may usually be accessed more quickly than three
or four bytes per pixel. That said, the use of high color mode is fading out
for desktop graphics. However, some laptop displays use 18 bits for color,
i.e., six bits per color component.
1
In addition, mobile devices, such as
mobile phones and portable game consoles, also often use 16 or 18 bits for
color, but can also use as many as 24 bits per pixel.
With 32 or 64 levels of color in each channel, it is possible to discern
differences in adjacent color levels. The human visual system further mag-
nifies the differences due to a perceptual phenomenon called Mach band-
ing [408, 491]. See Figure 18.3. Dithering [64, 349] can lessen the effect by
trading spatial resolution for increased effective color resolution.
True color uses 24 bits of RGB
2
color, one byte per color channel. Inter-
nally, these colors may be stored as 24 or 32 bits. A 32-bit representation
can be present for speed purposes, because data access is optimized for
groups of four bytes. On some systems the extra 8 bits can also be used to
store an alpha channel (see Section 5.7), giving the pixel an RGBA value.
The 24-bit color (no alpha) representation is also called the packed pixel
format, which can save frame buffer memory in comparison to its 32-bit,
unpacked counterpart. Using 24 bits of color is almost always acceptable
for real-time rendering. It is still possible to see banding of colors, but
much less likely than with only 16 bits.
Monitors can have more than 8 bits per channel. For example, Bright-
Side Technologies, acquired by Dolby in 2007, uses a lower resolution array
of LED backlights to enhance their LCD monitors. Doing so gives their dis-
play about 10 times the brightness and 100 times the contrast of a typical
monitor [1150]. These displays are commercially available, but currently
target certain high-end markets, such as medical imaging and film post-
production.
1
The MacBook and MacBook Pro display may be in this class, as in 2007 a lawsuit
was brought alleging false claims of displaying 8 bits per channel [930].
2
On PC systems, the ordering is often reversed to BGR.
i
i
i
i
i
i
i
i
18.1. Buffers and Buffering 833
18.1.2 Z-Buffering
Depth resolution is important because it helps avoid rendering errors. For
example, say you modeled a sheet of paper and placed it on a desk, ever
so slightly above the desk’s surface.
3
With precision limits of the z-depths
computed for the desk and paper, the desk can poke through the paper at
variousspots.Thisproblemissometimescalledz-fighting.
AswesawinSection2.4,theZ-buffer (also called the depth buffer)
can be used to resolve visibility. This kind of buffer typically has 24 bits
per pixel. For orthographic viewing, the corresponding world space dis-
tance values are proportional to the z-value, and so the depth resolution is
uniform. For example, say the world space distance between the near and
far planes is 100 meters, and the Z-buffer stores 16 bits per pixel. This
means that the distance between any adjacent depth values is the same,
100 meters/2
16
, i.e., about 1.5 millimeters.
However, for perspective viewing, this is not the case; the distribution
is non-uniform. After applying the perspective transform (Equations 4.68–
4.70), a point v =(v
x
,v
y
,v
z
,v
w
) is obtained. Next, division by v
w
is
done, giving (v
x
/v
w
,v
y
/v
w
,v
z
/v
w
, 1). The value v
z
/v
w
is mapped from its
valid range (e.g., [0, 1] for DirectX) to the range [0, 2
b
1] and is stored
in the Z-buffer, where b is the number of bits. The characteristics of the
perspective transform matrix result in greater precision for objects closer
to the viewer (see page 97). This is especially true when there is a large
difference between the near and the far values. When the near value is
close to the far value, the precision tends to be uniform over the depth.
To return to the paper and desk example, this change in precision can
mean that as the viewer moves farther away from the paper, the desk
poke-through problem occurs more frequently.
18.1.3 Single, Double, and Triple Buffering
In Section 2.4, we mentioned that double buffering is used in order for
the viewer not to see the actual rendering of the primitives. Here, we will
describe single, double, and even triple buffering.
Assume that we have only a single buffer. This buffer has to be the
one that is currently shown to the viewer. As polygons for a frame are
drawn, we will see more and more of them as the monitor refreshes—an
unconvincing effect. Even if our frame rate is equal to the monitor’s update
rate, single buffering has problems. If we decide to clear the buffer or draw
a large polygon, then we will briefly be able to see the actual partial changes
3
If the paper were placed exactly at the same height as the desk, i.e., the paper
and desk were made coplanar, then there would be no right answer without additional
information about their relationship. This problem is due to poor modeling and cannot
be resolved by better z precision.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset