Graphics system interface6697074Abstract An interface for a graphics system includes simple yet powerful constructs that are easy for an application programmer to use and learn. Features include a unique vertex representation allowing the graphics pipeline to retain vertex state information and to mix indexed and direct vertex values and attributes; a projection matrix value set command; a display list call object command; and an embedded frame buffer clear/set command. Claims We claim: Description FIELD OF THE INVENTION
TABLE I
Opcode Opcode(7:0) Next Followed by
NOP 00000000 none none
Draw_Quads 10000vat(2:0) VertexCount(15:0) Vertex attribute
stream
Draw_Triangles 10010vat(2:0) VertexCount(15:0) Vertex attribute
stream
Draw_Triangles_strip 10011vat(2:0) VertexCount(15:0) Vertex attribute
stream
Draw_Triangle_fan 10100vat(2:0) VertexCount(15:0) Vertex attribute
steam
Draw_Lines 10101vat(2:0) VertexCount(15:0) Vertex attribute
stream
Draw_Line_strip 10110vat(2:0) VertexCount(15:0) Vertex attnbute
stream
Draw_Points 10111vat 2:0) VertexCount(15:0) Vertex attribute
stream
CP_LoadRegs 00001xxx Address[7:0] 32 bits data
(for CP only registers)
XF_LoadRegs 00010xxx none (N + 2) *32 bits
(This is used for First 32 bit:
loading all XF 15:00 register
address in XF
registers, including 19:16 number of 32
bit registers to be
matrices. It can be loaded (N + 1, 0
means 1, 0xff means 16)
used to load matrices 31:20 unused
with immediate data) Next N + 1 32 bits:
31:00 register data
XF_IndexLoadRegA 00100xxx none 32 bits
(registers are in the 11:0 register
address in XF
first 4K address space 15:12 number of 32
bit data, (0 means 1,
of the XF. It can be 0xff means 16)
used to block load 31:16 Index to the
register Array A
matrix and light
registers)
XF_IndexLoadRegB 00101xxx none 32 bits
(registers are in the 11:0 register
address in XF
first 4K address space 15:12 number of 32
bit data, (0 means 1,
of the XF It can be 0xff means 16)
used to block load 31:16 Index to the
register Array B
matrix and light
registers)
XF_IndexLoadRegC 00110xxx none 32 bits
(registers are in the 11:0 register
address in XF
first 4K address space 15:12 number of 32
bit data. (0 means 1.
of the XF. It can be 0xff means 16)
used to block load 31:16 Index to the
register Array C
matrix and light
registers)
XF_IndexLoadRegD 00111xxx none 32 bits
(registers are in the 11:0 register
address in XF
first 4K address space 15:12 number of 32
bit data. (0 means 1,
of the XF It can be 0xff means 16)
used to block load 31:16 Index to the
register Array D
matrix and light
registers)
Call_Object 01000xxx none 2 .times. 32
25:5 address (need
to be 32 byte align)
25:5 count (32 byte
count)
V$_Invalidate 01001xxx none none
SU_ByPassCmd 0110,SUattr(3:0) none 32 bit data
(This includes all the
register load below XF
and all setup unit
commands, which
bypass XF)
As shown in Table I above, the graphics command stream can include register load commands. Register commands are, in general, commands that have the effect of writing particular state information to particular registers internal to the graphics and audio processor 114. The graphics and audio processor 114 has a number of internal registers addressable by main processor 110. To change the state of the graphics and audio processor 114 in particular way, main processor 110 can write a particular value to a particular register internal to the graphics and audio processor 114. Register commands have the advantage of allowing the graphics pipeline to retain drawing state information that main processor 110 can selectively change by sending further register load commands. For example, the vertices in a draw command can all share the same vertex attribute data structure defining a number of attributes associated with a vertex. Sending all of the vertex attribute information before a draw command could be costly. It therefore may be desirable to store most of the common vertex types in registers within the graphics and audio processor 114, and to simply pass an index to the stored table. These tables may not need to be updated each time a new draw command is sent down, but may only need to be updated every once in a while. In the example embodiment, command processor 200 holds a vertex command descriptor register (VCD) and a eight-entry vertex attribute table (VAT) defining whether the attribute is present and if so whether it is indexed or direct. A "load_VCD" register command is used to update the register whenever updating is necessary. In certain situations, main processor 110 may also read the graphics and audio processor 114 internal registers to determine the state of the graphics and audio processor. For example, the main processor 110 can start and stop the graphics and audio processor 114 and/or determine its general status by reading from and/or writing to internal registers within the graphics and audio processor. Main processor 110 can also load a number of graphics values (e.g., transformation matrices, pixel formats, vertex formats, etc.) by writing to registers within the graphics and audio processor 114. As another example, main processor 110 can write to a series of FIFO control registers within the graphics and audio processor 114 that control where the graphics and audio processor 114 obtains further commands for processing. The following are example command registers used for defining transformation matrices, vertex control data, vertex attribute tables, vertex arrays, vertex stride, and other state parameters:
TABLE II
Register name Register address[7:0] Bit fields
MatrixIndexA 0011xxxx 5:0 index for position/normal
matrix
11:6 index for tex0 matrix
17:12 index for tex1 matrix
23:18 index for tex2 matrix
29:24 index for tex3 matrix
MatrixIndexB 0100xxxx 5:0 index for tex4 matrix
11:6 index for tex5 matrix
17:12 index for tex6 matrix
23:18 index for tex7 matrix
VCD_Lo 0101xxxx 16:00 VCD 12 to 0
0 PosMatIdx
1 Tex0MatIdx
2 Tex1MatIdx
3 Tex2atIdx
4 Tex3MatIdx
5 Tex4MatIdx
6 Tex5MatIdx
7 Tex6MatIdx
8 Tex7MatIdx
10:9 Position
12:11 Normal
14:13 ColorDiffused
16:15 ColorSpecular
VCD_ -Hi 0110xxxx 15:00 VCD 20 to 13
01:00 Tex0Coord
03:02 Tex1Coord
05:04 Tex2Coord
07:06 Tex3Coord
09:08 Tex4Coord
11:10 Tex5Coord
13:12 Tex6Coord
15:14 Tex7Coord
VAT_group0 0111x,vat[2:0] 32 bits
08:00 Position parameters
12:09 Normal parameters
16:13 ColorDiffused parameters
20:17 ColorSpecular parameters
29:21 Tex0Coord parameters
30:30 ByteDequant
31:31 NormalIndex3
VAT_group 1 1000x,vat[2:0] 32 bits
08:00 Tex1Coord parameters
17:09 Tex2Coord parameters
26:18 Tex3Coord parameters
30:27 Tex4Coord parameters
sub-field[3:0]
31 unused
VAT_group2 1001x.vat[2.0] 32 bits
04:00 Tex4Coord parameters
sub-field[8:4]
13.05 Tex5Coord parameters
22:14 Tex6Coord parameters
31:23 Tex7Coord parameters
ArrayBase 1010.array[3:0] 32 bit data
array[3:0]: 25:00 Base(25:)
0000 = attribute9 base register 31:26 unused
0001 = attribute10 base register
0010 = attribute11 base register
0011 = attribute12 base register
0100 = attribute13 base register
0101 = attribute14 base register
0110 = attribute15 base register
0111 = attribute16 base register
1000 = attribute17 base register
1001 = attribute18 base register
1010 = attribute19 base register
1011 = attribute20 base register
1100 = IndexRegA base register
1101 = IndexRegB base register
1110 = IndexRegC base register
1111 = IndexRegD base register
ArrayStride 1011,array[3:0] 32 bit data
array[3:0] 07:00 Stride(7:0)
0000 = attribute9 stride register 31:08 unused
0001 = attribute10 stride register
0010 = attribute11 stride register
0011 = attribute12 stride register
0100 = attribute13 stride register
0101 = attribute14 stride register
0110 = attribute15 stride register
0111 = attribute16 stride register
1000 = attribute17 stride register
1001 = attribute18 stride register
1010 = attribute19 stride register
1011 = atrribute20 stride register
1100 = IndexRegA stride register
1101 = IndexRegB stride register
1110 = IndexRegC stride register
1111 = IndexRegD stride register
In the example embodiment, the command processor 200 converts the command stream to a vertex stream which it sends to transform unit 300 for further processing. The vertex stream sent to the transform unit 300 can change based on the current mode, but the data ordering per vertex is essentially the same and is fixed as shown in the following table:
TABLE III
Location in stream
(in words) Data Description
0 to 2 X, Y, Z in 32b SPFP Geometry information
in single precision
floating point format
3 to 5 Nx, Ny, Nz in 32b SPFP Normal vector
6 RGBA in 32b integer Color0 per vertex
(8b/comp) (RGBA)
7 RGBA in 32b integer Color1 per vertex
(8b/comp) (RGBA)
8 to 10 Tx, Ty, Tz in 32b SPFP Binormal vector T
11 to 13 Bx, By, Bz in 32b SPFP Binormal vector B
14 to 15 S0, T0 in 32b SPFP Texture 0 data
16 to 29 Sn. Tn in 32b SPFP Texture 1 to n data
The location of words in the stream is order dependent, but not exact. For example, if the per-vertex color is not supplied, then the first texture will start at word 6 instead of word 8. Texture comes after color. Example Graphics Application Processing Loop FIG. 6 shows an example summary flow chart of steps that may be performed by system 50 under control of an application such as a video game program to develop graphics for display on the display 56. System 50 is first booted from boot ROM 134 (block 610). During or after system boot, main processor 110 and graphics and audio processor 114 are initialized and the operating system is also initialized (block 612). System 50 is then ready to have its logic set up for a specific application, such as a videogame (block 614). The state of the graphics and audio processor 114 is set by sending an appropriate graphics command stream to the graphics and audio processor (block 616). The system 50 is then ready to process vertex information provided through a further command stream describing a primitive in terms of vertex data structure, and draw commands (block 618). Once the embedded frame buffer 702 has a completed frame of data, further commands sent to the graphics and audio processor 114 cause the processor to copy its embedded frame buffer to an external frame buffer 113 allocated in main memory 12 (block 620). The video interface 164 is then used to display the image data in the external frame buffer on a display device (block 622). Once a completed frame is copied from the embedded frame buffer, the system is ready to begin processing the next frame, as indicated by the frame loop 624 in FIG. 6. FIG. 7 shows is greater detail some of the possible graphics commands that can be performed in connection with each of the various steps shown in FIG. 6. Example Simple Graphics Command Stream For purposes of illustration FIG. 8 shows an example simple graphics command stream drawing a single graphics primitive (e.g., a single triangle) on display 56. In this example simple graphics command stream, the first set of graphics commands initializes the graphics pipeline 180 (GXInit( )) (block 1002). When the graphics and audio processor 114 comes out of hardware reset, its internal register values are undefined and therefore need to be set by main processor 110 under control of boot ROM 134 and/or the application program. A series of initialization commands such as register load commands may be issued to set the state of graphics and audio processor 114 to a known, pre-defined state that is suitable for the particular application that is to be performed. Of course, the application can reset any of these values to any other desired value on a dynamic basis. However, to save the application work, it may be desirable for boot ROM 134 to provide a series of state-setting graphics initialization commands that set up the graphics and audio processor 114 so that it is operating in a known functioning default graphics mode. One example initialization may be to clear (set) the internal embedded frame buffer 702 to an all-black color value with z (distance) of the corresponding embedded depth buffer being set to infinite distance at each location. Such a "set copy clear" instruction effectively sets up a clean canvas onto which graphics and audio processor 114 can draw the next image, and is re-formed during an embedded frame buffer copy operation in the example embodiment. FIG. 9 shows an example binary data stream that may be sent to the graphics and audio processor 114 to control it to clear (set) its internal frame buffer 113 to a black color at each and every pixel location and to set the corresponding internal depth buffer to infinite distance at every pixel. In the particular example shown, such a command stream comprises three pixel engine register load commands: pixel engine copy clear (alpha red), pixel engine copy clear (green blue), pixel engine copy clear (z). In this example, the first portion of each register load command includes a "cp_cmd_su_bypass" command string (0x61) (where "0x" indicates hexadecimal). As explained in Table I above, this command string provides access to registers within graphics pipeline 180 below transform unit 300. This string is followed by a pixel engine register designation (0x4F in the case of a pixel engine copy clear alpha/red command), a 1-byte pad; and a 1-byte alpha value and a 1-byte red value (FF for black). A similar format is used for the pe_copy_clear_green blue command except that the last two bytes indicate the green and blue values (FF for black), and a different pixel engine register designation (0x50) is used for the green/blue register values. Similarly, the pe_copy_clear_z command is issued by sending a cp_cmd_su_bypass string (0x61) followed by a register designator 0x51 (designating a pixel engine z value register) followed by a 24-bit z (depth) value. The three set copy clear commands shown n FIG. 9 could be issued in any order (e.g., set z copy clear or set green/blue copy clear could be issued first). See FIG. 9A which shows example register formats. In response to receipt of the FIG. 9 commands, pixel engine 700 writes the specified alpha red, green, blue and z values into embedded frame buffer 702. Referring once again to FIG. 8. a next step in preparing to display an image onto display 56 may be to define the various data structures associated with the vertices of the primitive to be drawn. The FIG. 10 diagram shows, for purposes of illustration, example vertex and vertex attribute descriptors that can be used to describe vertices. In the example embodiment, all vertices within a given primitive share the same vertex descriptor and vertex attribute format. The vertex descriptor in the example embodiment describes which attributes are present in a particular vertex format and how they are transmitted from the main processor 110 (or other source) to the graphics processor 114 (e.g., either direct or indexed). The vertex attribute format describes the format (e.g., type, size, format, fixed point scale, etc.) of each attribute in a particular vertex format. The vertex attribute format together with the vertex descriptor may be thought of as the overall vertex format. The following is an example of a vertex attribute table (VAT) (see also above-referenced application Ser. No. 09/465,754 filed Dec. 17, 1999 entitled "Vertex Cache For 3D Computer Graphics") indexed by a draw command "vat" field, with each entry in the table specifying characteristics for all of the thirteen attributes:
TABLE IV
VERTEX ATTRIBUTE TABLE (VAT)
Attribute Attribute
number name bits Encoding
0 PosMatIdx 0 Position/normal matrix index.
Always direct if present
0: not present 1: present
NOTE: position and normal matrices
are stored in 2 separate RAMs in
the Xform unit, but there is a one
to one correspondence between
normal and position index. If index
"A" is used for the position,
then index "A" needs to be
used for the normal as well
1 Tex0MatIdx 1 TextCoord0 matrix index, always
direct if present
0: not present 1: present
2 Tex1MatIdx 2 TextCoord0 matrix index, always
direct if present
0: not present 1: present
3 Tex2MatIdx 3 TextCoord0 matrix index, always
direct if present
0: not present 1: present
4 Tex3MatIdx 4 TextCoord0 matrix index, always
direct if present
0: not present 1: present
5 Tex4MatIdx 5 TextCoord0 matrix index,
always direct if present
0: not resent 1: resent
6 Tex5MatIdx 6 TextCoord0 matrix index, always
direct if present
0: not present 1: present
7 Tex6MatIdx 7 TextCoord0 matrix index, always
direct if present
0: not present 1: present
8 Tex7MatIdx 8 TextCoord0 matrix index, always
direct if present
0: not present 1: present
9 Position 10:9 00: reserved 10: 8 bit index
01: direct 11: 16 bit index
10 Normal 12:11 00: not present 10: 8 bit index
01: direct 11:16 bit index
11 Color0 14:13 00: not present 10: 8 bit index
01: direct 11:16 bit index
12 Color1 16:15 00: not present 10:8 bit index
01: direct 11:16 bit index
13 Tex0Coord 18:17 00: not present
01: direct
10: 8 bit index
11: 16 bit index
14 Tex1Coord 20:19 00: not present
01: direct
10: 8 bit index
11: 16 bit index
15 Tex2Coord 22:21 00: not present
01: direct
10: 8 bit index
11: 16 bit index
16 Tex3Coord 24:23 00: not present
01: direct
10: 8 bit index
11: 16 bit index
17 Tex4Coord 26:25 00: not present
01: direct
10: 8 bit index
11: 16 bit index
18 Tex5Coord 28:27 Same as above
19 Tex6Coord 30 29 00: not present
20 Tex7Coord 32 31 01:direct
10: 8 bit index
11: 16 bit index
As described in application Ser. No. 09/465,754, as well as above, entries in the vertex descriptor information can be either direct or indexed. Indexed vertex attributes include an index to an array instead of a value. The index may be an 8-bit or 16-bit pointer into an array of attributes. In the example embodiment, there is one base address register per attribute in the command processor 200. The index is not simply an offset into the array, but rather depends on a number of factors including, for example, the number of components in the attribute; the size of the component; padding between attributes for alignment purposes; and whether multiple attributes are interleaved in the same array. To provide maximum flexibility, there is also an array stride register for each attribute. The distance between two attributes (computed by software) is loaded into this register. Calculations are used to calculate the offset and to calculate the actual memory address based on an index value. An example address calculation is as follows: Memory address=ArrayBase[I]+index*ArrayStride[I], where I is the attribute number. In one particular implementation, the ArrayBase value is a 26-bit byte address, and ArrayStride is an 8-bit value. A vertex can have direct and indirect attributes intermixed. For short values, it may be more efficient to send the actual value than a pointer to the value. Any attribute in the example embodiment can be sent directly or as in index into an array. In general, the steps required to draw a primitive include describing which attributes are present in the vertex format (i.e., define the vertex attribute table); describing whether the attributes are indexed or referenced directly (i.e., define the vertex descriptor); for indexed data, delivering a vertex array that can be referenced by array pointers and strides; describing the number of elements in each attribute and their type; describing the primitive type; and then, finally, drawing the primitive by sending the graphics processor 114 draw command with a stream of vertices that match the vertex description in attribute format (see FIG. 8, blocks 1004, 1006, 1008). FIG. 11 shows an example "set array" command used to help define a vertex format (see FIG. 8 block 1004, "Define and Align Vertex Arrays"). In the example embodiment, the example "set array" command sets the command processor array base register for a particular vertex array and also sets the array stride register for the array. FIG. 11 shows particular example binary bit patterns that may be used for this command. In this example, to set an array base register, the graphics command stream may include: an initial "0x08" value indicating "cp_cmd_load reg" (i.e., load a command processor 200 register) followed by a 2-byte value indicating which array base register is to be loaded, followed by an additional 4-byte value providing an address to the array in memory. In this particular example, the 2-byte value indicating which array base register is to be loaded has the format "0xAx", where the byte "x" following the "A" value encodes a particular one of the attributes set forth in Table IV above. Note that some of the Table IV attributes (i.e., the matrix indices) are not included in the encoding in the example embodiment. In the example embodiment, the 4-byte address in memory is encoded by providing six initial bits of 0 padding followed by a 26-bit address. Setting the array stride register value is similar except that the third and fourth bytes indicate an array stride register (e.g., "0xBx" and the following value comprises four bytes containing an initial 24-bit 0 padded value and an 8-bit stride value for the array. Referring once again to FIG. 8, a further step preliminary to issuing a draw command may be to set up a vertex descriptor and a vertex attribute table (block 1006). FIG. 12 shows an example command stream used to set a vertex descriptor. In the example embodiment, setting a vertex descriptor involves setting two associated register values ("vcd_lo" "vcd_hi") within command processor 200 in order to specify the particular vertex descriptor attributes associated with the primitive to be displayed. FIG. 12 shows particular binary encodings used to tell the graphics and audio processor 114 to load the vcd_lo and vcd_hi registers (e.g., "0x0850" for an example vcd_lo register and "0x0860" to specify loading a cp_vcd_hi register). Values following each of these 4-byte commands indicates particular vertex attribute values as shown in Table 4 above, and as encoded in the particular binary bit patterns slots shown in FIG. 12. In more detail, the vertex descriptor stored in the VCD_lo VCD_hi register includes at least one bit for each of the twenty attributes shown in Table IV, that bit generally indicating whether the attribute is provided directly or via an array. In the example embodiment, the VCD_lo register contains a 17-bit value, providing bit flags indicating direct or indexed for each of the first twelve attributes in Table IV. The particular bit encodings are shown in the last column of Table IV. Note that certain attribute encodings indicate whether or not the attribute is present (since the attribute is always direct if it is present), and certain other encodings span multiple bits and provide information as to the type of index if the attribute is indexed (e.g., the "position" value may span two bits with a value "01" for direct, "10" for 8-bit index, and "11" for 16-bit index). Similarly, the VCD_hi register contains bit fields corresponding to attributes 13-20 (i.e., texture 0 coordinate through texture 7 coordinate) as shown in Table IV above. On a more abstract level, the GXSetVtxDesc command is used to indicate whether an attribute is present in the vertex data, and whether it is indexed or direct. There is only one active vertex descriptor, known as the current vertex descriptor. A GXSetVtxDesc command can be used to set a value of GX_NONE for all the attributes in the current vertex descriptor to indicate that no data for this attribute will be present in the vertex. Once the VCD registers are cleared, the application only needs to describe attributes that it intends to provide. As shown in Table IV, possible attributes are: Position, GX_VA_POS (this attribute is required for every vertex descriptor). Normal, GX_VA_NRM, or normal/binormal/tangent, GX_VA_NBT. Color.sub.-- 0, GX_VA_CLR0. Color.sub.-- 1, GX_VA_CLR1. Up to 8 texture coordinates, GX_VA_TEX0-7. A position/normal matrix index, GX_VA_PNMTXIDX. A texture matrix index, GX_VA_TEX0MTXIDX-GX_VA_TEX7MTXIDX. The last two attributes listed are 8-bit indices which are used for referencing a transformation matrix in the on-chip matrix memory. This supports simple skinning of a character, for example. These indices are different from the other attributes in that they may only be sent as direct data. The graphics processor (GP) 114 assumes that the application will send any attribute data you have specified in the ascending order shown in Table IV, that is: Order Attribute 0 GX_VA_PNMTXIDX 1 GX_VA_TEX0MTXIDX 2 GX_VA_TEX1MTXIDX 3 GX_VA_TEX2MTXIDX 4 GX_VA_TEX3MTXIDX 5 GX_VA_TEX4MTXIDX 6 GX_VA_TEX5MTXIDX 7 GX_VA_TEX6MTXIDX 8 GX_VA_TEX7MTXIDX 9 GX_VA_POS 10 GX_VA NRM or GX_VA_NBT 11 GX_VA_CLR0 12 GX_VA_CLR1 13 GX_VA_TEX0 14 GX_VA_TEX1 15 GX_VA_TEX2 16 GX_VA_TEX3 17 GX_VA_TEX4 18 GX_VA_TEX5 19 GX_VA_TEX6 20 GX_VA_TEX7 Texture coordinates are enabled sequentially, starting at GX_VA_TEX0 Describing Attribute Data Formats FIGS. 13A and 13B show an example command stream for setting vertex attribute formats. The Vertex Attribute Format Table (VAT) allows the application to specify the format of each attribute for up to eight different vertex formats. The VAT is organized as shown in FIG. 14. The application can store eight predefined vertex formats in the table. For each attribute in a vertex, the application can specify the following: The number of elements for the attribute. The format and size information. The number of fractional bits for fixed-point formats using the scale parameter (the scale parameter is not relevant to color or floating-point data). Example Vertex Attribute Format Command (GXSetVtxAttrFmt) //format index attribute n elements format n frac bits GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S8, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); The high-level code above defines vertex attribute format zero. GX_VTXFMT0 indicates that "position" is a 3-element coordinate (x, y, z) where each element is an 8-bit 2's complement signed number. The scale value indicates the number of fractional bits for a fixed-point number, so zero indicates that the data has no fractional bits. The second command specifies that the GX_VA_CLR0 attribute has four elements (r, g, b, a) where each element is 8 bits. The matrix index format is not specified in the table because it is always an unsigned 8-bit value. The scale value is implied for normals (scale=6 or scale=14) and not needed for colors. Also, normals are assumed to have three elements, Nx, Ny, Nz (for GX_VA_NRM), and nine elements, Nx, Ny, Nz, Bx, By, Bz, Tx, Ty, Tz (for GX_VA_NBT). Normals are generally always signed values. The normal format (GX_VA_NRM) is also used for binormals/tangents (GX_VA_NBT) when they are enabled in the current vertex descriptor. The VAT in the Graphics Processor has room for eight vertex formats. The application can describe most of its attribute quantization formats early in the application, loading this table as required. Then the application provides an index into this table, which specifies the vertex attribute data format, when it starts drawing a group of primitives. If the application requires more than eight vertex formats it must manage the VAT table by reloading new vertex formats as needed. FIGS. 13A and 13B show example binary-level commands for controlling the graphics and audio processor 114 to load an example vertex attribute table (VAT). In the example embodiment, the VAT spins three separate register loads (VAT_A, VAT_B, VAT_C) so that setting a vertex attribute format involves writing values to three internal "VAT" registers within the graphics and audio processor 114, i.e.: "0x0870" [4-byte value] to write to the cp_VAT_A register, "0x0880" [4-byte value] to write to the cp_VAT_B register, and "0x0890" [4-byte value] to write to the cp_VAT_C register. As shown in FIG. 13A, the binary bit field encoding for the VAT_A register write involves providing position, normal, color 1, color 2, texture 0 coordinate, and other information (i.e., byte dequantization and normal index bits) in the binary pattern slots shown. Similarly, the binary bit field encoding for the VAT_B register write invovlves providing formatting information for texture coordinate 1, texture coordinate 2, texture coordinate 3 and part of texture coordinate 4; and the information to be stored in the VAT_C register provides attribute format information for the rest of texture coordinate 4, texture coordinate 5, texture coordinate 6 and texture coordinate 7. FIGS. 13A and 13B show the particular bit pattern encodings that may be used. Additional explanation of these particular attributes is set forth in Table V:
TABLE V
Bit Attribute Attribute CompCount CompSize Shift
amount
field number name sub-field(0) sub-field(3:1)
sub-field(8:4)
8:0 9 Position 0: two (x, y) 0: ubyte 1: byte 2: ushort
Location of decimal point
1: three 3: short 4: float 5-7 from
LSB. This shift applies
(x, y, z) reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
12:9 10 Normal 0: three 0: reserved 1: byte NA
(Byte: 6, Short: 14)
normals 2: reserved
1: nine 3: short 4: float 5-7
normals reserved
16:13 11 Color0 0: three 0: 16 bit 565 (three comp) NA
(r, g, b) 1: 24 bit 888 (three comp)
2: 32 bit 888x (three
comp)
1: four 3: 16 bit 4444 (four comp)
(r, g, b, a) 4: 24 bit 6666 (four comp)
5: 32 bit 8888 (four comp)
20:17 12 Color1 0: three 0: 16 bit 565 (three comp) NA
(r, g, b) 1: 24 bit 888 (three comp)
2: 32 bit 888x (three comp)
3: 16 bit 4444 (four comp)
1: four 4: 24 bit 6666 (four comp)
(r, g, b, a) 5: 32 bit 8888 (four comp)
29:21 13 Tex0Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1:byte 3: short 5-7 from
LSB. This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
38:30 14 Tex1Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from
LSB. This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
47:39 15 Tex2Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from LSB
This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
56:48 16 Tex3Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from LSB
This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below)
65:57 17 Tex4Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from
LSB. This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
74.66 18 Tex5Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from
LSB. This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
83.75 19 Tex6Coord 0. one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from
LSB. This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
92:84 20 Tex7Coord 0: one (s) 0: ubyte 2: ushort 4: float
Location of decimal point
1: two (s, t) 1: byte 3: short 5-7 from
LSB. This shift applies
reserved to all
u/short components and
to
u/byte components where
ByteDequant is asserted
(Below).
93:93 FLAG ByteDequant (Rev B Only) 0: Shift does not apply to
Shift applies for u/byte
u/byte
components of position and
1: Shift does apply to texture
attributes.
u/byte
94:94 FLAG NormalIndex3 (Rev B Only) 0: Single index per Normal When
nine normals selected
1: Triple index per nine- in
indirect mode, input will
Normal be
treated as three staggered
indices
(one per triple biased
by
component size), into
normal
table.
NOTE!!
First
index internally biased
by 0.
Second
index internally
biased
by 1.
Third
index internally
biassed
by 2.
Defining and Drawing Graphics Primitives FIG. 15 illustrates some of the different types of primitives supported by the graphics system 50, including: GX_POINTS--draws a point at each of the n vertices. GX_LINES--draws a series of unconnected line segments. Segments are drawn between v0 and v1, v2 and v3, etc. The number of vertices drawn should be a multiple of 2. GX_LINESTRIP--draws a series of connected lines, from v0 to v1, then from v1 to v2, and so on. If n vertices are drawn, n-1 lines are drawn. GX_TRIANGLES--draws a series of triangles (three-sided polygons) using vertices v0, v1, v2, then v3, v4, v5, and so on. The number of vertices drawn should be a multiple of 3 and the minimum number is 3. GX_TRIANGLSTRIP--draws a series of triangles (three-sided polygons) using vertices v0, v1, v2, then v1, v3, v2 (note the order), then v2, v3, v4, and so on. The number of vertices must be at least 3. GX_TRIANGLEFAN--draws a series of triangles (three-sided polygons) using vertices v0, v1, v2, then v0, v2, v3, and so on. The number of vertices must be at least 3. GX_QUADS--draws a series of non-planar quadrilaterals (4-sided polygons) beginning with v0, v1, v2, v3, then v4, v5, v6, v7, and so on. The quad is actually drawn using two triangles, so the four vertices are not required to be coplanar. it is noted that the diagonal common edge between the two triangles of a quad is oriented as shown in FIG. 11. The minimum number of vertices is 4. The application draws primitives by calling vertexfunctions (GXPosition, GXColor, etc.) between GXBegin/GXEnd pairs. The application should call a vertex function for each attribute it enables using GXSetVtxDesc( ). Each vertex function has a suffix of the form GXData[n][t], which describes the number (n) and type (t) of elements passed to the vertex function. The following case fragment demonstrates how to draw primitives using vertex functions: GXBegin(GX_TRIANGLES, GX_VTXFMT0, 3); GXPosition1x8(0); //index to position GXColor1x16(0); //index to color GXPosition1x8(1); GXColor1x16(1); GXPosition1x8(2); GXColor1x16(2); GXEnd( ); GXBegin specifies the type of primitive, an index into the VAT, and the number of vertices between the GXBegin/GXEnd pair. This information, along with the latest call to GXSetVtxDesc( ), fully describes the primitive, vertex, and attribute format. GXEnd( ) is actually a null macro that can be used to make sure that GXBegin and GXEnd are paired properly. Loading a Projection Matrix FIG. 16 shows an example binary bit stream used to load a projection matrix into transform unit 300 (see FIG. 8, block 1004). As described above in connection with FIG. 8, the application generally defines a projection matrix in order to trans rm a primitive from space into another space (e.g., object space to world space). The transform unit 300 automatically transforms the vertices in the primitive using this projection matrix. FIG. 16 shows an example binary bit stream that can be use to load a projection matrix into transform unit 300. In the example embodiment, this loading process involves sending a binary bit pattern of "0x10" to the graphics and audio processor 114 indicating "cp_cmd_xf_loadregs" followed by a 4-byte value. In this 4-byte value, the first eleven bits are 0 padding and the succeeding bits indicate a register address within t e transform unit 300 (bits 0-15) and the number of 32-bit registers within the transform unit to be loaded (bits 16-19). Following these bit patterns are a sequence of from one to sixteen 32-bit words specifying projection matrix values. In the example embodiment, every register in the transform unit 300 is mapped to a unique 32 b address. All addresses are available to the xform register load command (command 0x30). The first block is formed by the matrix memory. Its address range is 0 to 1 k, but only 256 entries are used. This memory is organized in a 64 entry by four 32 b words. Each word has a unique address and is a single precision floating point number. For block writes, the addresses auto increment. The memory is implemented in less than 4-32 b rams, then it is possible that the memory writes to this block will require a minimum write size larger than 1 word:
Register Address Definition Configuration
0x0000 Matrix Ram word 0 32b matrix data
0x0001-0x00ff Matrix Ram word (n) 32b matrix data
0x0100-0x03ff Not used
The second block of memory is mapped to the 1 k.about.1.5 k range. This memory is the normal matrix memory. It is organized as 32 rows of 3 words. Each word has a unique address and is a single precision floating point number. Also, each word written is 32 b, but only the 20 most significant bits are kept. For simplicity, the minimum granularity of writes will be 3 words:
Register Address Definition Configuration
0x0400-0x402 Normal Ram words 0,1,2 20b data
0x0403-0x045f Normal Ram word (n) 20b data
0x0460-0x05ff Not used
The third block of memory holds the dual texture transform matrices. The format is identical to the first block of matrix memory. There are also 64 rows of 4 words for these matrices. These matrices can only be used for the dual transform of regular textures:
Register Address Definition Configuration
0x0500 Matrix Ram word 0 32b matrix data
0x0501-0x05ff Matrix Ram word (n) 32b matrix data
The fourth block of memory is the light memory. This holds all the lighting information (light vectors, light parameters, etc.). Both global state and ambient state are stored in this memory. Each word written is 32 b, but only the 20 most significant bits are kept. Each row is 3 words wide. Minimum word write size is 3 words. Example Call Display List Command As described in the above-referenced patent application Ser. No. 09/726,215, filed Nov. 28, 2000 (atty. dkt. no. 723-959) entitled "Method and apparatus for Buffering Graphics Data in a Graphics System," system 50 includes a capability for calling a display list. FIG. 17 shows an example binary bit stream format used to call a display object such as a display list. In the example shown, the binary bit pattern format includes an initial "0x40" indicating "CP_CMD_CALLOBJECT", followed by a 4-byte addres of the display list in memory as well as a 4-byte count or size of the display list. The 4-byte address field may include an initial seven bits of 0 padding followed by a 25-bit value, he 4-byte count value may include an initial seven bits of padding followed by a 25-bit count value indicating the count or size of the display list in 32-byte chunks. Other Example Compatible Implementations Certain of the above-described system components 50 could be implemented as other than the home video game console configuration described above. For example, one could run graphics application or other software written for system 50 on a platform with a different configuration that emulates system 50 or is otherwise compatible with it. If the other platform can successfully emulate, simulate and/or provide some or all of the hardware and software resources of system 50, then the other platform will be able to successfully execute the software. As one example, an emulator may provide a hardware and/or software configuration (platform) that is different from the hardware and/or software configuration (platform) of system 50. The emulator system might include software and/or hardware components that emulate or simulate some or all of hardware and/or software components of the system for which the application software was written. For example, the emulator system could comprise a general purpose digital computer such as a personal computer, which executes a software emulator program that simulates the hardware and/or firmware of system 50. Some general purpose digital computers (e.g., IBM or MacIntosh personal computers and compatibles) are now equipped with 3D graphics cards that provide 3D graphics pipelines compliant with DirectX or other standard 3D graphics command APIs. They may also be equipped with stereophonic sound cards that provide high quality stereophonic sound based on a standard set of sound commands. Such multimedia-hardware-equipped personal computers running emulator software may have sufficient performance to approximate the graphics and sound performance of system 50. Emulator software controls the hardware resources on the personal computer platform to simulate the processing, 3D graphics, sound, peripheral and other capabilities of the home video game console platform for which the game programmer wrote the game software. FIG. 18A illustrates an example overall emulation process using a host platform 1201, an emulator component 1303, and a game software executable binary image provided on a storage medium 62. Host 1201 may be a general or special purpose digital computing device such as, for example, a personal computer, a video game console, or any other platform with sufficient computing power. Emulator 1303 may be software and/or hardware that runs on host platform 1201, and provides a real-time conversion of commands, data and other information from storage medium 62 into a form that can be processed by host 1201. For example, emulator 1303 fetches "source" binary-image program instructions intended for execution by system 50 from storage medium 62 and converts these program instructions to a target format that can be executed or otherwise processed by host 1201. As one example, in the case where the software is written for execution on a platform using an IBM PowerPC or other specific processor and the host 1201 is a personal computer using a different (e.g., Intel) processor, emulator 1203 fetches one or a sequence of binary-image program instructions from storage medium 1305 and converts these program instructions to one or more equivalent Intel binary-image program instructions. The emulator 1203 also fetches and/or generates graphics commands and audio commands intended for processing by the graphics and audio processor 114, and converts these commands into a format or formats that can be processed by hardware and/or software graphics and audio processing resources available on host 1201. As one example, emulator 1303 may convert these commands into commands that can be processed by specific graphics and/or or sound hardware of the host 1201 (e.g., using standard DirectX, OpenGL and/or sound APIs). An emulator 1303 used to provide some or all of the features of the video game system described above may also be provided with a graphic user interface (GUI) that simplifies or automates the selection of various options and screen modes for games run using the emulator. In one example, such an emulator 1303 may further include enhanced functionality as compared with the host platform for which the software was originally intended. FIG. 18B illustrates an emulation host system 1201 suitable for use with emulator 1303. System 1201 includes a processing unit 1203 and a system memory 1205. A system bus 1207 couples various system components including system memory 1205 to processing unit 1203. System bus 1207 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. System memory 1207 includes read only memory (ROM) 1252 and random access memory (RAM) 1254. A basic input/output system (BIOS) 1256, containing the basic routines that help to transfer information between elements within personal computer system 1201, such as during start-up, is stored in the ROM 1252. System 1201 further includes various drives and associated computer-readable media. A hard disk drive 1209 reads from and writes to a (typically fixed) magnetic hard disk 1211. An additional (possible optional) magnetic disk drive 1213 reads from and writes to a removable "floppy" or other magnetic disk 1215. An optical disk drive 1217 reads from and, in some configurations, writes to a removable optical disk 1219 such as a CD ROM or other optical media. Hard disk drive 1209 and optical disk drive 1217 are connected to system bus 1207 by a hard disk drive interface 1221 and an optical drive interface 1225, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer-readable instructions, data structures, program modules, game programs and other data for personal computer system 1201. In other configurations, other types of computer-readable media that can store data that is accessible by a computer (e.g., magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories (RAMs), read only memories (ROMs) and the like) may also be used. A number of program modules including emulator 1303 may be stored on the hard disk 1211, removable magnetic disk 1215, optical disk 1219 and/or the ROM 1252 and/or the RAM 1254 of system memory 1205. Such program modules may include an operating system providing graphics and sound APIs, one or more application programs, other program modules, program data and game data. A user may enter commands and information into personal computer system 1201 through input devices such as a keyboard 1227, pointing device 1229, microphones, joysticks, game controllers, satellite dishes, scanners, or the like. These and other input devices can be connected to processing unit 1203 through a serial port interface 1231 that is coupled to system bus 1207, but may be connected by other interfaces, such as a parallel port, game port Fire wire bus or a universal serial bus (USB). A monitor 1233 or other type of display device is also connected to system bus 1207 via an interface, such as a video adapter 1235. System 1201 may also include a modem 1154 or other network interface means for establishing communications over a network 1152 such as the Internet. Modem 1154, which may be internal or external, is connected to system bus 123 via serial port interface 1231. A network interface 1156 may also be provided for allowing system 1201 to communicate with a remote computing device 1150 (e.g., another system 1201) via a local area network 1158 (or such communication may be via wide area network 1152 or other communications path such as dial-up or other communications means). System 1201 will typically include other peripheral output devices, such as printers and other standard peripheral devices. In one example, video adapter 1235 may include a 3D graphics pipeline chip set providing fast 3D graphics rendering in response to 3D graphics commands issued based on a standard 3D graphics application programmer interface such as Microsoft's DirectX 7.0 or other version. A set of stereo loudspeakers 1237 is also connected to system bus 1207 via a sound generating interface such as a conventional "sound card" providing hardware and embedded software support for generating high quality stereophonic sound based on sound commands provided by bus 1207. These hardware capabilities allow system 1201 to provide sufficient graphics and sound speed performance to play software stored in storage medium 1305. Example Higher-Level API Cells The following show example higher level API cells that a library interprets and/or computes to create the binary level command streams described above: GXSetCopyClear Argument:
GXColor ClearColor; //Color value to clear the framebuffer to
during copy.
u32 ClearZ; //24 bit Z value to clear the framebuffer
to during copy.
This sets the two clear values used for clearing the framebuffer during copy operations. GXSetVtxDesc Arguments:
GXAttr Attr; //Which attribute (Position, Normal, Color, etc.)
GXAttrType Type; //Attribute Type (None, Direct, Indexed, etc.)
This function is used for setting the type of a single attribute in the current vertex descriptor (i.e., vertex attribute register). The vertex attribute register defines which attributes are present in a vertex and how each attribute is referenced. GXSetVtxAttrFmt Argument:
GXVtxFmt vtxfmt; //Index into the Vertex Attribute
Table (0-7).
GXAttr Attr: //Attribute Type.
GXCompCnt CompCnt; //Number of components for the attribute.
GXCompType CompType //Type of each Component.
u8 Shift: //Locatin of decimal point for fixed point
format types.
This function sets the attribute format for a single attribute in the vertex attribute format table (VAT). There are 8 vertex formats in the VAT vertex attribute array. Each register describes the data type and component types of all attributes that can be used in a vertex packet. The application can pre-program all 8 registers and then select one of them during actual drawing of the geometry. GXSetArray Arguments:
GXAttr Attr; //Attribute type.
u32 Base; //Address (25:0) of the attribute data array
in main memory.
u8 Stride; //Number of bytes between successive elements in
the attribute array.
This function sets the address and stride of the data array in main memory for each indexed attribute. The system uses these arrays to get actual data when an indexed attribute is sent with a vertex packet. GXSetProjection Arguments:
f32 Matrix[4][4] //Projection matrix.
GXProjMtxType type; //Indicates if the projection is
orthographic.
Sets projection matrix parameters. The projection matrix is specified as follows: Perspective Projection: ##EQU1## Orthographic Projection: ##EQU2## All documents referred to herein are expressly incorporated by reference as if expressly set forth. As used herein, the notation "0x" indicates a hexadecimal value. For example, "0x61" indicates a hexadecimal value. For example, "0x61" indicates a two-byte hexadecimal value of "61"--which people of ordinary skill in the art understand has a binary format of "01100001". See Table VI below for conversion of hexadecimal notation to binary notation:
TABLE VI
Hex Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
While the invention has been described in connection with what is presently considered to be the most practical and preferred embodiment, it is to be understood that the invention is not to be limited to the disclosed embodiment, but on the contrary, is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims.
|
Same subclass Same class Consider this |
||||||||||
