122
Efficient 3D-Clipping Code Computation Using
AMD Athlon™ Processor x86 Code Optimization
22007E/0—November 1999
Efficient 3D-Clipping Code Computation Using 3DNow!™
Instructions
Clipping is one of the major activities occurring in a 3D
graphics pipeline. In many instances, this activity is split into
two parts which do not necessarily have to occur consecutively:
■
Computation of the clip code for each vertex, where each
bit of the clip code indicates whether the vertex is outside
the frustum with regard to a specific clip plane.
■
Examination of the clip code for a vertex and clipping if the
clip code is non-zero.
The following example shows how to use 3DNow! instructions to
efficiently implement a clip code computation for a frustum
that is defined by:
■
-w <= x <= w
■
-w <= y <= w
■
-w <= z <= w
.DATA
RIGHT EQU 01h
LEFT EQU 02h
ABOVE EQU 04h
BELOW EQU 08h
BEHIND EQU 10h
BEFORE EQU 20h
ALIGN 8
ABOVE_RIGHT DD RIGHT
DD ABOVE
BELOW_LEFT DD LEFT
DD BELOW
BEHIND_BEFORE DD BEFORE
DD BEHIND
.CODE
;; Generalized computation of 3D clip code (out code)
;;
;; Register usage: IN MM5 y | x
;; MM6 w | z
;;
;; OUT MM2 clip code (out code)
Summary of Contents for Athlon Processor x86
Page 1: ...AMD Athlon Processor x86 Code Optimization Guide TM...
Page 12: ...xii List of Figures AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 16: ...xvi Revision History AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 202: ...186 Page Attribute Table PAT AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 252: ...236 VectorPath Instructions AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 256: ...240 Index AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...