JP2007128180A - Arithmetic processing unit - Google Patents

Arithmetic processing unit Download PDF

Info

Publication number
JP2007128180A
JP2007128180A JP2005318754A JP2005318754A JP2007128180A JP 2007128180 A JP2007128180 A JP 2007128180A JP 2005318754 A JP2005318754 A JP 2005318754A JP 2005318754 A JP2005318754 A JP 2005318754A JP 2007128180 A JP2007128180 A JP 2007128180A
Authority
JP
Japan
Prior art keywords
data
command
vertex
coordinate
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2005318754A
Other languages
Japanese (ja)
Inventor
Shuhei Kato
周平 加藤
Koichi Sano
高一 佐野
Koichi Usami
幸一 宇佐美
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SSD Co Ltd
Original Assignee
SSD Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SSD Co Ltd filed Critical SSD Co Ltd
Priority to JP2005318754A priority Critical patent/JP2007128180A/en
Priority to PCT/JP2006/321815 priority patent/WO2007052682A1/en
Publication of JP2007128180A publication Critical patent/JP2007128180A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Abstract

<P>PROBLEM TO BE SOLVED: To provide an arithmetic processing unit allowing reduction in a processing load for command issue and overhead of a system. <P>SOLUTION: Single commands, "Affine", Pproj" and "View", can be combined and executed as one command "APV", so that the processing load of a CPU 5 for issuing a command and the overhead of the system are reduced. An intermediate value (output value of a single command) generated in the processing stage for the command "APV" is not written in a main RAM 25, and is held in registers GR0 to GR15, so that a memory area necessary for execution of the command can be reduced and a bus band necessary for memory access can be reduced. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、三次元グラフィックスにおける幾何演算を処理する演算処理装置及びその関連技術に関する。   The present invention relates to an arithmetic processing device that processes geometric operations in three-dimensional graphics and related technology.

非特許文献1には、三次元グラフィックス技術が開示されている。この文献に記載されているように、三次元グラフィックスの描画を行う場合、様々な座標変換を行わなければならない。座標変換等の幾何演算を高速に処理するための幾何演算専用プロセッサが備えられている場合、これらの演算は、それぞれの座標変換のたびに幾何演算専用プロセッサにコマンドを発行することにより行われる。あるいは、合成可能な変換行列については、予め変換行列を合成して、1コマンドの発行で一連の座標変換を同時に行い、合成不可能な変換行列については、そのためのコマンドを逐次発行して演算を行う。   Non-Patent Document 1 discloses a three-dimensional graphics technique. As described in this document, when drawing three-dimensional graphics, various coordinate transformations must be performed. When a processor dedicated to geometric operation for processing geometric operations such as coordinate transformation at high speed is provided, these operations are performed by issuing a command to the processor dedicated to geometric operation for each coordinate transformation. Alternatively, for a transformation matrix that can be synthesized, a transformation matrix is synthesized in advance, and a series of coordinate transformations are performed simultaneously by issuing one command. For a transformation matrix that cannot be synthesized, commands for that are sequentially issued and operations are performed. Do.

山岡祥著,「Turbo Cによる3Dグラフィックス」,第1版,森北出版株式会社,1995年2月10日,p.160Sho Yamaoka, “3D Graphics by Turbo C”, 1st Edition, Morikita Publishing Co., Ltd., February 10, 1995, p. 160

しかしながら、上記いずれの場合でも、必要な全ての座標変換を行うには、複数のコマンドを発行しなければならない。このため、コマンドを発行する機能ユニット(例えば、CPU等)の処理負荷が大きくなり、また、システムのオーバーヘッドが大きくなる。   However, in any of the above cases, a plurality of commands must be issued to perform all necessary coordinate transformations. For this reason, the processing load of a functional unit (for example, a CPU) that issues a command increases, and the overhead of the system also increases.

そこで、本発明は、コマンド発行のための処理負荷及びシステムのオーバーヘッドの低減を図ることができる演算処理装置及びその関連技術を提供することを目的とする。   Therefore, an object of the present invention is to provide an arithmetic processing apparatus and related technology capable of reducing the processing load for issuing commands and the overhead of the system.

本発明の第1の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、幾何演算を実行する実行手段と、外部から入力されるコマンドを解釈し、入力された前記コマンドに応じた処理を前記実行手段に実行させるように前記実行手段を制御する制御手段と、前記幾何演算に用いられる演算対象データ及び/又は前記幾何演算の結果である演算結果データを保持するデータ保持手段と、を備え、前記コマンドは、複数種類用意され、前記実行手段は、前記複数種類のコマンドのうち、第1グループに属する前記コマンドに応じて、前記演算処理装置の外部のメモリ及び/又は前記データ保持手段から前記演算対象データを受け取り、幾何演算を実行し、前記演算結果データを前記外部のメモリに出力し、前記複数種類のコマンドのうち、第2グループに属する前記コマンドは、前記第1グループに属する異なる前記コマンドの所定の組み合わせを実行することを指示する命令であり、前記実行手段は、前記第2グループに属する前記コマンドに応じて、前記所定の組み合わせに含まれる前記コマンドのうち、最初の前記コマンドを実行する際には、前記外部のメモリ及び/又は前記データ保持手段から前記演算対象データを受け取って、幾何演算を実行し、最初の前記コマンド以外の前記コマンドを実行する際には、前記データ保持手段から前記演算対象データを受け取って、幾何演算を実行し、前記所定の組み合わせに含まれる前記コマンドのうち、最後の前記コマンド以外の前記コマンドを実行後には、前記演算結果データを前記データ保持手段に出力し、最後の前記コマンドを実行後には、前記演算結果データを前記外部のメモリ及び/又は前記データ保持手段に出力する。   According to a first aspect of the present invention, an arithmetic processing device is an arithmetic processing device that processes geometric operations, and executes an input means that executes geometric operations and commands input from the outside. Control means for controlling the execution means to cause the execution means to execute processing according to the command, and calculation target data used for the geometric calculation and / or calculation result data as a result of the geometric calculation are held. A plurality of types of commands, and the execution unit includes a memory external to the arithmetic processing unit according to the commands belonging to a first group among the plurality of types of commands, / Or receiving the operation target data from the data holding means, executing a geometric operation, outputting the operation result data to the external memory, and The command belonging to the second group is an instruction for instructing execution of a predetermined combination of the different commands belonging to the first group, and the execution means includes the command belonging to the second group Accordingly, when the first command among the commands included in the predetermined combination is executed, the calculation target data is received from the external memory and / or the data holding unit, and the geometric calculation is performed. When executing the command other than the first command, the calculation target data is received from the data holding unit, a geometric operation is performed, and the last command among the commands included in the predetermined combination is executed. After executing the command other than the command, the operation result data is output to the data holding means, After executing the command after the outputs the arithmetic result data to the external memory and / or the data holding means.

この構成によれば、単独のコマンド(第1グループのコマンド:「単独コマンド」と呼ぶ。)を組み合わせて1つのコマンド(第2グループのコマンド:「複合コマンド」と呼ぶ。)として実行可能なため、コマンドを発行する機能ユニット(例えば、CPU等)の処理負荷およびシステムのオーバーヘッドが軽くなる。また、複合コマンドの処理過程で生成される中間値(単独コマンドの出力値)は、外部のメモリに書き出されず、内部のデータ保持手段に保持されるため、コマンドの実行に必要なメモリ領域を小さくできるとともに、メモリアクセスに必要なバス帯域を小さくできる。   According to this configuration, a single command (first group command: referred to as “single command”) can be combined and executed as one command (second group command: referred to as “composite command”). , The processing load of the functional unit that issues the command (for example, CPU) and the overhead of the system are reduced. Also, intermediate values (single command output values) generated during compound command processing are not written to the external memory but are held in the internal data holding means, so the memory area required for command execution is reduced. In addition, the bus bandwidth required for memory access can be reduced.

本発明の第2の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、幾何演算を実行する実行手段と、外部から入力されるコマンドを解釈し、入力された前記コマンドに応じた処理を前記実行手段に実行させるように前記実行手段を制御する制御手段と、前記幾何演算に用いられる演算対象データ及び/又は前記幾何演算の結果である演算結果データを保持するデータ保持手段と、を備え、前記実行手段は、前記制御手段からの制御に従って、入力されたデータをそのまま出力する、あるいは所定のデータ型に変換して出力する型変換手段と、前記型変換手段が出力するデータを用いて演算を実行する演算手段と、を含み、前記制御手段は、前記演算対象データを前記演算処理装置の外部のメモリ及び/又は前記データ保持手段から読み出して、前記型変換手段に入力し、前記型変換手段から出力されたデータを前記演算手段に入力し、前記演算手段から出力されるデータを前記演算結果データとして前記メモリ及び/又は前記データ保持手段に書き込むように前記実行手段を制御する。   According to the second aspect of the present invention, the arithmetic processing device is an arithmetic processing device for processing a geometric operation, and interprets and inputs an execution means for executing the geometric operation and a command input from the outside. Control means for controlling the execution means to cause the execution means to execute processing according to the command, and calculation target data used for the geometric calculation and / or calculation result data as a result of the geometric calculation are held. Data holding means, and the execution means outputs the input data as it is or converts the data into a predetermined data type according to the control from the control means, and the type conversion means Computing means for executing computation using data output by the control means, wherein the control means stores the computation object data in a memory external to the computation processing device and / or the data. Read from the holding means, input to the type conversion means, input data output from the type conversion means to the calculation means, and output data from the calculation means as the calculation result data in the memory and / or The execution means is controlled to write to the data holding means.

この構成によれば、演算対象データとしての各行列の要素のビット数を最適化して格納しておき、型変換手段によって、最適化された演算対象データを演算前に所定のデータ型に揃えることにより、演算対象データを格納するメモリ領域及びレジスタ領域を節約することができる。なお、演算対象データとしての各行列の要素の精度および表現可能範囲は必ずしも均一ではないが、型変換手段による変換後のデータ型は、演算回路の都合などで均一に揃えられている。   According to this configuration, the number of bits of each matrix element as calculation target data is optimized and stored, and the optimized calculation target data is aligned with a predetermined data type before calculation by the type conversion unit. As a result, it is possible to save a memory area and a register area for storing operation target data. Note that the accuracy and expressible range of the elements of each matrix as calculation target data are not necessarily uniform, but the data types after conversion by the type conversion means are uniformly arranged due to the convenience of the arithmetic circuit.

この演算処理装置において、前記制御手段は、入力されたコマンドが所定の行列演算の実行を命令するものである場合、入力行列中の所定の要素に対しては前記型変換手段が入力されたデータを前記所定のデータ型へ変換するように前記実行手段を制御し、前記入力行列中の前記所定の要素以外の要素に対しては、前記型変換手段が入力されたデータを前記所定のデータ型へ変換せずにそのまま出力するように前記実行手段を制御する。   In this arithmetic processing unit, when the input command is for instructing execution of a predetermined matrix operation, the control means is the data input by the type conversion means for a predetermined element in the input matrix. The execution means is controlled to convert the data into the predetermined data type, and for the elements other than the predetermined element in the input matrix, the data input by the type conversion means is converted to the predetermined data type. The execution means is controlled so as to output the data as it is without being converted into the data.

この演算処理装置において、前記型変換手段が行う前記所定のデータ型の変換は、ゼロ拡張及び/又は符号拡張である。   In this arithmetic processing unit, the conversion of the predetermined data type performed by the type conversion means is zero extension and / or sign extension.

本発明の第3の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、幾何演算を実行する実行手段と、前記幾何演算に用いられる演算対象データ及び/又は前記幾何演算の結果である演算結果データを保持するデータ保持手段と、を備え、前記実行手段は、複数の数値と1つの倍率とを含むデータを入力とし、前記複数の数値のうち1つを選択して前記倍率と乗算を行い、乗算結果を出力する数値抽出手段と、前記数値抽出手段が出力する前記乗算結果を用いて演算を実行する演算手段と、を含み、前記実行手段は、前記演算対象データを前記演算処理装置の外部のメモリ及び/又は前記データ保持手段から読み出し、前記数値抽出手段に入力し、前記数値抽出手段から出力された前記乗算結果を前記演算手段に入力し、前記演算手段から出力されるデータを前記演算結果データとして前記メモリ及び/又は前記データ保持手段に書き込む。   According to a third aspect of the present invention, the arithmetic processing device is an arithmetic processing device for processing a geometric operation, and includes an execution means for executing a geometric operation, operation target data used for the geometric operation, and / or the Data holding means for holding calculation result data which is a result of geometric calculation, and the execution means receives data including a plurality of numerical values and one magnification, and selects one of the plurality of numerical values Numerical value extraction means for performing multiplication with the magnification and outputting a multiplication result; and calculation means for executing an operation using the multiplication result output from the numerical value extraction means, wherein the execution means includes the calculation The target data is read from an external memory of the arithmetic processing unit and / or the data holding unit, input to the numerical value extracting unit, and the multiplication result output from the numerical value extracting unit is input to the arithmetic unit. Is written in the memory and / or the data holding means data output from said operation means as said operation result data.

この構成によれば、演算対象データとしての行列またはベクトルの要素に倍率を乗算したデータを演算するので、実際に演算が施されるデータのサイズを一定に保ちながら、倍率の設定変更によって、複数の、表現可能な範囲をサポートすることができる。これにより、演算対象データを格納するメモリ領域及びレジスタ領域を節約することができる。   According to this configuration, since the data obtained by multiplying the matrix or vector element as the calculation target data by the magnification is calculated, a plurality of values can be changed by changing the setting of the magnification while keeping the size of the data actually subjected to the calculation constant. The range that can be expressed can be supported. Thereby, it is possible to save a memory area and a register area for storing operation target data.

本発明の第4の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、三次元直交座標系で多角形状のグラフィック要素を定義する複数の頂点座標を入力とし、前記各頂点座標の座標変換を行う座標変換手段と、前記座標変換後の複数の頂点の、所定座標軸成分の総和を求め、求めた総和を前記多角形状のグラフィック要素の奥行き値として出力する総和算出手段と、を備える。   According to a fourth aspect of the present invention, the arithmetic processing device is an arithmetic processing device that processes geometric operations, and receives a plurality of vertex coordinates defining polygonal graphic elements in a three-dimensional orthogonal coordinate system as input, A coordinate conversion unit that performs coordinate conversion of each vertex coordinate, and calculates a sum total of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion, and outputs the calculated sum as a depth value of the polygonal graphic element Means.

この構成によれば、描画処理において、多角形状のグラフィック要素(例えば、ポリゴン)が1つの奥行き値で定義される場合(つまり、頂点ごとの奥行き値を持つことができない場合)においても、各頂点の所定座標軸成分(例えば、Z軸成分)から多角形状のグラフィック要素の奥行き値を算出することができる。   According to this configuration, even when a polygonal graphic element (for example, a polygon) is defined by one depth value in the rendering process (that is, when it is not possible to have a depth value for each vertex), each vertex The depth value of the polygonal graphic element can be calculated from the predetermined coordinate axis component (for example, the Z-axis component).

本発明の第5の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、三次元直交座標系で多角形状のグラフィック要素を定義する複数の頂点座標を入力とし、前記各頂点座標の座標変換を行う座標変換手段と、前記座標変換後の複数の頂点の、所定座標軸成分の総和を求める総和算出手段と、前記総和および前記多角形状のグラフィック要素の奥行き値の初期値を入力とし、前記総和と前記初期値とを加算し、加算結果を前記多角形状のグラフィック要素の奥行き値として出力する加算手段と、を備える。   According to a fifth aspect of the present invention, an arithmetic processing device is an arithmetic processing device that processes geometric operations, and receives a plurality of vertex coordinates that define a polygonal graphic element in a three-dimensional orthogonal coordinate system as input, A coordinate conversion unit that performs coordinate conversion of each vertex coordinate; a total calculation unit that calculates a sum of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion; and an initial value of the sum and the depth value of the polygonal graphic element Addition means for adding a value as an input, adding the sum and the initial value, and outputting the addition result as a depth value of the polygonal graphic element;

この構成によれば、多角形状のグラフィック要素(例えば、ポリゴン)の奥行き値の初期値は、奥行き値のバイアスとして機能し、これにより意図的に多角形状のグラフィック要素の描画優先順位を上げたり下げたりする表現が可能になる。   According to this configuration, the initial value of the depth value of a polygonal graphic element (for example, a polygon) functions as a depth value bias, thereby intentionally raising or lowering the drawing priority of the polygonal graphic element. Can be expressed.

上記第4の観点及び第5の観点における演算処理装置において、前記総和算出手段は、前記総和を浮動小数点数形式に変換して出力する。   In the arithmetic processing apparatus according to the fourth and fifth aspects, the sum calculation means converts the sum into a floating point number format and outputs the result.

この構成によれば、奥行き値を浮動小数点数形式で表現することにより、少ないビット数で広範な座標空間の範囲をカバーできる。また、視点に近い領域では高い精度で、遠い領域では粗い精度で奥行き値を表現でき、少ないビット数の奥行き値で3次元グラフィックスの描画に求められる精度に応じた表現が可能となる。   According to this configuration, by expressing the depth value in the floating-point number format, a wide range of coordinate space can be covered with a small number of bits. In addition, the depth value can be expressed with high accuracy in the region close to the viewpoint and with coarse accuracy in the far region, and the expression corresponding to the accuracy required for the drawing of the three-dimensional graphics can be performed with the depth value of a small number of bits.

この演算処理装置は、浮動小数点数形式における前記総和の指数部のバイアス値を保持するバイアス保持手段をさらに備え、前記バイアス保持手段は、前記演算処理装置の外部からアクセス可能であり、外部からリード及びライトすることができる。   The arithmetic processing device further includes bias holding means for holding a bias value of the exponent part of the sum in a floating-point number format, and the bias holding means is accessible from outside the arithmetic processing device, and is read from the outside. And can be lighted.

この構成によれば、総和の指数部のバイアスを、外部の機能ユニット(例えば、CPU等)が設定可能とすることにより、三次元空間中の複数の多角形状のグラフィック要素の分散の程度に応じ、奥行き値を最適化できる。すなわち、限定的な精度の奥行き値であっても、多角形状のグラフィック要素の奥行き方向の並び順を正しく表現できるため、メモリ使用量を節約できる。   According to this configuration, the bias of the exponent part of the sum can be set by an external functional unit (for example, a CPU), so that the degree of dispersion of a plurality of polygonal graphic elements in the three-dimensional space can be set. Depth value can be optimized. That is, even if the depth value has a limited accuracy, the arrangement order of the polygonal graphic elements in the depth direction can be correctly expressed, so that the memory usage can be saved.

上記第4の観点及び第5の観点における演算処理装置は、前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが所定の範囲内にない場合、当該多角形状のグラフィック要素の全頂点座標に描画範囲外の値を設定するカリング手段を備えることができる。   The arithmetic processing device according to the fourth aspect and the fifth aspect may be configured such that when at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within a predetermined range, the polygonal graphic A culling means for setting values outside the drawing range to all vertex coordinates of the element can be provided.

この構成によれば、少なくとも1つの頂点の所定座標軸成分(例えば、Z軸成分)が所定の範囲にない多角形状のグラフィック要素が描画されないようにすることで、描画処理の負荷を軽減できる。   According to this configuration, it is possible to reduce a drawing processing load by preventing a graphic element having a polygonal shape having a predetermined coordinate axis component (for example, a Z-axis component) of at least one vertex from being in a predetermined range.

上記第4の観点及び第5の観点における演算処理装置は、前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが所定の範囲内にない場合、前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くカリング手段を備えることができる。   The arithmetic processing unit according to the fourth aspect and the fifth aspect may be configured such that when at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within a predetermined range, the polygonal graphic Culling means for removing data defining elements from the drawing data string can be provided.

この構成によれば、少なくとも1つの頂点の所定座標軸成分(例えば、Z軸成分)が所定の範囲にない多角形状のグラフィック要素を描画用データ列から取り除くことで、メモリ使用量の節約、および描画処理の負荷の軽減ができる。   According to this configuration, it is possible to save memory usage and draw by removing a polygonal graphic element whose predetermined coordinate axis component (for example, Z-axis component) of at least one vertex is not within a predetermined range from the drawing data string. The processing load can be reduced.

上記第4の観点及び第5の観点における演算処理装置は、前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが所定の範囲内にない場合、当該多角形状のグラフィック要素の全頂点座標に描画範囲外の値を設定することができる第1のカリング手段と、前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが前記所定の範囲内にない場合、前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くことができる第2のカリング手段と、前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが前記所定の範囲内にない場合の処理を実行する手段として、前記第1のカリング手段あるいは前記第2のカリング手段のいずれかを選択する選択手段と、を備えることができる。   The arithmetic processing device according to the fourth aspect and the fifth aspect may be configured such that when at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within a predetermined range, the polygonal graphic A first culling means capable of setting values outside the drawing range for all vertex coordinates of the element, and at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is within the predetermined range A second culling means capable of removing data defining the polygonal graphic element from the drawing data sequence, and at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion. One of the first culling means and the second culling means is selected as means for executing processing when one is not within the predetermined range. It can comprise a selecting means.

この構成によれば、少なくとも1つの頂点の所定座標軸成分(例えば、Z軸成分)が所定の範囲内にない場合の処理を選択可能とすることで、外部の機能ユニット(例えば、CPU等)が出力結果を参照・調製する必要がある場合には、第1のカリング手段を選択し、そうでなければメモリを節約するために第2のカリング手段を選択することが可能となる。   According to this configuration, an external functional unit (for example, a CPU or the like) can be selected by enabling processing to be performed when a predetermined coordinate axis component (for example, a Z-axis component) of at least one vertex is not within a predetermined range. If it is necessary to refer to and prepare the output result, the first culling means can be selected, otherwise the second culling means can be selected to save memory.

上記演算処理装置は、前記所定の範囲を設定する閾値を保持する閾値保持手段をさらに備え、前記閾値保持手段は、前記演算処理装置の外部からアクセス可能であり、外部からリード及びライトすることができる。   The arithmetic processing device further includes a threshold value holding unit that holds a threshold value for setting the predetermined range, and the threshold value holding unit is accessible from outside the arithmetic processing device, and can read and write from the outside. it can.

このように、所定の範囲を定める閾値を閾値保持手段(例えば、レジスタ)で設定可能にすることで、描画対象となる三次元空間の範囲を外部の機能ユニット(例えば、CPU等)が自由に制御できる。   As described above, the threshold value that defines the predetermined range can be set by the threshold value holding means (for example, a register), so that an external functional unit (for example, a CPU) can freely set the range of the three-dimensional space to be rendered. Can be controlled.

本発明の第6の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、三次元直交座標系において、頂点の並び順が、時計回りとなる面を表、反時計回りとなる面を裏と定義された多角形状のグラフィック要素の各頂点座標を二次元直交座標系に投影する投影手段と、前記投影後の全頂点座標から、第1頂点座標、第2頂点座標、及び第3頂点座標を選択する選択手段と、前記第2頂点座標から前記第1頂点座標を減算して第1ベクトルを算出する第1のベクトル算出手段と、前記第3頂点座標から前記第1頂点座標を減算して第2ベクトルを算出する第2のベクトル算出手段と、前記第1ベクトルと前記第2ベクトルとの外積演算を行う外積演算手段と、前記外積演算の結果の符号に基づいて、前記二次元直交座標系に前記多角形状のグラフィック要素の表と裏のどちらの面が現れるかを判定する判定手段と、を備える。   According to a sixth aspect of the present invention, the arithmetic processing device is an arithmetic processing device for processing geometric operations, and represents a surface in which the order of apexes in the three-dimensional orthogonal coordinate system is clockwise. Projection means for projecting each vertex coordinate of a polygonal graphic element defined with a clockwise surface as the back to a two-dimensional orthogonal coordinate system, and a first vertex coordinate and a second vertex from the projected all vertex coordinates Selecting means for selecting coordinates and third vertex coordinates; first vector calculating means for calculating a first vector by subtracting the first vertex coordinates from the second vertex coordinates; and A second vector calculating means for subtracting the first vertex coordinates to calculate a second vector; an outer product calculating means for calculating an outer product of the first vector and the second vector; and a sign of a result of the outer product operation. Based on the two-dimensional orthogonal coordinate system And a determining means for determining which side of the front and back of the graphic elements of the polygonal shape appears.

この構成によれば、ベクトル外積演算による多角形状のグラフィック要素(例えば、ポリゴン)の表裏判定を、三次元直交座標系でなく、二次元直交座標系へ投影後の頂点座標を用いて行うことにより、演算量を大幅に削減できる。   According to this configuration, the front / back determination of the polygonal graphic element (for example, polygon) by the vector cross product operation is performed by using the vertex coordinates after projection onto the two-dimensional orthogonal coordinate system instead of the three-dimensional orthogonal coordinate system. The calculation amount can be greatly reduced.

この演算処理装置は、前記裏の面が現れると判定された前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定するカリング手段を備えることができる。   The arithmetic processing unit may include a culling unit that sets a value outside the drawing range to all vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element determined to have the back surface appear.

この構成によれば、裏と判定された多角形状のグラフィック要素が描画されないようにすることで、描画処理の負荷を軽減できる。   According to this configuration, it is possible to reduce the load of the drawing process by preventing the polygonal graphic element determined to be the reverse side from being drawn.

上記演算処理装置は、前記裏の面が現れると判定された前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くカリング手段を備えることができる。   The arithmetic processing unit may further include a culling unit that removes data defining the polygonal graphic element determined to have the back surface from the drawing data string.

この構成によれば、裏と判定された多角形状のグラフィック要素を描画用データ列から取り除くことで、メモリ使用量の節約、および描画処理の負荷の軽減ができる。   According to this configuration, by removing the polygonal graphic element determined to be the back from the drawing data string, it is possible to save the memory usage and reduce the drawing processing load.

上記演算処理装置は、前記裏の面が現れると判定された前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定することができる第1のカリング手段と、前記裏の面が現れると判定された前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くことができる第2のカリング手段と、前記裏の面が現れると判定された場合の処理を実行する手段として、前記第1のカリング手段あるいは前記第2のカリング手段のいずれかを選択する選択手段と、を備えることができる。   The arithmetic processing unit is a first culling means capable of setting a value outside the drawing range to all vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element that is determined that the back surface appears. And a second culling means that can remove data defining the polygonal graphic element determined to appear on the back surface from the drawing data string, and a case where it is determined that the back surface appears As means for executing the process, a selection means for selecting either the first culling means or the second culling means can be provided.

この構成によれば、裏の面が現れると判定された場合の処理を選択可能とすることで、外部の機能ユニット(例えば、CPU等)が出力結果を参照・調製する必要がある場合には、第1のカリング手段を選択し、そうでなければメモリを節約するために、第2のカリング手段を選択することが可能となる。   According to this configuration, when it is determined that the reverse side appears, it is possible to select a process, and when an external functional unit (for example, a CPU or the like) needs to refer to and prepare an output result. In order to select the first culling means, otherwise to save memory, it becomes possible to select the second culling means.

本発明の第7の観点によれば、演算処理装置は、幾何演算を処理する演算処理装置であって、三次元直交座標系において定義された多角形状のグラフィック要素の各頂点座標を二次元直交座標系に投影する投影手段と、前記投影後の頂点座標の座標軸成分の各々に所定値を加算する加算手段と、前記加算の結果である座標軸成分からなる頂点座標が所定の範囲内にあるか否かを判定する判定手段と、を備える。   According to a seventh aspect of the present invention, the arithmetic processing device is an arithmetic processing device for processing geometric operations, and each vertex coordinate of a polygonal graphic element defined in a three-dimensional orthogonal coordinate system is two-dimensionally orthogonal. Whether projection means for projecting to a coordinate system, addition means for adding a predetermined value to each of the coordinate axis components of the projected vertex coordinates, and whether the vertex coordinates made up of the coordinate axis components resulting from the addition are within a predetermined range Determination means for determining whether or not.

この構成によれば、所定値を加算した後の多角形状のグラフィック要素(例えば、ポリゴン)が所定の範囲内にあるか否かの判定を、三次元直交座標系でなく、二次元直交座標系へ投影後の頂点座標を用いて行うことにより、演算量を大幅に削減できる。   According to this configuration, whether or not a polygonal graphic element (for example, a polygon) after adding a predetermined value is within a predetermined range is determined using a two-dimensional orthogonal coordinate system instead of a three-dimensional orthogonal coordinate system. By using the vertex coordinates after projection onto the screen, the amount of calculation can be greatly reduced.

この演算処理装置は、前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定するカリング手段を備えることができる。   This arithmetic processing unit is configured to draw a drawing range on all vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element including a vertex whose vertex coordinate consisting of a coordinate axis component as a result of the addition is determined to be outside a predetermined range. A culling means for setting an external value can be provided.

この構成によれば、所定の範囲にないと判定された頂点を含む多角形状のグラフィック要素が描画されないようにすることで、描画処理の負荷を軽減できる。   According to this configuration, it is possible to reduce the drawing processing load by preventing the drawing of polygonal graphic elements including vertices that are determined not to fall within the predetermined range.

上記演算処理装置は、前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くカリング手段を備えることができる。   The arithmetic processing unit includes a culling unit that removes data defining the polygonal graphic element including the vertices in which the vertex coordinates including the coordinate axis component as a result of the addition are out of a predetermined range from the drawing data string. Can be provided.

この構成によれば、所定の範囲にないと判定された頂点を含む多角形状のグラフィック要素を描画用データ列から取り除くことで、メモリ使用量の節約、および描画処理の負荷の軽減ができる。   According to this configuration, by removing polygonal graphic elements including vertices that are determined not to be within the predetermined range from the drawing data string, it is possible to save memory usage and reduce the drawing processing load.

上記演算処理装置は、前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定することができる第1のカリング手段と、前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くことができる第2のカリング手段と、前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された場合の処理を実行する手段として、前記第1のカリング手段あるいは前記第2のカリング手段のいずれかを選択する選択手段と、を備えることができる。   The arithmetic processing unit is configured to draw a drawing range on all vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element including a vertex in which a vertex coordinate consisting of a coordinate axis component as a result of the addition is determined to be out of a predetermined range. Data defining a polygonal graphic element including a first culling means capable of setting an outside value, and a vertex coordinate having a vertex coordinate consisting of a coordinate axis component as a result of the addition determined to be outside a predetermined range As a means for executing processing when it is determined that a vertex coordinate consisting of a coordinate axis component as a result of the addition is out of a predetermined range. Selecting means for selecting either the second culling means or the second culling means.

この構成によれば、頂点座標が所定の範囲にないと判定された場合の処理を選択可能とすることで、外部の機能ユニット(例えば、CPU等)が出力結果を参照・調製する必要がある場合には、第1のカリング手段を選択し、そうでなければメモリを節約するために、第2のカリング手段を選択することが可能となる。   According to this configuration, by making it possible to select a process when it is determined that the vertex coordinates are not within the predetermined range, it is necessary for an external functional unit (for example, a CPU or the like) to refer to and prepare an output result. In some cases, it is possible to select the first culling means, otherwise to select the second culling means in order to save memory.

上記演算処理装置は、前記加算手段が使用する前記所定値を保持する所定値保持手段をさらに備え、前記所定値保持手段は、前記演算処理装置の外部からアクセス可能であり、外部からリード及びライトすることができる。   The arithmetic processing unit further includes a predetermined value holding unit that holds the predetermined value used by the adding unit, and the predetermined value holding unit is accessible from outside the arithmetic processing unit, and reads and writes from outside. can do.

このように、二次元座標系に投影後の座標に加算する所定値を外部の機能ユニット(例えば、CPU等)が変更できるようにすることで、表示画面中の任意の位置にビューポートを設定できる。   In this way, the external function unit (for example, CPU) can change the predetermined value added to the coordinates after projection onto the two-dimensional coordinate system, so that the viewport can be set at an arbitrary position on the display screen. it can.

以下、本発明の実施の形態について、図面を参照しながら説明する。なお、図中、同一または相当部分については同一の参照符号を付してその説明を援用する。また、信号のどのビットかを示す必要があるときは、信号名の後に、[a:b]あるいは[a]を付する。[a:b]は、その信号の第a番目のビットから第b番目のビットを意味し、[a]は、その信号の第a番目のビットを意味する。「0b」は2進数を、「0x」は16進数を意味する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the drawings, the same or corresponding parts are denoted by the same reference numerals, and the description thereof is incorporated. When it is necessary to indicate which bit of the signal, [a: b] or [a] is added after the signal name. [A: b] means the a-th bit to the b-th bit of the signal, and [a] means the a-th bit of the signal. “0b” means a binary number, and “0x” means a hexadecimal number.

図1は、本発明の実施の形態によるマルチメディアプロセッサ1の内部構成を示すブロック図である。図1に示すように、このマルチメディアプロセッサ1は、外部メモリインタフェース3、DMAC(direct memory access controller)4、中央演算処理装置(以下、「CPU」と呼ぶ。)5、CPUローカルRAM7、レンダリングプロセッシングユニット(以下、「RPU」と呼ぶ。)9、カラーパレットRAM11、サウンドプロセシングユニット(以下、「SPU」と呼ぶ。)13、SPUローカルRAM15、ジオメトリエンジン(以下、「GE」と呼ぶ。)17、Yソーティングユニット(以下、「YSU」と呼ぶ。)19、外部インタフェースブロック21、メインRAMアクセスアービタ23、メインRAM25、I/Oバス27、ビデオDAC(digital to analog converter)29、オーディオDACブロック31、及びA/Dコンバータ(以下、「ADC」と呼ぶ。)33を具備する。メインRAM25及び外部メモリ50を区別して説明する必要がないときは、「メモリMEM」と表記する。   FIG. 1 is a block diagram showing an internal configuration of a multimedia processor 1 according to the embodiment of the present invention. As shown in FIG. 1, the multimedia processor 1 includes an external memory interface 3, a DMAC (direct memory access controller) 4, a central processing unit (hereinafter referred to as “CPU”) 5, a CPU local RAM 7, and rendering processing. A unit (hereinafter referred to as “RPU”) 9, a color palette RAM 11, a sound processing unit (hereinafter referred to as “SPU”) 13, an SPU local RAM 15, a geometry engine (hereinafter referred to as “GE”) 17, Y sorting unit (hereinafter referred to as “YSU”) 19, external interface block 21, main RAM access arbiter 23, main RAM 25, I / O bus 27, video DAC (digital to analog co) Verter) 29, audio DAC block 31, and A / D converter (hereinafter, referred to as "ADC".) 33 comprises a. When it is not necessary to distinguish between the main RAM 25 and the external memory 50, they are referred to as “memory MEM”.

CPU5は、メモリMEMに格納されたプログラムを実行して、各種演算やシステム全体の制御を行う。また、CPU5は、DMAC4にプログラム及びデータの転送要求を行うこともできるし、DMAC4を介さずに、外部メモリ50から直接プログラムコードをフェッチし、外部メモリ50に直接データアクセスを行うこともできる。   The CPU 5 executes programs stored in the memory MEM to perform various calculations and control of the entire system. Further, the CPU 5 can make a program and data transfer request to the DMAC 4, and can directly fetch the program code from the external memory 50 and directly access the external memory 50 without going through the DMAC 4.

I/Oバス27は、CPU5をバスマスタとするシステム制御用のバスであり、バススレイブである各機能ユニット(外部メモリインタフェース3、DMAC4、RPU9、SPU13、GE17、YSU19、及び外部インタフェースブロック21)の制御レジスタ及びローカルRAM7,11,15へのアクセスに用いられる。このようにして、これらの機能ユニットは、I/Oバス27を通じて、CPU5により制御される。   The I / O bus 27 is a bus for system control using the CPU 5 as a bus master, and is a functional unit (external memory interface 3, DMAC 4, RPU 9, SPU 13, GE 17, YSU 19, and external interface block 21) that is a bus slave. It is used to access the control registers and local RAMs 7, 11 and 15. In this way, these functional units are controlled by the CPU 5 through the I / O bus 27.

CPUローカルRAM7は、CPU5専用のRAMであり、サブルーチンコールや割り込み時におけるデータの退避などを行うためのスタック領域、及びCPU5のみが扱う変数の格納領域等として使用される。   The CPU local RAM 7 is a RAM dedicated to the CPU 5, and is used as a stack area for saving data at the time of a subroutine call or interruption, a storage area for variables handled only by the CPU 5, and the like.

RPU9は、ポリゴン及びスプライトから構成される三次元イメージをリアルタイムに生成する。具体的には、RPU9は、YSU19によるソート済みの、ポリゴン構造体配列の各構造体インスタンス及びスプライト構造体配列の各構造体インスタンスを、メインRAM25から読み出し、所定の処理を実行して、スクリーン(表示画面)のスキャンに合わせて水平ラインごとにイメージを生成する。生成されたイメージは、コンポジットビデオ信号波形を示すデータストリームに変換され、ビデオDAC29に出力される。また、RPU9は、DMAC4に対して、ポリゴン及びスプライトのテクスチャパターンデータの取り込みのためのDMA転送要求を行う機能を有する。   The RPU 9 generates a three-dimensional image composed of polygons and sprites in real time. Specifically, the RPU 9 reads each structure instance of the polygon structure array and each structure instance of the sprite structure array sorted by the YSU 19 from the main RAM 25, executes a predetermined process, and executes a screen ( An image is generated for each horizontal line according to the scan of the display screen. The generated image is converted into a data stream indicating a composite video signal waveform and output to the video DAC 29. Further, the RPU 9 has a function of making a DMA transfer request to the DMAC 4 for taking in texture pattern data of polygons and sprites.

テクスチャパターンデータとは、ポリゴンまたはスプライトに貼り付けられる2次元の画素配列データであり、各画素データは、カラーパレットRAM11のエントリを指定するための情報の一部である。以降、テクスチャパターンデータの画素を「テクセル」と呼称し、スクリーンに表示されるイメージを構成する画素を指す「ピクセル」とは区別して使用する。従って、テクスチャパターンデータは、テクセルデータの集合である。   The texture pattern data is two-dimensional pixel array data that is pasted on a polygon or sprite. Each pixel data is a part of information for designating an entry in the color palette RAM 11. Hereinafter, the pixels of the texture pattern data are referred to as “texels”, and are used separately from “pixels” that indicate the pixels constituting the image displayed on the screen. Therefore, the texture pattern data is a set of texel data.

ポリゴン構造体配列は、多角形状のグラフィック要素であるポリゴンのための構造体配列であり、スプライト構造体配列は、スクリーンに平行な矩形のグラフィック要素であるスプライトのための構造体配列である。ポリゴン構造体配列の要素を、「ポリゴン構造体インスタンス」と呼び、スプライト構造体配列の要素を、「スプライト構造体インスタンス」と呼ぶ。ただし、両者を区別して説明する必要がないときは、単に「構造体インスタンス」と呼ぶこともある。   The polygon structure array is a structure array for polygons that are polygonal graphic elements, and the sprite structure array is a structure array for sprites that are rectangular graphic elements parallel to the screen. The elements of the polygon structure array are called “polygon structure instances”, and the elements of the sprite structure array are called “sprite structure instances”. However, when it is not necessary to distinguish between the two, they may be simply referred to as “structure instances”.

ポリゴン構造体配列に格納された各ポリゴン構造体インスタンスは、ポリゴンごとの表示情報(スクリーンにおける頂点座標、テクスチャマッピングモードでのテクスチャパターンに関する情報及びグーローシェーディングモードでのカラーデータ(RGBのカラーコンポーネント)を含む。)であり、1つのポリゴン構造体インスタンスに1つのポリゴンが対応している。スプライト構造体配列に格納された各スプライト構造体インスタンスは、スプライトごとの表示情報(スクリーンにおける座標及びテクスチャパターンに関する情報を含む。)であり、1つのスプライト構造体インスタンスに1つのスプライトが対応している。   Each polygon structure instance stored in the polygon structure array contains display information for each polygon (vertex coordinates on the screen, information on texture patterns in texture mapping mode, and color data in Gouraud shading mode (RGB color components)) In other words, one polygon corresponds to one polygon structure instance. Each sprite structure instance stored in the sprite structure array is display information for each sprite (including information on coordinates and texture patterns on the screen), and one sprite structure instance corresponds to one sprite structure instance. Yes.

ビデオDAC29は、アナログのビデオ信号を生成するためのデジタル/アナログ変換器である。ビデオDAC29は、RPU9から入力されたデータストリームをアナログのコンポジットビデオ信号に変換し、ビデオ信号出力端子(図示せず)からテレビジョンモニタ等(図示せず)に出力する。   The video DAC 29 is a digital / analog converter for generating an analog video signal. The video DAC 29 converts the data stream input from the RPU 9 into an analog composite video signal, and outputs it from a video signal output terminal (not shown) to a television monitor or the like (not shown).

カラーパレットRAM11は、本実施の形態では512色すなわち512エントリのカラーパレットからなる。RPU9は、テクスチャパターンデータに含まれるテクセルデータをカラーパレットのエントリを指定するインデックスの一部として、カラーパレットRAM11を参照し、テクスチャパターンデータを、カラーデータ(RGBのカラーコンポーネント)に変換する。   In the present embodiment, the color palette RAM 11 is composed of a color palette of 512 colors, that is, 512 entries. The RPU 9 refers to the color palette RAM 11 using the texel data included in the texture pattern data as part of an index for designating the entry of the color palette, and converts the texture pattern data into color data (RGB color components).

SPU13は、PCM(pulse code modulation)波形データ(以下、「ウェーブデータ」と呼ぶ。)、アンプリチュードデータ、及びメインボリュームデータを生成する。具体的には、SPU13は、最大64チャンネル分のウェーブデータを生成して時分割多重化するとともに、最大64チャンネル分のエンベロープデータを生成してチャンネルボリュームデータと乗算し、アンプリチュードデータを時分割多重化する。そして、SPU13は、メインボリュームデータ、時分割多重化されたウェーブデータ、及び時分割多重化されたアンプリチュードデータを、オーディオDACブロック31に出力する。また、SPU13は、DMAC4に対して、ウェーブデータ及びエンベロープデータの取り込みのためのDMA転送要求を行う機能を有する。SPU13の詳細は後述する。   The SPU 13 generates PCM (pulse code modulation) waveform data (hereinafter referred to as “wave data”), amplitude data, and main volume data. Specifically, the SPU 13 generates wave data for a maximum of 64 channels and time-division multiplexes, generates envelope data for a maximum of 64 channels and multiplies the channel volume data, and time-divisions the amplitude data. Multiplex. Then, the SPU 13 outputs main volume data, time-division multiplexed wave data, and time-division multiplexed amplitude data to the audio DAC block 31. Further, the SPU 13 has a function of making a DMA transfer request for taking in wave data and envelope data to the DMAC 4. Details of the SPU 13 will be described later.

オーディオDACブロック31は、SPU13から入力されたウェーブデータ、アンプリチュードデータ、及びメインボリュームデータをそれぞれアナログ信号に変換し、結果をアナログ乗算して、アナログオーディオ信号を生成する。このアナログオーディオ信号は、オーディオ信号出力端子(図示せず)からテレビジョンモニタ等(図示せず)のオーディオ入力端子(図示せず)に出力される。   The audio DAC block 31 converts the wave data, amplitude data, and main volume data input from the SPU 13 into analog signals, and multiplies the results to generate analog audio signals. This analog audio signal is output from an audio signal output terminal (not shown) to an audio input terminal (not shown) of a television monitor or the like (not shown).

SPUローカルRAM15は、SPU13がウェーブ再生及びエンベロープ生成を行う際に用いるパラメータ(例えば、ウェーブデータやエンベロープデータの格納アドレスやピッチ情報など)を格納する。   The SPU local RAM 15 stores parameters used when the SPU 13 performs wave reproduction and envelope generation (for example, storage addresses and pitch information of wave data and envelope data).

本発明の特徴の1つであるGE17は、三次元イメージを表示するための幾何演算を実行する。具体的には、GE17は、行列積、ベクトルアフィン変換、ベクトル直交変換、透視投影変換、頂点明度/ポリゴン明度計算(ベクトル内積)、及びポリゴン裏面カリング処理(ベクトル外積)などの演算を実行する。詳細は後述する。   The GE 17, which is one of the features of the present invention, executes a geometric operation for displaying a three-dimensional image. Specifically, the GE 17 performs operations such as matrix product, vector affine transformation, vector orthogonal transformation, perspective projection transformation, vertex lightness / polygon lightness calculation (vector inner product), and polygon back surface culling processing (vector outer product). Details will be described later.

YSU19は、メインRAM25に格納されているポリゴン構造体配列の各構造体インスタンス及びスプライト構造体配列の各構造体インスタンスを、ソートルール1〜4に従ってソートする。この場合、ポリゴン構造体配列とスプライト構造体配列とで、別個にソートが行われる。   The YSU 19 sorts each structure instance of the polygon structure array and each structure instance of the sprite structure array stored in the main RAM 25 according to the sorting rules 1 to 4. In this case, the polygon structure array and the sprite structure array are separately sorted.

以下、YSU19によるソートルール1〜4について説明するが、その前に座標系について説明する。テレビジョンモニタ等のディスプレイ装置(図示せず)への実際の表示に用いられる二次元座標系をスクリーン座標系と呼ぶ。本実施の形態では、スクリーン座標系は、水平方向2048ピクセル×垂直方向1024ピクセルの2次元ピクセル配列から構成される。座標原点は左上にあり、右方向がX軸の正、下方向がY軸の正に相当する。ただし、実際に表示される領域は、スクリーン座標系の全空間ではなく一部の空間である。この表示領域をスクリーンと呼ぶことにする。   Hereinafter, the sorting rules 1 to 4 by the YSU 19 will be described, but before that, the coordinate system will be described. A two-dimensional coordinate system used for actual display on a display device (not shown) such as a television monitor is called a screen coordinate system. In this embodiment, the screen coordinate system is composed of a two-dimensional pixel array of 2048 pixels in the horizontal direction and 1024 pixels in the vertical direction. The coordinate origin is at the upper left, the right direction corresponds to the positive X axis, and the lower direction corresponds to the positive Y axis. However, the area actually displayed is not the entire space of the screen coordinate system but a part of the space. This display area is called a screen.

ソートルール1は、最小Y座標が小さい順に、各ポリゴン構造体インスタンスを並べ替えることである。最小Y座標とは、ポリゴンの全頂点のY座標のうち、最も小さいY座標のことである。Y座標はスクリーンの垂直座標であり、下向きが正方向である。ソートルール2は、最小Y座標が同じである複数のポリゴンについては、デプス値が大きい順に、各ポリゴン構造体インスタンスを並べることである。なお、デプス値が大きいほど奥に描画される。   Sort rule 1 is to rearrange the polygon structure instances in ascending order of the minimum Y coordinate. The minimum Y coordinate is the smallest Y coordinate among the Y coordinates of all the vertices of the polygon. The Y coordinate is the vertical coordinate of the screen, and the downward direction is the positive direction. Sort rule 2 is to arrange the polygon structure instances in descending order of the depth value for a plurality of polygons having the same minimum Y coordinate. Note that the greater the depth value, the deeper the drawing.

ただし、YSU19は、スクリーンの先頭ラインに表示されるピクセルを持つ複数のポリゴンについては、最小Y座標が異なっている場合でも、それらが同一であるとみなして、ソートルール1ではなく、ソートルール2に従って、各ポリゴン構造体インスタンスの並べ替えを行う。つまり、スクリーンの先頭ラインに表示されるピクセルを持つポリゴンが複数存在する場合は、最小Y座標が同一であるとみなして、デプス値が大きい順に並べ替えられる。これがソートルール3である。   However, the YSU 19 regards a plurality of polygons having pixels displayed on the first line of the screen as being the same even if the minimum Y coordinate is different, so that the sorting rule 2 is not the sorting rule 1. According to the above, the polygon structure instances are rearranged. That is, when there are a plurality of polygons having pixels displayed on the top line of the screen, the minimum Y coordinate is regarded as the same, and they are rearranged in descending order of the depth value. This is the sort rule 3.

インタレーススキャンの場合でも、ソートルール1〜3が適用される。ただし、奇数フィールドを表示するためのソートでは、奇数ラインに表示されるポリゴンの最小Y座標及び/又はその奇数ラインの1つ前の偶数ラインに表示されるポリゴンの最小Y座標が同一であるとみなして、ソートルール2によるソートを行う。ただし、先頭の奇数ラインは除く。なぜなら、その1つ前の偶数ラインが存在しないからである。一方、偶数フィールドを表示するためのソートでは、偶数ラインに表示されるポリゴンの最小Y座標及び/又はその偶数ラインの1つ前の奇数ラインに表示されるポリゴンの最小Y座標が同一であるとみなして、ソートルール2によるソートを行う。これがソートルール4である。   Sort rules 1 to 3 are applied even in the case of interlaced scanning. However, in the sorting for displaying the odd field, the minimum Y coordinate of the polygon displayed on the odd line and / or the minimum Y coordinate of the polygon displayed on the even line immediately before the odd line are the same. As a result, the sorting by the sorting rule 2 is performed. However, the first odd line is excluded. This is because there is no previous even line. On the other hand, in the sorting for displaying the even field, the minimum Y coordinate of the polygon displayed on the even line and / or the minimum Y coordinate of the polygon displayed on the odd line immediately before the even line are the same. As a result, the sorting by the sorting rule 2 is performed. This is sort rule 4.

スプライトに関するソートルール1〜4は、それぞれポリゴンに関するソートルール1〜4と同様である。   Sort rules 1 to 4 for sprites are the same as sort rules 1 to 4 for polygons, respectively.

外部メモリインタフェース3は、外部バス51を介して、外部メモリ50からのデータの読み出し、及び外部メモリ50へのデータの書き込みを司る。この場合、外部メモリインタフェース3は、図示しないEBI優先順位テーブルに従って、CPU5及びDMAC4からの外部バスアクセス要求要因(外部バス51へのアクセスを要求する要因)を調停して、いずれか1つの外部バスアクセス要求要因を選択する。そして、選択した外部バスアクセス要求要因に対して外部バス51へのアクセスを許可する。EBI優先順位テーブルは、CPU5からの複数種類の外部バスアクセス要求要因及びDMAC4からの外部バスアクセス要求要因の優先順位を定めたテーブルである。   The external memory interface 3 is responsible for reading data from the external memory 50 and writing data to the external memory 50 via the external bus 51. In this case, the external memory interface 3 arbitrates external bus access request factors (factors requesting access to the external bus 51) from the CPU 5 and the DMAC 4 in accordance with an EBI priority table (not shown), and any one of the external buses Select the access request factor. Then, access to the external bus 51 is permitted for the selected external bus access request factor. The EBI priority table is a table that defines priorities of a plurality of types of external bus access request factors from the CPU 5 and external bus access request factors from the DMAC 4.

外部バスアクセス要求要因として、CPUに含まれる図示しないIPL(initial program loader)によるブロック転送要求、CPU5によるデータアクセス要求、CPU5による命令フェッチ要求、及びDMAC4によるDMA要求がある。   As external bus access request factors, there are a block transfer request by an IPL (initial program loader) (not shown) included in the CPU, a data access request by the CPU 5, an instruction fetch request by the CPU 5, and a DMA request by the DMAC 4.

DMAC4は、メインRAM25と、外部バス51に接続された外部メモリ50と、の間でDMA転送を行う。この場合、DMAC4は、図示しないDMA優先順位テーブルに従って、CPU5、RPU9、及びSPU13からのDMA転送要求要因(DMA転送を要求する要因)を調停して、いずれか1つのDMA転送要求要因を選択する。そして、外部メモリインタフェース3に対して、DMA要求を行う。DMA優先順位テーブルは、CPU5、RPU9、及びSPU13からのDMA要求要因の優先順位を定めたテーブルである。   The DMAC 4 performs DMA transfer between the main RAM 25 and the external memory 50 connected to the external bus 51. In this case, the DMAC 4 arbitrates DMA transfer request factors (factors that request DMA transfer) from the CPU 5, RPU 9, and SPU 13 according to a DMA priority table (not shown), and selects any one DMA transfer request factor. . Then, a DMA request is made to the external memory interface 3. The DMA priority table is a table that defines the priority of DMA request factors from the CPU 5, RPU 9, and SPU 13.

SPU13のDMA要求要因として、(1)ウェーブデータをウェーブバッファに転送すること、(2)エンベロープデータをエンベロープバッファに転送すること、がある。ウェーブバッファ及びエンベロープバッファは、それぞれメインRAM25上に設定されるウェーブデータ及びエンベロープデータのテンポラリ格納領域である。なお、SPU13の2つのDMA要求要因間の調停は、SPU13内のハードウェア(図示せず)で行われ、DMAC4は関知しない。   The DMA request factors of the SPU 13 include (1) transferring wave data to the wave buffer and (2) transferring envelope data to the envelope buffer. The wave buffer and envelope buffer are temporary storage areas for wave data and envelope data set on the main RAM 25, respectively. The arbitration between the two DMA request factors of the SPU 13 is performed by hardware (not shown) in the SPU 13, and the DMAC 4 is not concerned.

RPU9のDMA要求要因として、テクスチャパターンデータをテクスチャバッファに転送すること、がある。テクスチャバッファは、メインRAM25上に設定されるテクスチャパターンデータのテンポラリ格納領域である。   As a DMA request factor of the RPU 9, there is transferring the texture pattern data to the texture buffer. The texture buffer is a temporary storage area for texture pattern data set on the main RAM 25.

CPU5のDMA要求要因として、(1)仮想記憶管理においてページミスが発生した場合のページ転送、(2)アプリケーションプログラム等が要求するデータ転送、がある。なお、CPU5内で複数のDMA転送要求が同時に発生した場合は、その調停はCPU5で実行されるソフトウェアにて行われ、DMAC4は関知しない。   The DMA request factors of the CPU 5 include (1) page transfer when a page miss occurs in virtual storage management, and (2) data transfer requested by an application program or the like. When a plurality of DMA transfer requests are generated simultaneously in the CPU 5, the arbitration is performed by software executed by the CPU 5, and the DMAC 4 is not concerned.

外部インタフェースブロック21は、周辺装置54とのインタフェースであり、24チャンネルのプログラマブルなデジタル入出力(I/O)ポートを含む。24チャンネルのI/Oポートの各々は、4チャンネル分のマウスインタフェース機能、4チャンネル分のライトガンインタフェース機能、2チャンネル分の汎用タイマ/カウンタ、1チャンネル分の調歩同期式シリアルインタフェース機能、1チャンネル分の汎用パラレル/シリアル変換ポート機能のうち1または複数に内部接続されている。   The external interface block 21 is an interface with the peripheral device 54 and includes a 24-channel programmable digital input / output (I / O) port. Each 24 channel I / O port has 4 channels of mouse interface function, 4 channels of light gun interface function, 2 channels of general-purpose timer / counter, 1 channel of asynchronous serial interface function, 1 channel Are internally connected to one or more of the general-purpose parallel / serial conversion port functions.

ADC33は、4チャンネルのアナログ入力ポートに接続され、これらを介して、アナログ入力装置52から入力されたアナログ信号をデジタル信号に変換する。例えば、マイク音声等のアナログ入力信号をサンプリングしてデジタルデータに変換する。   The ADC 33 is connected to 4-channel analog input ports, and converts the analog signal input from the analog input device 52 into a digital signal via these. For example, an analog input signal such as a microphone sound is sampled and converted into digital data.

メインRAMアクセスアービタ23は、機能ユニット(CPU5、RPU9、GE17、YSU19、DMAC4、及び外部インタフェースブロック21(汎用パラレル/シリアル変換ポート)からのメインRAM25へのアクセス要求を調停して、いずれかの機能ユニットにアクセス許可を出す。   The main RAM access arbiter 23 arbitrates an access request to the main RAM 25 from the functional units (CPU 5, RPU 9, GE 17, YSU 19, DMAC 4, and external interface block 21 (general-purpose parallel / serial conversion port), and has any function. Grant access to the unit.

メインRAM25は、CPU5のワーク領域、変数格納領域、および仮想記憶管理領域等として利用される。また、メインRAM25は、CPU5が他の機能ユニットに受け渡すデータの格納領域、RPU9及びSPU13が外部メモリ50からDMAによって取得したデータの格納領域、GE17及びYSU19の入力データ及び出力データの格納領域等としても使用される。   The main RAM 25 is used as a work area, a variable storage area, a virtual storage management area, and the like for the CPU 5. Further, the main RAM 25 is a storage area for data that the CPU 5 delivers to other functional units, a storage area for data that the RPU 9 and SPU 13 have acquired from the external memory 50 by DMA, a storage area for input data and output data for the GE 17 and YSU 19, etc. Also used as

外部バス51は、外部メモリ50にアクセスするためのバスである。CPU5およびDMAC4から、外部メモリインタフェース3を介してアクセスされる。外部バス51のアドレスバスは、30ビットから成り、最大で1Gバイト(=8Gビット)の外部メモリ50を接続することができる。外部バス51のデータバスは、16ビットから成り、8ビット又は16ビットのデータバス幅を持つ外部メモリ50を接続できる。異なるデータバス幅を持つ外部メモリを同時に接続可能であり、アクセスする外部メモリによってデータバス幅を自動的に切り替える機能が備えられる。   The external bus 51 is a bus for accessing the external memory 50. It is accessed from the CPU 5 and the DMAC 4 via the external memory interface 3. The address bus of the external bus 51 is composed of 30 bits, and an external memory 50 having a maximum of 1 Gbyte (= 8 Gbit) can be connected thereto. The data bus of the external bus 51 is composed of 16 bits, and can connect an external memory 50 having a data bus width of 8 bits or 16 bits. External memories having different data bus widths can be connected at the same time, and a function of automatically switching the data bus width according to the external memory to be accessed is provided.

次に、マルチメディアプロセッサ1によるグラフィックス処理の概要を説明する。   Next, an outline of graphics processing by the multimedia processor 1 will be described.

図2は、図1のマルチメディアプロセッサ1によるグラフィックス処理の流れの概要を示すフローチャートである。図2に示すように、ステップS1にて、CPU5は、各オブジェクト(1または複数のポリゴンから構成され、同じ拡大・縮小、回転、及び平行移動の変換が適用される単位)及び各スプライトの拡大・縮小、回転、及び平行移動のパラメータを算出する。算出されたパラメータから、各オブジェクト及び各スプライトに対し、拡大・縮小、回転、及び平行移動のための変換行列が生成される。これらの変換行列は、各オブジェクト及び各スプライトのローカルな座標系(ローカル座標系)から、全てのオブジェクト及び全てのスプライトを統一の座標系で表現する直交座標系(ワールド座標系)への変換に用いられる。   FIG. 2 is a flowchart showing an outline of the flow of graphics processing by the multimedia processor 1 of FIG. As shown in FIG. 2, in step S1, the CPU 5 enlarges each object (a unit composed of one or a plurality of polygons to which the same enlargement / reduction, rotation, and translation conversion are applied) and each sprite. Calculate the parameters for reduction, rotation and translation. From the calculated parameters, a transformation matrix for enlargement / reduction, rotation, and translation is generated for each object and each sprite. These transformation matrices are used to convert each object and sprite's local coordinate system (local coordinate system) to an orthogonal coordinate system (world coordinate system) that expresses all objects and all sprites in a unified coordinate system. Used.

また、CPU5は、視点(カメラ)座標、対象点座標、及び視線ベクトルの更新等を行う。これらのパラメータから、ワールド座標系から視点を中心とした直交座標系(ビュー座標系)への変換行列が生成される。   Further, the CPU 5 updates the viewpoint (camera) coordinates, the target point coordinates, the line-of-sight vector, and the like. From these parameters, a transformation matrix from the world coordinate system to an orthogonal coordinate system (view coordinate system) centered on the viewpoint is generated.

ステップS2にて、GE17は、各オブジェクト及び各スプライトに対し、拡大・縮小、回転、及び平行移動のための変換行列が複数存在する場合、それらの変換行列の行列積を求めることにより、複数の変換行列を単一の変換行列に合成する。さらに、GE17は、合成された変換行列と、座標系変換のための変換行列と、の行列積を求めて、オブジェクト頂点座標配列、オブジェクト法線ベクトル配列、及びスプライト座標を変換するための変換行列をそれぞれ合成する。   In step S2, when there are a plurality of transformation matrices for enlargement / reduction, rotation, and translation for each object and each sprite, the GE 17 obtains a matrix product of the transformation matrices to obtain a plurality of transformation matrices. Combine transformation matrices into a single transformation matrix. Further, the GE 17 obtains a matrix product of the synthesized transformation matrix and the transformation matrix for the coordinate system transformation, and transforms the object vertex coordinate array, the object normal vector array, and the sprite coordinates. Are synthesized respectively.

ステップS3にて、GE17は、合成された変換行列を用い、オブジェクト頂点座標配列、オブジェクト法線ベクトル配列、及びスプライト座標の幾何変換を行う。また、GE17は、変換後のオブジェクト法線ベクトル配列と光源ベクトルとの内積を演算し、オブジェクトの各頂点または面(ポリゴン)の明度を算出する。このような幾何変換及びライティングの結果は、ポリゴン構造体配列及びスプライト構造体配列に格納される。   In step S3, the GE 17 performs geometric transformation of the object vertex coordinate array, the object normal vector array, and the sprite coordinates using the synthesized transformation matrix. Further, the GE 17 calculates the inner product of the converted object normal vector array and the light source vector, and calculates the brightness of each vertex or surface (polygon) of the object. The result of such geometric transformation and lighting is stored in the polygon structure array and the sprite structure array.

ステップS4にて、RPU9による描画処理が行われる前に、YSU19は、ソートルール1〜4に従って、ポリゴン構造体インスタンスおよびスプライト構造体インスタンスをソートする。   In step S4, before the drawing process by the RPU 9 is performed, the YSU 19 sorts the polygon structure instance and the sprite structure instance according to the sorting rules 1 to 4.

ステップS5にて、RPU9は、YSU19によるソート後のポリゴン構造体インスタンスおよびスプライト構造体インスタンスを読み出すとともに、テクスチャマッピングモードのポリゴン及びスプライトの属性を示すテクスチャアトリビュート構造体インスタンスを読み出しつつ、各水平表示ラインのピクセルデータ列を生成する。また、テクスチャマッピングモードのポリゴン及びスプライトのピクセルデータ列生成には、これらに貼り付けるテクスチャパターンデータを、外部メモリ50から読み出すことが必要とされる。このようなピクセルデータ列生成処理を「ラスタライジング」と呼ぶ。   In step S5, the RPU 9 reads the polygon structure instance and the sprite structure instance after sorting by the YSU 19, and reads the texture attribute structure instance indicating the attributes of the polygon and sprite in the texture mapping mode, Generate a pixel data string. Further, in order to generate pixel data strings of polygons and sprites in the texture mapping mode, it is necessary to read out the texture pattern data to be pasted from the external memory 50. Such pixel data string generation processing is called “rasterizing”.

本実施の形態では、ポリゴンの描画モードとして、テクスチャマッピングを用いて描画を行うテクスチャマッピングモードと、グーローシェーディングを用いてポリゴンの描画を行うグーローシェーディングモードと、を実装している。テクスチャマッピングは、二次元の格子状に並べられたテクセルのパターンをポリゴン表面に貼り付ける描画手法である。グーローシェーディングは、少ない個数のポリゴンで擬似的に滑らかな曲面を表現するために用いられるスムーズシェーディングの一種である。グーローシェーディングでは、独立に指定されたポリゴンの頂点色を直線補完することでポリゴン内の各ピクセルの描画色を求める。   In this embodiment, a texture mapping mode for drawing using texture mapping and a Gouraud shading mode for drawing polygons using Gouraud shading are implemented as polygon drawing modes. Texture mapping is a drawing technique in which texel patterns arranged in a two-dimensional grid are pasted on the polygon surface. Gouraud shading is a type of smooth shading used to express a pseudo smooth surface with a small number of polygons. In Gouraud shading, the drawing color of each pixel in the polygon is obtained by linearly complementing the vertex color of the polygon specified independently.

また、RPU9は、シザリングを実行する。シザリングとは、ポリゴン及びスプライトのピクセルデータ列生成時に、指定されたビューポートの領域からはみ出している部分を切り取って表示しないようにする処理である。生成されたピクセルデータ列は、RPU9内のラインバッファ(図示せず)に書き込まれるが、この際に書き込みピクセルが半透明色に設定されている場合、ラインバッファ内のピクセルのカラーと書き込みピクセルのカラーを混ぜ合わせるカラーブレンディングが行われる。   The RPU 9 performs scissoring. Scissoring is a process of cutting off a portion that protrudes from a specified viewport area and not displaying it when generating a pixel data string of polygons and sprites. The generated pixel data string is written to a line buffer (not shown) in the RPU 9, and when the writing pixel is set to a semi-transparent color, the color of the pixel in the line buffer and the writing pixel are set. Color blending that mixes colors is performed.

ステップS6にて、RPU9は、ラインバッファから表示対象の各ピクセルの情報を読み出し、同期信号及びカラーバースト信号等を追加してコンポジットビデオ信号のデジタルデータストリームを生成する。生成されたデータストリームは、ビデオDAC29に入力され、ビデオDAC29からは、アナログのコンポジットビデオ信号が出力される。   In step S6, the RPU 9 reads information on each pixel to be displayed from the line buffer, adds a synchronization signal, a color burst signal, and the like to generate a digital data stream of the composite video signal. The generated data stream is input to the video DAC 29, and an analog composite video signal is output from the video DAC 29.

さて、GE17の詳細な説明に入る前に、三次元グラフィックス処理における座標系について説明する。   Now, before entering the detailed description of the GE 17, a coordinate system in the three-dimensional graphics processing will be described.

三次元直交座標系には、左手座標系と右手座標系とがある。本実施の形態では、右手座標系を採用する。右手座標系は、右手の親指、人差し指、中指をそれぞれ互いに垂直になるように立てたとき、親指がX軸の正、人差し指がY軸の正、中指がZ軸の正を指す座標系である。   The three-dimensional orthogonal coordinate system includes a left-handed coordinate system and a right-handed coordinate system. In the present embodiment, a right-handed coordinate system is adopted. The right-handed coordinate system is a coordinate system in which the thumb, the index finger, and the middle finger stand upright to each other, the thumb is positive on the X axis, the index finger is positive on the Y axis, and the middle finger is positive on the Z axis. .

ローカル座標系は、オブジェクトを構成する各頂点の座標が、オブジェクト自身の原点からの相対値として表されている三次元座標系である。オブジェクトの各頂点の座標は、ローカル座標系の値で表され、ROM等の外部メモリ50に格納される。なお、オブジェクトによっては、ローカル座標系が階層構造となっているものもある。   The local coordinate system is a three-dimensional coordinate system in which the coordinates of each vertex constituting the object are expressed as a relative value from the origin of the object itself. The coordinates of each vertex of the object are represented by values in the local coordinate system and stored in an external memory 50 such as a ROM. Some objects have a hierarchical structure in the local coordinate system.

ワールド座標系は、一つのシーンを構成する全てのオブジェクトに対して共通な三次元座標系である。各オブジェクトおよび視点(カメラ)の移動及び回転等は、通常この座標系で計算される。   The world coordinate system is a common three-dimensional coordinate system for all objects constituting one scene. The movement and rotation of each object and viewpoint (camera) are usually calculated in this coordinate system.

ビュー座標系は、視点(カメラ)の位置を原点とし、視点の水平右方向及び垂直下方向をそれぞれX軸及びY軸の正とする三次元直交座標系である。この座標系では、視線ベクトル(X,Y,Z)の値は、(0,0,−1)として与えられ、対象点から視点へと向かう単位ベクトルとして定義される。   The view coordinate system is a three-dimensional orthogonal coordinate system in which the position of the viewpoint (camera) is the origin, and the horizontal right direction and the vertical downward direction of the viewpoint are positive on the X axis and the Y axis, respectively. In this coordinate system, the value of the line-of-sight vector (X, Y, Z) is given as (0, 0, −1), and is defined as a unit vector from the target point to the viewpoint.

透視座標系は、ビュー座標系のオブジェクトを透視投影変換して得られる2次元座標系である。透視投影は、視点に近いオブジェクトが大きく、遠いオブジェクトが小さく投影される、人間の目から見る映像を得るための投影手法である。この投影を行う変換を透視投影変換と呼ぶ。透視投影変換を行う際には、視点から投影面までの距離を指定する必要がある。また、この座標系の原点は空間の中心に位置し、座標は符号付きの値で表される。   The perspective coordinate system is a two-dimensional coordinate system obtained by perspective projection conversion of an object in the view coordinate system. Perspective projection is a projection technique for obtaining an image viewed from the human eye in which an object close to the viewpoint is large and a distant object is small. The transformation that performs this projection is called perspective projection transformation. When performing perspective projection conversion, it is necessary to specify the distance from the viewpoint to the projection plane. The origin of this coordinate system is located at the center of the space, and the coordinates are represented by a signed value.

スクリーン座標系は、画面表示の際に用いられる2次元座標系である。但し、実際に画面に表示される領域は、この座標空間の一部となる。この座標系の原点は空間全体の左上に位置し、座標は符号無しの値で表される。RPU9が扱う座標系は、この座標系のみである。   The screen coordinate system is a two-dimensional coordinate system used for screen display. However, the area actually displayed on the screen is a part of this coordinate space. The origin of this coordinate system is located at the upper left of the entire space, and the coordinates are represented by unsigned values. The coordinate system handled by the RPU 9 is only this coordinate system.

さて、上記のように、オブジェクトの各頂点の座標は、ローカル座標系の値で外部メモリ50に格納されるので、三次元グラフィックスの表示を行う場合、上記した座標系の変換を経て、最終的に画面に表示するためのスクリーン座標系に変換しなければならない。   As described above, the coordinates of each vertex of the object are stored in the external memory 50 as values in the local coordinate system. Therefore, when displaying three-dimensional graphics, the coordinate system is converted to the final value. Must be converted to a screen coordinate system for display on the screen.

図3は、本実施の形態における座標変換フローの一例を示す図である。図3では、例として、ポリゴンの頂点座標配列の変換を示す。図3を参照して、ステップS11の処理は、階層構造を持つオブジェクトに対してのみ行われる。ステップS11にて、マルチメディアプロセッサ1は、各階層の変換行列を合成して、ローカル変換行列を生成し、これを用いて、頂点座標を変換する(ローカル変換)。変換行列自体は、三次元アフィン変換行列として定義される。   FIG. 3 is a diagram illustrating an example of a coordinate conversion flow in the present embodiment. FIG. 3 shows conversion of the vertex coordinate array of the polygon as an example. Referring to FIG. 3, the process of step S11 is performed only on objects having a hierarchical structure. In step S <b> 11, the multimedia processor 1 generates a local transformation matrix by synthesizing the transformation matrices of the respective layers, and uses this to convert vertex coordinates (local transformation). The transformation matrix itself is defined as a three-dimensional affine transformation matrix.

ステップS12にて、マルチメディアプロセッサ1は、ワールド変換行列を用いて、ローカル座標系からワールド座標系に頂点座標を変換する(ワールド変換)。各オブジェクトの拡大・縮小、回転、及び平行移動は、この座標系で計算される。変換行列自体は、三次元アフィン変換行列として定義される。   In step S12, the multimedia processor 1 converts the vertex coordinates from the local coordinate system to the world coordinate system using the world conversion matrix (world conversion). The enlargement / reduction, rotation, and translation of each object are calculated in this coordinate system. The transformation matrix itself is defined as a three-dimensional affine transformation matrix.

ステップS13にて、マルチメディアプロセッサ1は、ビュー変換行列を用いて、ワールド座標系の頂点座標をビュー座標系に変換する(ビュー変換)。変換行列自体は、三次元アフィン変換行列として定義される。   In step S13, the multimedia processor 1 converts the vertex coordinates of the world coordinate system into the view coordinate system using the view conversion matrix (view conversion). The transformation matrix itself is defined as a three-dimensional affine transformation matrix.

ステップS14にて、マルチメディアプロセッサ1は、視点から投影面までの距離に基づいて、ビュー座標系の頂点座標を、透視座標系に変換する(透視投影変換)。ビュー座標系でのXYZ座標を(xv,yv,zv)、透視座標系でのXY座標を(xp,yp)、視点から投影面までの距離を「d」とすると、透視投影変換は次式で表される。   In step S14, the multimedia processor 1 converts the vertex coordinates of the view coordinate system to the perspective coordinate system based on the distance from the viewpoint to the projection plane (perspective projection conversion). When the XYZ coordinate in the view coordinate system is (xv, yv, zv), the XY coordinate in the perspective coordinate system is (xp, yp), and the distance from the viewpoint to the projection plane is “d”, the perspective projection transformation is It is represented by

Figure 2007128180
Figure 2007128180

ステップS15にて、マルチメディアプロセッサ1は、X成分及びY成分のオフセット値を用いて、透視座標系の頂点座標を、スクリーン座標系に変換する(ビューポート変換)。透視座標系では、ポリゴンの頂点座標は原点を中心とした符号付きの値となっている。これに対し、実際に画面表示の際に用いられるスクリーン座標系では、左上を原点とした符号無しの値であるため、ポリゴンの頂点座標に一定のオフセットを加算し、移動させる必要がある(スプライトについても同様)。また、多人数プレイ用のアプリケーションなど画面上に複数のビューポートを設ける場合、それぞれのビューポート位置への移動を行う必要がある(スプライトについても同様)。これらが、ビューポート変換である。   In step S15, the multimedia processor 1 converts the vertex coordinates of the perspective coordinate system into the screen coordinate system using the offset values of the X component and the Y component (viewport conversion). In the perspective coordinate system, the vertex coordinates of the polygon are values with a sign centered on the origin. On the other hand, in the screen coordinate system actually used for screen display, since it is an unsigned value with the upper left as the origin, it is necessary to add a certain offset to the vertex coordinates of the polygon and move it (sprite) The same applies to. In addition, when providing a plurality of viewports on the screen such as an application for multiplayer, it is necessary to move to each viewport position (the same applies to sprites). These are viewport transformations.

透視座標系でのXY座標を(xp,yp)、スクリーン座標系でのXY座標を(xs,ys)、XY座標に加算されるオフセット値をそれぞれ「offx」及び「offy」とすると、ビューポート変換は次式で表される。   When the XY coordinates in the perspective coordinate system are (xp, yp), the XY coordinates in the screen coordinate system are (xs, ys), and the offset values added to the XY coordinates are “offx” and “offy”, respectively, the viewport The conversion is expressed by the following equation.

Figure 2007128180
Figure 2007128180

ここで、ステップS11からS13の各変換行列は、予め合成されて、各変換を一度に行うことができる変換行列が生成されている。このため、ステップS11からS13の各変換は、一度に行われる。つまり、ローカル変換の三次元アフィン変換行列、ワールド変換の三次元アフィン変換行列、及びビュー変換の三次元アフィン変換行列は合成され、一括してこれらの座標変換が行われる。   Here, the transformation matrices in steps S11 to S13 are synthesized in advance, and a transformation matrix that can perform each transformation at a time is generated. For this reason, each conversion of step S11 to S13 is performed at once. That is, the local transformation three-dimensional affine transformation matrix, the world transformation three-dimensional affine transformation matrix, and the view transformation three-dimensional affine transformation matrix are combined and these coordinate transformations are performed collectively.

次に、3次元アフィン変換及び3次元直交変換について説明する。3次元直交空間のベクトル(x,y,z)を変換して得られるベクトル(x´,y´,z´)が以下のように表される場合、この変換を3次元アフィン変換と呼ぶ。   Next, three-dimensional affine transformation and three-dimensional orthogonal transformation will be described. When a vector (x ′, y ′, z ′) obtained by converting a vector (x, y, z) in a three-dimensional orthogonal space is expressed as follows, this conversion is called a three-dimensional affine transformation.

Figure 2007128180
Figure 2007128180

この変換では、拡大・縮小、回転、及び平行移動を行うことが可能である。この変換を行う変換行列を同次座標表現すると、以下のような4次正方行列となる。   In this conversion, enlargement / reduction, rotation, and translation can be performed. When the transformation matrix for performing this transformation is expressed in homogeneous coordinates, the following quartic square matrix is obtained.

Figure 2007128180
Figure 2007128180

マルチメディアプロセッサ1では、3次元アフィン変換は、主にポリゴンの頂点座標の変換に用いられる。1つのベクトルに対して複数回の3次元アフィン変換を行う場合、行列の結合法則を利用して、複数の変換行列を1つの変換行列に合成することが可能である。アフィン変換に関連して、GE17には、行列積を求めるコマンド「MatrixMulti」、及び3次元アフィン変換を行うコマンド「Affine」が用意される。これらコマンドについては後で詳述する。   In the multimedia processor 1, the three-dimensional affine transformation is mainly used for transformation of polygon vertex coordinates. When performing three-dimensional three-dimensional affine transformation on one vector, it is possible to synthesize a plurality of transformation matrices into one transformation matrix using a matrix combination rule. In relation to the affine transformation, the GE 17 is provided with a command “MatrixMulti” for obtaining a matrix product and a command “Affine” for performing a three-dimensional affine transformation. These commands will be described in detail later.

3次元直交空間のベクトル(x,y,z)を変換して得られるベクトル(x´,y´,z´)が以下のように表される場合、この変換を3次元直交変換と呼ぶ。   When a vector (x ′, y ′, z ′) obtained by converting a vector (x, y, z) in a three-dimensional orthogonal space is expressed as follows, this conversion is called a three-dimensional orthogonal transformation.

Figure 2007128180
Figure 2007128180

この変換では、拡大・縮小、及び回転を行うことが可能である。この変換を行う変換行列は、以下のような3次正方行列で表される。   In this conversion, enlargement / reduction and rotation can be performed. A conversion matrix for performing this conversion is represented by the following cubic matrix.

Figure 2007128180
Figure 2007128180

マルチメディアプロセッサ1では、3次元ベクトル直交変換は、主に頂点法線ベクトルおよびポリゴン(面)法線ベクトルの変換に用いられる。1つのベクトルに対して複数回の3次元ベクトル直交変換を行う場合、行列の結合法則を利用して、複数の変換行列を1つの変換行列に合成することが可能である。3次元ベクトル直交変換に関連して、GE17には、行列積を求めるコマンド「MatrixMulti」、3次元ベクトル直交変換を行うコマンド「Trans」が用意される。これらについては、後で詳述する。   In the multimedia processor 1, the three-dimensional vector orthogonal transformation is mainly used for the conversion of the vertex normal vector and the polygon (surface) normal vector. When a plurality of three-dimensional vector orthogonal transformations are performed on one vector, it is possible to synthesize a plurality of transformation matrices into one transformation matrix using matrix combination rules. In relation to the three-dimensional vector orthogonal transformation, the GE 17 is provided with a command “MatrixMulti” for obtaining a matrix product and a command “Trans” for performing the three-dimensional vector orthogonal transformation. These will be described in detail later.

さて、次に、GE17が行う各種処理について、適宜図面を参照しながら説明する。まず、頂点座標変換について説明する。   Next, various processes performed by the GE 17 will be described with reference to the drawings as appropriate. First, vertex coordinate conversion will be described.

図4は、GE17によるポリゴンの頂点座標変換処理の流れを示すフローチャートである。先ず、入力データとして、頂点座標配列を用意する。この頂点座標配列の形式は、後述するVector10構造体であり、各メンバは、ローカル座標系の頂点座標である。   FIG. 4 is a flowchart showing a flow of polygon vertex coordinate conversion processing by the GE 17. First, a vertex coordinate array is prepared as input data. The format of this vertex coordinate array is a Vector10 structure described later, and each member is a vertex coordinate of the local coordinate system.

ステップS21にて、GE17は、コマンド「Affine」によって、頂点座標に対して、ローカル座標系からビュー座標系へのアフィン変換を施し、ビュー座標系の頂点座標を出力する。なお、コマンド実行前に、ローカル座標系からビュー座標系への変換行列の各要素を、GE17内の後述するレジスタGR0〜GR11に格納しておく。出力データの形式は、後述するVector32構造体である。   In step S21, the GE 17 performs an affine transformation from the local coordinate system to the view coordinate system on the vertex coordinates by the command “Affine”, and outputs the vertex coordinates of the view coordinate system. Before executing the command, each element of the transformation matrix from the local coordinate system to the view coordinate system is stored in registers GR0 to GR11 described later in the GE17. The format of the output data is a Vector32 structure described later.

ステップS22にて、GE17は、コマンド「Pproj」によって、ビュー座標系に変換された頂点座標に対して、ビュー座標系から透視座標系への透視投影変換を施し、透視座標系の頂点座標を出力する。なお、コマンド実行前に、視点から投影面までの距離を、GE17内の後述するレジスタ「Distance」に格納しておく。出力データの形式は、後述するVector16構造体である。   In step S22, the GE 17 performs perspective projection conversion from the view coordinate system to the perspective coordinate system on the vertex coordinates converted to the view coordinate system by the command “Pproj”, and outputs the vertex coordinates of the perspective coordinate system. To do. Before executing the command, the distance from the viewpoint to the projection plane is stored in a register “Distance” described later in the GE 17. The format of the output data is a Vector16 structure described later.

ステップS23にて、GE17は、コマンド「View」によって、透視座標系に変換された頂点座標に対して、透視座標系からスクリーン座標系へのビューポート変換を施し、スクリーン座標系の頂点座標を出力する。なお、コマンド実行前に、X座標オフセット値及びY座標オフセット値を、GE17内の後述するレジスタ「ViewportOffsetX」及び「ViewportOffsetY」に格納しておく。出力データの形式は、後述するVector16構造体である。   In step S23, the GE 17 performs viewport conversion from the perspective coordinate system to the screen coordinate system on the vertex coordinates converted to the perspective coordinate system by the command “View”, and outputs the vertex coordinates of the screen coordinate system. To do. Before executing the command, the X coordinate offset value and the Y coordinate offset value are stored in registers “ViewportOffsetX” and “ViewportOffsetY” to be described later in the GE 17. The format of the output data is a Vector16 structure described later.

ここで、コマンド「Affine」、「Pproj」、及び「View」をそれぞれ単独で実行する代わりに、コマンド「APV」によって、これらの処理を一括して実行することもが可能である。   Here, instead of executing each of the commands “Affine”, “Pproj”, and “View” independently, it is also possible to execute these processes collectively by the command “APV”.

なお、この頂点座標変換の処理を、ポリゴン頂点座標の変換だけでなく、スプライト座標の変換にも用いることが可能である。   This vertex coordinate conversion process can be used not only for polygon vertex coordinate conversion but also for sprite coordinate conversion.

次に、ライティングについて説明する。マルチメディアプロセッサ1が扱う標準的な3Dグラフィックスにおいては、光源として平行光源がワールド座標中に1つだけ存在することを想定している。すなわち、光源の座標は設定されず、光源を向く矢印の向きが光源ベクトルとして設定される。平行光源の例としては太陽光が挙げられる。   Next, lighting will be described. In standard 3D graphics handled by the multimedia processor 1, it is assumed that only one parallel light source exists in the world coordinates as a light source. That is, the coordinates of the light source are not set, and the direction of the arrow pointing to the light source is set as the light source vector. An example of a parallel light source is sunlight.

マルチメディアプロセッサ1が扱う標準的なライティング処理においては、オブジェクトの表面は100%の拡散反射を行うものとして想定され、鏡面反射は考慮されない。ここでは、100%の拡散反射を、「入射した光が全ての方向に対して均一に反射をすること」として定義する。この場合、オブジェクトの表面をどの方向から見ても明るさは変わらない。すなわち、オブジェクト表面の明るさは、表面の法線ベクトルと光源ベクトルとの成す角によってのみ定められ、視点の位置に左右されない。したがって、拡散光明度「diffuse」は、下記の式のように、2つのベクトルの内積より求められる。但し、内積演算結果が負の場合、結果は「0」に飽和される。   In the standard lighting process handled by the multimedia processor 1, the object surface is assumed to perform 100% diffuse reflection, and specular reflection is not considered. Here, 100% diffuse reflection is defined as “the incident light is uniformly reflected in all directions”. In this case, the brightness does not change regardless of the direction of the surface of the object. That is, the brightness of the object surface is determined only by the angle formed by the normal vector of the surface and the light source vector, and is not affected by the position of the viewpoint. Accordingly, the diffuse light brightness “diffuse” is obtained from the inner product of two vectors as shown in the following equation. However, if the inner product operation result is negative, the result is saturated to “0”.

Figure 2007128180
Figure 2007128180

(数7)において、ベクトルLは光源ベクトル(単位ベクトル)、ベクトルNはオブジェクト表面の単位法線ベクトル、角度θはベクトルLとベクトルNとが成す角を示す。   In (Expression 7), a vector L is a light source vector (unit vector), a vector N is a unit normal vector on the object surface, and an angle θ is an angle formed by the vector L and the vector N.

但し、このライティングモデルでは、オブジェクト表面を裏側から見ている場合のライティング結果を正しく得ることができない。このため、オブジェクトの表裏にかかわらず光源が照らしている面を見ている場合、すなわち、ベクトルLとベクトルNとの内積の符号と、視線ベクトルとベクトルNとの内積の符号とが等しい場合、オブジェクト表面の単位法線ベクトルと光源ベクトルとの内積演算結果の絶対値を求めることにより、正しいライティング結果を得る。これを整理すると、(数7)の拡散光明度の算出式は、以下のように修正される。   However, with this lighting model, the lighting result cannot be obtained correctly when the object surface is viewed from the back side. For this reason, when looking at the surface illuminated by the light source regardless of the front and back of the object, that is, when the sign of the inner product of the vector L and the vector N is equal to the sign of the inner product of the line-of-sight vector and the vector N, A correct lighting result is obtained by obtaining the absolute value of the inner product calculation result of the unit normal vector on the object surface and the light source vector. If this is rearranged, the formula for calculating the diffused light brightness in (Expression 7) is corrected as follows.

Figure 2007128180
Figure 2007128180

(数8)において、ベクトルVは視線ベクトル(単位ベクトル)とし、角度θ´はベクトルVとベクトルNとが成す角を示す。視線ベクトルは、物体表面に法線ベクトルが設定されている点から視点へと向かうベクトルとして与えられるべきであるが、ライティングを施す全ての頂点およびポリゴン(面)に対して各々の視線ベクトルを算出すると膨大な演算量となってしまうため、マルチメディアプロセッサ1のライティングモデルでは、ビュー座標系での視線ベクトルを常に(0,0,−1)として扱う。   In (Equation 8), the vector V is a line-of-sight vector (unit vector), and the angle θ ′ indicates an angle formed by the vector V and the vector N. The line-of-sight vector should be given as a vector from the point where the normal vector is set on the object surface to the viewpoint, but each line-of-sight vector is calculated for all vertices and polygons (surfaces) to which lighting is applied. In this case, since the amount of calculation becomes enormous, the lighting model of the multimedia processor 1 always treats the line-of-sight vector in the view coordinate system as (0, 0, −1).

ここまで、ベクトルNをオブジェクト表面の単位法線ベクトルとして扱っているが、後述のように、テクスチャマッピングモードのポリゴンに対するライティング処理では、ポリゴン(面)の法線ベクトルを入力データとして扱い、グーローシェーディングモードのポリゴンに対するライティング処理では、ポリゴンの頂点に対する法線ベクトルを入力データとして扱う。したがって、ベクトルNは、ライティングを施すポリゴンの描画モードに応じて、「ポリゴン(面)の単位法線ベクトル」あるいは「頂点の単位法線ベクトル」として扱われる。   Up to this point, the vector N is treated as a unit normal vector on the object surface. However, as will be described later, in the lighting processing for polygons in texture mapping mode, the normal vector of the polygon (surface) is treated as input data, In the lighting process for the polygon in the shading mode, the normal vector for the vertex of the polygon is handled as input data. Therefore, the vector N is treated as a “polygon (surface) unit normal vector” or “vertex unit normal vector” depending on the drawing mode of the polygon to be illuminated.

ところで、実際の空間に存在する物体は、太陽や電灯等の自ら発光する光源によってのみ照らされるのではなく、他の物体や物体自体の他の面によって反射された光がさらに物体表面を照らす。これを演算によって求めると膨大な演算量となってしまうため、リアルタイムの3Dグラフィックスの生成には適さない。しかし、単一の平行光源の反射光のみをモデル化すると、光源ベクトルと法線ベクトルとの成す角がπ/2ラジアン(=90度)以上の場合にポリゴンの表(おもて)の面に全く光が当たらないことになる。結果として、ポリゴンの表(おもて)の面は黒色で描画されることとなり、リアリティに欠ける表現となってしまう。   By the way, an object that exists in an actual space is not illuminated only by a light source that emits light such as the sun or an electric light, but light reflected by another object or another surface of the object itself further illuminates the object surface. If this is obtained by calculation, the calculation amount becomes enormous, and is not suitable for generating real-time 3D graphics. However, if only the reflected light of a single parallel light source is modeled, the surface of the polygonal table (front) will be used when the angle between the light source vector and the normal vector is π / 2 radians (= 90 degrees) or more. Will not be exposed to light at all. As a result, the front surface of the polygon is drawn in black, resulting in an expression lacking reality.

そこで、マルチメディアプロセッサ1においては、オブジェクトの全ての面に環境光明度「ambient」として拡散光明度「diffuse」に一定値を加算する形の表現をとる。したがって、ポリゴン/頂点の明度「brightness」は、下記のように求められる。   Therefore, the multimedia processor 1 takes an expression in which a constant value is added to the diffuse light intensity “diffuse” as the ambient light intensity “ambient” on all surfaces of the object. Therefore, the brightness of the polygon / vertex “brightness” is obtained as follows.

Figure 2007128180
Figure 2007128180

但し、上記のように加算は飽和演算として行われるため、加算結果が1.0以上となる場合には、結果は1.0に飽和される。   However, since the addition is performed as a saturation operation as described above, when the addition result is 1.0 or more, the result is saturated to 1.0.

次に、フローチャートを用いて、テクスチャマッピングモードでのライティング処理について説明する。なお、テクスチャマッピングモードのポリゴンに対しては、ライティング処理はポリゴン(面)単位で行われる。   Next, lighting processing in the texture mapping mode will be described using a flowchart. Note that the lighting process is performed in units of polygons (surfaces) for polygons in texture mapping mode.

図5は、テクスチャマッピングモードでのポリゴンに対するライティング処理のフローチャートである。先ず、入力データとして、ポリゴン(面)毎の法線ベクトル配列を用意する。この配列の要素数および並び順は、出力データを格納する後述のポリゴン構造体配列の要素数および並び順に一致している必要がある。この法線ベクトル配列の各要素は、後述するVector10構造体であり、ローカル座標系の単位法線ベクトルを示している。   FIG. 5 is a flowchart of lighting processing for polygons in the texture mapping mode. First, a normal vector array for each polygon (surface) is prepared as input data. The number of elements and the order of arrangement in this array need to match the number of elements and the order of arrangement in a polygon structure array (to be described later) that stores output data. Each element of the normal vector array is a Vector10 structure to be described later, and indicates a unit normal vector in the local coordinate system.

オブジェクトが変形しない場合、予め算出したローカル座標系の単位法線ベクトルを、外部メモリ50に格納しておくことが好ましい。一方、オブジェクトが変形する場合等、各ポリゴン(面)の単位法線ベクトルをリアルタイムで算出する必要がある場合には、ベクトルの外積を用いて算出する。ポリゴンの表の面(あるいは片面ポリゴンの可視面)を頂点ABCが時計回りに配置されている側とすると、ポリゴンの単位法線ベクトルNは下記の式で求められる。なお、本実施の形態では、ポリゴンを三角形に限定する。   When the object is not deformed, it is preferable to store the unit normal vector of the local coordinate system calculated in advance in the external memory 50. On the other hand, when the unit normal vector of each polygon (surface) needs to be calculated in real time, such as when the object is deformed, it is calculated using the outer product of the vectors. If the front surface of the polygon (or the visible surface of the single-sided polygon) is the side on which the vertex ABC is arranged clockwise, the unit normal vector N of the polygon can be obtained by the following equation. In the present embodiment, the polygon is limited to a triangle.

Figure 2007128180
Figure 2007128180

(数10)において、ベクトルBは頂点Aから頂点Bへ向かうベクトル、ベクトルCは頂点Aから頂点Cへ向かうベクトルを示す。   In (Equation 10), vector B is a vector from vertex A to vertex B, and vector C is a vector from vertex A to vertex C.

ステップS31にて、GE17は、コマンド「Trans」によって、ポリゴンの法線ベクトルに対して、ローカル座標系からビュー座標系への直交変換(回転変換)を施し、ビュー座標系の単位法線ベクトルを出力する。なお、コマンド実行前に、ローカル座標系からビュー座標系への変換行列の各要素を、GE17内のレジスタGR0〜GR8に格納しておく。出力ベクトルの形式は、後述するVector32構造体である。   In step S31, the GE 17 performs orthogonal transformation (rotation transformation) from the local coordinate system to the view coordinate system with respect to the polygon normal vector by the command “Trans”, and obtains the unit normal vector of the view coordinate system. Output. Before executing the command, each element of the transformation matrix from the local coordinate system to the view coordinate system is stored in the registers GR0 to GR8 in the GE17. The format of the output vector is a Vector32 structure described later.

ステップS32にて、GE17は、コマンド「Dot」によって、ビュー座標系におけるポリゴンの法線ベクトルとビュー座標系における光源ベクトルとの内積を算出し、結果をポリゴン明度配列に出力する。なお、コマンド実行前に、ビュー座標系における光源ベクトルの各要素を、GE17内のレジスタ「LightVX」、「LightVY」、及び「LightVZ」に格納しておく。出力されるデータの形式は、後述するDot構造体である。   In step S32, the GE 17 calculates the inner product of the polygon normal vector in the view coordinate system and the light source vector in the view coordinate system by the command “Dot”, and outputs the result to the polygon brightness array. Before executing the command, each element of the light source vector in the view coordinate system is stored in the registers “LightVX”, “LightVY”, and “LightVZ” in the GE 17. The format of the output data is a Dot structure which will be described later.

ステップS33にて、GE17は、コマンド「Bright−P」によって、Dot構造体配列に格納されたビュー座標系におけるポリゴンの法線ベクトルとビュー座標系における光源ベクトルとの内積演算結果と、GE17内のレジスタ「Ambient」に格納された環境光明度と、から、ポリゴン(面)毎の明度を算出し、後述のポリゴン構造体配列のメンバ「Light」として格納する。   In step S33, the GE 17 uses the command “Bright-P” to calculate the inner product operation result of the normal vector of the polygon in the view coordinate system and the light source vector in the view coordinate system stored in the Dot structure array, The brightness for each polygon (surface) is calculated from the ambient light brightness stored in the register “Ambient” and stored as a member “Light” of a polygon structure array, which will be described later.

なお、コマンド「Trans」、「Dot」、及び「Bright−P」をそれぞれ単独で実行する代わりに、コマンド「TDBP」によって、これらの処理を一括して実行することが可能である。   Instead of executing the commands “Trans”, “Dot”, and “Bright-P” individually, these processes can be executed collectively by the command “TDBP”.

RPU9は、描画処理時に、ポリゴン構造体インスタンスのメンバ「Light」の値とカラーパレットRAM11から読み出した各テクセルのRGB値との乗算結果から、ポリゴンの各ピクセルの描画色を算出する。したがって、カラーパレットRAM11に設定する値は、明度100%の場合のカラーデータ、すなわちテクスチャの元来のカラーデータである。   The RPU 9 calculates the drawing color of each pixel of the polygon from the multiplication result of the value of the member “Light” of the polygon structure instance and the RGB value of each texel read from the color palette RAM 11 during the drawing process. Therefore, the value set in the color palette RAM 11 is the color data when the brightness is 100%, that is, the original color data of the texture.

次に、フローチャートを用いて、グーローシェーディングモードでのライティング処理について説明する。なお、グーローシェーディングモードのポリゴンに対しては、ライティング処理は頂点単位で行われる。   Next, lighting processing in the Gouraud shading mode will be described using a flowchart. Note that lighting processing is performed on a vertex basis for polygons in Gouraud shading mode.

図6は、グーローシェーディングモードでのライティング処理の流れを示すフローチャートである。図6を参照して、先ず、入力データとして、頂点毎の法線ベクトル配列を用意する。この配列の要素数および並び順は、出力データを格納する後述のポリゴン構造体配列が参照する、スクリーン座標系における頂点座標配列の要素数および並び順に一致している必要がある。この法線ベクトル配列の各要素は、後述するVector10構造体であり、ローカル座標系の単位法線ベクトルを示している。   FIG. 6 is a flowchart showing the flow of lighting processing in the Gouraud shading mode. Referring to FIG. 6, first, a normal vector array for each vertex is prepared as input data. The number of elements and the arrangement order of this array must match the number of elements and the arrangement order of the vertex coordinate array in the screen coordinate system referred to by a polygon structure array described later that stores output data. Each element of the normal vector array is a Vector10 structure to be described later, and indicates a unit normal vector in the local coordinate system.

オブジェクトが変形しない場合、予め算出したローカル座標系の単位法線ベクトルを、外部メモリ50に格納しておくことが好ましい。一方、オブジェクトが変形する場合等、各頂点の単位法線ベクトルをリアルタイムで算出する必要がある場合、算出方法の一例として、頂点を共有するポリゴン(面)の単位法線ベクトルの平均によって近似する手法が挙げられる。   When the object is not deformed, it is preferable to store the unit normal vector of the local coordinate system calculated in advance in the external memory 50. On the other hand, when it is necessary to calculate the unit normal vector of each vertex in real time, such as when the object is deformed, as an example of the calculation method, it is approximated by the average of the unit normal vectors of polygons (faces) sharing the vertex. A method is mentioned.

ステップS41にて、GE17は、コマンド「Trans」によって、頂点の法線ベクトルに対して、ローカル座標系からビュー座標系への直交変換(回転変換)を施し、ビュー座標系の単位法線ベクトルを出力する。なお、コマンド実行前に、ローカル座標系からビュー座標系への変換行列の各要素を、GE17内のレジスタGR0〜GR8に格納しておく。出力ベクトルの形式は、後述するVector32構造体である。   In step S41, the GE 17 performs orthogonal transformation (rotation transformation) from the local coordinate system to the view coordinate system with respect to the vertex normal vector by the command “Trans” to obtain the unit normal vector of the view coordinate system. Output. Before executing the command, each element of the transformation matrix from the local coordinate system to the view coordinate system is stored in the registers GR0 to GR8 in the GE17. The format of the output vector is a Vector32 structure described later.

ステップS42にて、GE17は、コマンド「Dot」によって、ビュー座標系における頂点の法線ベクトルとビュー座標系における光源ベクトルとの内積を算出し、結果を頂点明度配列に出力する。なお、コマンド実行前に、ビュー座標系における光源ベクトルの各要素を、GE17内のレジスタ「LightVX」、「LightVY」、及び「LightVZ」に格納しておく。出力されるデータの形式は、後述するDot構造体である。   In step S42, the GE 17 calculates the inner product of the normal vector of the vertex in the view coordinate system and the light source vector in the view coordinate system by the command “Dot”, and outputs the result to the vertex brightness array. Before executing the command, each element of the light source vector in the view coordinate system is stored in the registers “LightVX”, “LightVY”, and “LightVZ” in the GE 17. The format of the output data is a Dot structure which will be described later.

ステップS43にて、GE17は、コマンド「Ccalc」によって、先ず、Dot構造体配列に格納されたビュー座標系における頂点の法線ベクトルとビュー座標系における光源ベクトルとの内積演算結果と、GE17内のレジスタ「Ambient」に格納された環境光明度とから、頂点毎の明度を算出する。その後、算出された頂点の明度と、ポリゴン構造体インスタンスのメンバ「Ac」、「Bc」、及び「Cc」に格納されている各頂点のRGB値との乗算結果から、ライティング後の各頂点のRGB値を算出し、ポリゴン構造体インスタンスのメンバ「Ac」、「Bc」、及び「Cc」に書き戻す。   In step S43, the GE 17 first executes the inner product calculation result of the normal vector of the vertex in the view coordinate system and the light source vector in the view coordinate system stored in the Dot structure array by the command “Ccalc”, The brightness for each vertex is calculated from the ambient light brightness stored in the register “Ambient”. Thereafter, from the multiplication result of the calculated brightness of the vertex and the RGB value of each vertex stored in the members “Ac”, “Bc”, and “Cc” of the polygon structure instance, each vertex after lighting is calculated. The RGB values are calculated and written back to the members “Ac”, “Bc”, and “Cc” of the polygon structure instance.

なお、コマンド「Trans」及び「Dot」をそれぞれ単独で実行する代わりに、コマンド「TD」によって、これらの処理を一括して実行することが可能である。   Instead of executing the commands “Trans” and “Dot” independently, these processes can be executed collectively by the command “TD”.

RPU9は、描画処理時に、ポリゴン構造体インスタンスの「Ac」、「Bc」、及び「Cc」に格納されている各頂点のRGB値から直線補間により、ポリゴンの各ピクセルの描画色を算出する。   The RPU 9 calculates the drawing color of each pixel of the polygon by linear interpolation from the RGB values of each vertex stored in “Ac”, “Bc”, and “Cc” of the polygon structure instance during the drawing process.

次に、裏面カリングについて説明する。マルチメディアプロセッサ1で扱われるポリゴンには、片面ポリゴンと両面ポリゴンとがある。片面ポリゴンは裏側から見た場合に表示されないものとして定義しているので、片面ポリゴンの裏面の描画を省略することにより、描画処理の無駄を省き、総合的な描画能力の向上を図ることができる。片面ポリゴンの裏面の描画を省略する処理を裏面カリングと呼ぶ。   Next, back surface culling will be described. Polygons handled by the multimedia processor 1 include single-sided polygons and double-sided polygons. Since single-sided polygons are defined as those that are not displayed when viewed from the back side, drawing on the back side of single-sided polygons can be omitted, so that drawing processing is not wasted and overall drawing ability can be improved. . The process of omitting the drawing of the back side of a single-sided polygon is called back side culling.

図7(a)は、ポリゴンの表の面の例示図、図7(b)は、ポリゴンの裏の面の例示図である。図7(a)及び図7(b)に示すように、マルチメディアプロセッサ1では、ポリゴンPの表裏を頂点の並び順で定めている。つまり、ポリゴンPの頂点ABCが、時計回りに並んで見える面を「表(おもて)面」、反時計回りに並んで見える面を「裏面」と定義する。このような定義に基づくと、ポリゴンPの表裏判定を行うために、ベクトルの外積を用いることができる。   FIG. 7A is an exemplary diagram of the front surface of the polygon, and FIG. 7B is an exemplary diagram of the back surface of the polygon. As shown in FIGS. 7A and 7B, the multimedia processor 1 determines the front and back of the polygon P in the order of apexes. That is, the surface where the vertices ABC of the polygon P can be viewed side by side in the clockwise direction is defined as the “front surface”, and the surface that is viewed in the counterclockwise direction is defined as the “back surface”. Based on such a definition, an outer product of vectors can be used to determine whether the polygon P is front or back.

ベクトルaとベクトルbとの外積によって得られるベクトルa×bは、ベクトルa及びbと垂直かつ、ベクトルaからベクトルbへと右ねじを回した場合のねじの進行方向を向いている。したがって、ベクトルa×bと視線ベクトルとの内積を算出することにより、ポリゴンPを視点から見て、表裏のいずれの面が見えているかを判別できる。   The vector a × b obtained by the outer product of the vector a and the vector b is perpendicular to the vectors a and b, and is directed in the screw traveling direction when the right screw is turned from the vector a to the vector b. Therefore, by calculating the inner product of the vector a × b and the line-of-sight vector, it is possible to determine which side of the front and back is visible when viewing the polygon P from the viewpoint.

GE17が行うポリゴンの表裏判定においては、スクリーン座標系に変換されたポリゴンが用いられ、全てのポリゴンの頂点のZ座標は同じ値であるとみなされる。このようにしても視点から見た表裏の関係は変わらないため、外積の計算を単純化できる利点がある。   In the polygon front / back determination performed by the GE 17, polygons converted into the screen coordinate system are used, and the Z coordinates of the vertices of all the polygons are regarded as the same value. Even if it does in this way, since the relationship between the front and back viewed from the viewpoint does not change, there is an advantage that the calculation of the outer product can be simplified.

例えば、ベクトルa、ベクトルb、およびベクトルa×bの各ベクトルの3次元直交座標系での成分を、それぞれ(Xa,Ya,Za)、(Xb,Yb,Zb)、および(Xab,Yab,Zab)とすると、ベクトルa×bの各成分は以下のように求められる。   For example, the components of the vector a, the vector b, and the vector a × b in the three-dimensional orthogonal coordinate system are respectively (Xa, Ya, Za), (Xb, Yb, Zb), and (Xab, Yab, Zab), each component of the vector a × b is obtained as follows.

Figure 2007128180
Figure 2007128180

ただし、GE17は、Za=Zb=0とみなすため、次式のみを実行する。   However, since GE17 considers Za = Zb = 0, only the following equation is executed.

Figure 2007128180
Figure 2007128180

スクリーン座標系におけるポリゴンの頂点ABCのXY座標をそれぞれ(Ax,Ay)、(Bx,By)、及び(Cx,Cy)とすると、表裏判定のためのベクトルの外積のZ成分Vzは、次のようになる。   If the XY coordinates of the vertex ABC of the polygon in the screen coordinate system are (Ax, Ay), (Bx, By), and (Cx, Cy), respectively, the Z component Vz of the outer product of the vectors for front / back determination is It becomes like this.

Figure 2007128180
Figure 2007128180

GE17は、コマンド「CWD」に応じて、スクリーン座標系の頂点座標が格納されたポリゴン構造体インスタンスのメンバ「Ax」、「Ay」、「Bx」、「By」、「Cx」、および「Cy」の値より、ベクトルの外積のZ成分Vzを求める。   In response to the command “CWD”, the GE 17 selects the members “Ax”, “Ay”, “Bx”, “By”, “Cx”, and “Cy” of the polygon structure instance in which the vertex coordinates of the screen coordinate system are stored. The Z component Vz of the outer product of the vectors is obtained from the value of "."

また、GE17は、ポリゴン構造体インスタンスのメンバ「Face」より、ポリゴンが「片面ポリゴン」か「両面ポリゴン」かを判別し、下記のように裏面カリング処理を行う。つまり、GE17は、メンバ「Face」=0の場合(つまり、片面ポリゴンの場合)、Vz≧0ならば、裏面カリングを行い、メンバ「Face」=1の場合(つまり、両面ポリゴンの場合)、裏面カリングを行わない。   Further, the GE 17 determines whether the polygon is a “single-sided polygon” or a “double-sided polygon” from the member “Face” of the polygon structure instance, and performs back surface culling processing as described below. That is, the GE 17 performs back surface culling when the member “Face” = 0 (that is, a single-sided polygon), and Vz ≧ 0, and when the member “Face” = 1 (that is, a double-sided polygon). Do not perform backside culling.

GE17は、裏面カリングされるポリゴン構造体インスタンスのメンバ「Ax」、「Bx」、及び「Cx」には、それぞれ「2047」(X座標の最大値)を設定し、メンバ「Ay」、「By」、及び「Cy」には、それぞれ「1023」(Y座標の最大値)を設定する。   The GE 17 sets “2047” (the maximum value of the X coordinate) to the members “Ax”, “Bx”, and “Cx” of the polygon structure instance to be back-culled, and sets the members “Ay”, “By”. ”And“ Cy ”are set to“ 1023 ”(the maximum value of the Y coordinate), respectively.

また、コマンド「CWD」の発行時に、GE17内のレジスタ「GECommand」のフィールド「InvalidStructureRemove」に「1」が設定されていた場合、GE17は、裏面カリングされたポリゴン構造体インスタンスを、出力されるポリゴン構造体配列から取り除き、有効なポリゴン構造体インスタンスのみを前詰めで配列に格納する。   Also, when the command “CWD” is issued and the field “InvalidStructureRemove” of the register “GECommand” in the GE 17 is set to “1”, the GE 17 outputs the polygon structure instance that has been back-culled to the output polygon. Remove from the structure array and store only valid polygon structure instances in the array, padded.

次に、ビューボリュームクリッピングについて説明する。ビューボリュームクリッピングとは、視点に近すぎるポリゴンまたは視点から遠すぎるポリゴンや、透視投影変換後にスクリーン座標系からはみ出してしまうポリゴンの描画を省略することにより、効率的な描画処理を実現するための機能である。   Next, view volume clipping will be described. View volume clipping is a function for realizing efficient drawing processing by omitting drawing of polygons that are too close to the viewpoint or far from the viewpoint, or polygons that protrude from the screen coordinate system after perspective projection conversion. It is.

マルチメディアプロセッサ1におけるビューボリュームクリッピングは、GE17に対するコマンド「Pproj」および「View」(あるいはコマンド「Pproj」および「View」を含む複合コマンド「APV」)によって、頂点座標が、設定されたビューボリューム内に存在するか否かをテストし、GE17に対するコマンド「CWD」によって、ビューボリューム内に無い頂点を持つポリゴン構造体インスタンスをカリングすることで行う。これらのことを図面を用いて説明する。   The view volume clipping in the multimedia processor 1 is performed in the view volume in which the vertex coordinates are set by the commands “Pproj” and “View” (or the composite command “APV” including the commands “Pproj” and “View”) for the GE 17. And culling a polygon structure instance having a vertex not in the view volume by a command “CWD” to the GE 17. These will be described with reference to the drawings.

図8は、ビューボリュームクリッピングの説明図である。図8を参照して、ニアクリップ面NCは、GE17内のレジスタ「ZNear」によって規定され、ファークリップ面FCは、GE17内のレジスタ「ZFar」によって規定される。ビューボリュームVVは、ニアクリップ面NCとファークリップ面FCとで囲まれた空間となる。GE17は、透視投影変換を行う前に、ビュー座標系の頂点のZ座標の値がビューボリュームVVの範囲内に入っているか否かをテストする。   FIG. 8 is an explanatory diagram of view volume clipping. Referring to FIG. 8, the near clip plane NC is defined by a register “ZNear” in the GE 17, and the far clip plane FC is defined by a register “ZFar” in the GE 17. The view volume VV is a space surrounded by the near clip surface NC and the far clip surface FC. The GE 17 tests whether the value of the Z coordinate of the vertex of the view coordinate system is within the range of the view volume VV before performing perspective projection conversion.

そして、GE17は、ビュー座標系の頂点のZ座標が、レジスタ「ZNear」の値未満、あるいはレジスタ「ZFar」の値を超えている場合、スクリーン座標系における頂点座標を格納するVector16構造体のメンバ「Clipping」に「1」をセットする。また、GE17は、コマンド「View」によるビューポート変換後のスクリーン座標系の頂点X座標の値が「0」未満または「2048」以上の場合や、スクリーン座標系の頂点Y座標の値が「0」未満あるいは「1024」以上の場合にも、スクリーン座標系における頂点座標を格納するVector16構造体のメンバ「Clipping」に「1」をセットする。   The GE 17 is a member of the Vector 16 structure that stores the vertex coordinates in the screen coordinate system when the Z coordinate of the vertex in the view coordinate system is less than the value of the register “ZNear” or exceeds the value of the register “ZFar”. Set “1” to “Clipping”. In addition, the GE 17 determines that the value of the vertex X coordinate in the screen coordinate system after the viewport conversion by the command “View” is less than “0” or greater than “2048”, or the value of the vertex Y coordinate in the screen coordinate system is “0”. "1" is set to the member "Clipping" of the Vector16 structure that stores the vertex coordinates in the screen coordinate system even when the value is less than "" or greater than "1024".

そして、コマンド「CWD」に応じて、GE17は、スクリーン座標系における頂点座標配列を参照して、ポリゴン構造体インスタンスの頂点座標を設定するが、この際にメンバ「Clipping」に「1」がセットされている頂点がポリゴン構造体インスタンスの3頂点のいずれかに含まれている場合、そのポリゴン構造体インスタンスをカリングする。つまり、そのポリゴン構造体インスタンスのメンバ「Ax」、「Bx」、及び「Cx」のそれぞれに「2047」を、メンバ「Ay」、「By」、及び「Cy」のそれぞれに「1023」を設定する。   Then, according to the command “CWD”, the GE 17 refers to the vertex coordinate array in the screen coordinate system and sets the vertex coordinates of the polygon structure instance. At this time, “1” is set to the member “Clipping”. If the selected vertex is included in any of the three vertices of the polygon structure instance, the polygon structure instance is culled. That is, “2047” is set for each of the members “Ax”, “Bx”, and “Cx” of the polygon structure instance, and “1023” is set for each of the members “Ay”, “By”, and “Cy”. To do.

また、コマンド「CWD」の発行時に、GE17内のレジスタ「GECommand」のフィールド「InvalidStructureRemove」に「1」が設定されていた場合、GE17は、カリングされたポリゴン構造体インスタンスを、出力されるポリゴン構造体配列から取り除き、有効なポリゴン構造体インスタンスのみを前詰めで配列に格納する。   Further, when the command “CWD” is issued and the field “InvalidStructureRemove” of the register “GECommand” in the GE 17 is set to “1”, the GE 17 outputs the polygon structure instance to which the culled polygon structure instance is output. Remove from the body array and store only valid polygon structure instances in the array justified.

次に、パースペクティブコレクト(遠近補正)について説明する。   Next, perspective correction (perspective correction) will be described.

図9(a)は、パースペクティブコレクトを施したテクスチャマッピングの例示図、図9(b)は、パースペクティブコレクトを施していないテクスチャマッピングの例示図である。透視投影変換された三次元イメージを表現するテクスチャマッピングにおいて、画面上の描画ピクセルに対応するテクセルのUV座標を、ポリゴンの各頂点座標に対応する、テクセルのUV座標の単なる線形補完によって求めると、図9(b)に示すように、マッピングされたイメージが歪んでしまうことがある。特に頂点のZ座標(奥行き)に大きく差がある場合には歪みが大きくなり、複数の3角形ポリゴンで構成される平面の継ぎ目が不自然に見える等の問題が発生する。そこで、このような歪みを解消して、図9(a)に示すような歪みのないイメージを生成するために、パースペクティブコレクト(遠近補正)の機能が搭載されている。   FIG. 9A is an exemplary diagram of texture mapping subjected to perspective correction, and FIG. 9B is an exemplary diagram of texture mapping not subjected to perspective correction. In texture mapping expressing a perspective projection transformed three-dimensional image, the texel UV coordinate corresponding to the drawing pixel on the screen is obtained by mere linear interpolation of the texel UV coordinate corresponding to each vertex coordinate of the polygon. As shown in FIG. 9B, the mapped image may be distorted. In particular, when there is a large difference in the Z coordinate (depth) of the vertices, the distortion becomes large, and problems such as unnatural appearance of a joint of a plane composed of a plurality of triangular polygons occur. Therefore, in order to eliminate such distortion and generate an image without distortion as shown in FIG. 9A, a function of perspective correct (perspective correction) is installed.

ここで、UV座標系は、テクセルデータを格納する2次元直交座標系であり、UV座標で定められる空間をUV空間とする。三角形ポリゴンの各頂点A,B及びCをUV空間へ写像したときの座標を(Au,Av)、(Bu,Bv)および(Cu,Cv)とする。また、各頂点A,B及びCのビュー座標系におけるXYZ座標を(Ax,Ay,Az)、(Bx,By,Bz)および(Cx,Cy,Cz)とする。   Here, the UV coordinate system is a two-dimensional orthogonal coordinate system for storing texel data, and a space defined by the UV coordinates is a UV space. The coordinates when the vertices A, B, and C of the triangular polygon are mapped to the UV space are (Au, Av), (Bu, Bv), and (Cu, Cv). Further, XYZ coordinates in the view coordinate system of the vertices A, B and C are (Ax, Ay, Az), (Bx, By, Bz) and (Cx, Cy, Cz).

そうしたとき、(Au/Az,Av/Az,1/Az)、(Bu/Bz,Bv/Bz,1/Bz)および(Cu/Cz,Cv/Cz,1/Cz)の線形補間によって求められた値(u/z,v/z,1/z)の「u/z」に「1/z」の逆数を乗じた値u、および、「v/z」に「1/z」の逆数を乗じた値vを、UV空間におけるテクセル座標(u,v)としてテクセルデータを取得することにより、透視投影変換後の正確なテクスチャマッピングを実現する。   When doing so, it is obtained by linear interpolation of (Au / Az, Av / Az, 1 / Az), (Bu / Bz, Bv / Bz, 1 / Bz) and (Cu / Cz, Cv / Cz, 1 / Cz). Value u / z, v / z, 1 / z multiplied by the inverse of “1 / z”, and “v / z” is the inverse of “1 / z” Accurate texture mapping after perspective projection conversion is realized by acquiring texel data using the value v multiplied by as texel coordinates (u, v) in the UV space.

ただし、マルチメディアプロセッサ1では、「1/Az」、「1/Bz」および「1/Cz」を頂点毎に設定する代りに、「1/Bz」および「1/Cz」に「Az」を掛け合わせた値、すなわち、「Az/Bz」および「Az/Cz」をポリゴン構造体インスタンスのメンバ「Bw」及び「Cw」にそれぞれ設定する。但し、頂点Aに対するパラメータは常に「1」となるため、ポリゴン構造体には含まれない。   However, in the multimedia processor 1, instead of setting “1 / Az”, “1 / Bz” and “1 / Cz” for each vertex, “Az” is set to “1 / Bz” and “1 / Cz”. The multiplied values, that is, “Az / Bz” and “Az / Cz” are set to the members “Bw” and “Cw” of the polygon structure instance, respectively. However, since the parameter for the vertex A is always “1”, it is not included in the polygon structure.

コマンド「CWD」は、ポリゴン構造体インスタンスのメンバ「Type」の値が「0」を示し(つまり、テクスチャマッピングモードのとき)、かつ、カリングされないポリゴン構造体インスタンスに対して、メンバ「Bw」及び「Cw」を算出する処理を行う。   The command “CWD” indicates that the value of the member “Type” of the polygon structure instance indicates “0” (that is, in the texture mapping mode) and the member “Bw” and the polygon structure instance that is not culled are A process of calculating “Cw” is performed.

次に、描画優先順位を示すデプス値の算出について説明する。RPU9は、ポリゴン単位での描画優先順位に従ってポリゴンの描画を行う。したがって、GE17は、ビュー座標系におけるポリゴンの3頂点のZ座標から、ポリゴンの描画優先順位を表すデプス値の算出を行う必要がある。ポリゴンは、デプス値が大きいほど奥に(先に)描画され、デプス値が小さいほど手前に(後に)描画される。デプス値は、描画されるポリゴン構造体インスタンスのメンバ「Depth」に格納される。   Next, calculation of the depth value indicating the drawing priority will be described. The RPU 9 draws polygons according to drawing priority in polygon units. Therefore, the GE 17 needs to calculate a depth value representing the drawing priority of polygons from the Z coordinates of the three vertices of the polygons in the view coordinate system. The polygon is drawn in the back (first) as the depth value increases, and is drawn toward the front (after) as the depth value decreases. The depth value is stored in the member “Depth” of the polygon structure instance to be drawn.

ポリゴン構造体のメンバ「Depth」は、12ビットの浮動小数点数であり、下位8ビットの仮数フィールドと上位4ビットの指数フィールドとから成る。12ビットの浮動小数点数形式のメンバ「Depth」の示す値は、以下の式で表される。   The member “Depth” of the polygon structure is a 12-bit floating point number, and consists of a lower 8-bit mantissa field and an upper 4-bit exponent field. The value indicated by the member “Depth” in the 12-bit floating point number format is represented by the following expression.

Figure 2007128180
Figure 2007128180

(数14)において、「M」は仮数フィールドを示し、「E」は指数フィールドを示す。また、「DEB」は、指数フィールドEに対するバイアス(ゲタ)を示し、GE17内のレジスタ「DepthBias」に0〜7のいずれかを示す3ビットの値として設定される。   In (Expression 14), “M” indicates a mantissa field, and “E” indicates an exponent field. “DEB” indicates a bias (getter) with respect to the exponent field E, and is set as a 3-bit value indicating one of 0 to 7 in the register “DepthBias” in the GE 17.

メンバ「Depth」は、符号無しの値であるため、符号ビットは設けられていない。仮数は1.********の形に正規化されるが、仮数フィールドにはMSBの「1」は含まれておらず、実際の仮数は仮数フィールドの8ビットに1.0を加算した値となる(いわゆる「暗黙の1」が設定されている。)。また、指数フィールドはバイアスが加算された、いわゆる「ゲタばき表現」となる。   Since the member “Depth” is an unsigned value, no sign bit is provided. The mantissa is 1. Normalized in the form of ******, but the mantissa field does not include the MSB "1", and the actual mantissa is a value obtained by adding 1.0 to the 8 bits of the mantissa field. (So-called “implicit 1” is set). The exponent field is a so-called “gettery expression” with a bias added.

GE17は、コマンド「CWD」に応じて、ビュー座標系の頂点座標配列を参照し、ポリゴンの3頂点に対応するメンバ「Clipping」(Vector16構造体)が全て「0」(つまり、カリングなし)の場合にデプス値算出を実行する。GE17は、ポリゴンの3頂点のZ座標を全て加算した結果を上述の12ビットの浮動小数点数形式に変換し、変換結果の値とポリゴン構造体インスタンスのメンバ「Depth」に格納されているデプス初期値とを加算し、加算結果をメンバ「Depth」に書き戻す。ここで、デプス初期値は、12ビットの符号付きの値(2の補数)であることに注意されたい。また、仮数フィールドの8ビットを得る際の丸めモードは切り捨てである。   In response to the command “CWD”, the GE 17 refers to the vertex coordinate array of the view coordinate system, and the members “Clipping” (Vector16 structure) corresponding to the three vertexes of the polygon are all “0” (that is, no culling). In this case, depth value calculation is executed. The GE 17 converts the result of adding all the Z coordinates of the three vertices of the polygon into the above-mentioned 12-bit floating point number format, and converts the conversion result value and the depth initial value stored in the member “Depth” of the polygon structure instance. The value is added, and the addition result is written back to the member “Depth”. Note that the depth initial value is a 12-bit signed value (2's complement). Also, the rounding mode for obtaining 8 bits of the mantissa field is truncation.

以上のように、ポリゴンには頂点毎のデプス値は与えられず、ポリゴン毎のデプス値のみが与えられる。   As described above, the depth value for each vertex is not given to the polygon, but only the depth value for each polygon is given.

次に、GE17の内部構成の詳細を説明していく。   Next, details of the internal configuration of the GE 17 will be described.

図10は、図1のGE17の内部構成を示すブロック図である。図10を参照して、GE17は、実行ユニット100、制御ユニット200、I/Oレジスタセット300、及びロード/ストアユニット400を含む。   FIG. 10 is a block diagram showing an internal configuration of the GE 17 in FIG. Referring to FIG. 10, the GE 17 includes an execution unit 100, a control unit 200, an I / O register set 300, and a load / store unit 400.

I/Oレジスタセット300は、GE17で実行されるコマンドを書き込むレジスタ、GE17の各種制御を行うレジスタ、及びコマンドで使用される入力引数を格納するレジスタを含む。CPU5は、I/Oバス27を通じて、これら全てのレジスタにアクセスすることができる。各レジスタの詳細については後述する。I/Oレジスタセット300は、コマンドの完了時、CPU5に対して割り込み要求信号IRQを出力する。但し、GE17からの割り込み要求信号IRQの出力がイネーブルに設定されている場合に限られる。   The I / O register set 300 includes a register for writing a command executed by the GE 17, a register for performing various controls of the GE 17, and a register for storing an input argument used for the command. The CPU 5 can access all these registers through the I / O bus 27. Details of each register will be described later. The I / O register set 300 outputs an interrupt request signal IRQ to the CPU 5 when the command is completed. However, this is limited to the case where the output of the interrupt request signal IRQ from the GE 17 is enabled.

制御ユニット200は、I/Oレジスタセット300に含まれるレジスタ「GECommand」(後述)に書き込まれたコマンド、及びI/Oレジスタセット300に含まれるレジスタ「RepeatCount」に書き込まれたコマンド繰り返し回数に従って、実行ユニット100およびロード/ストアユニット400を制御し、コマンドの実行を行う。   The control unit 200 follows the command written in the register “GECommand” (described later) included in the I / O register set 300 and the number of command repetitions written in the register “RepeatCount” included in the I / O register set 300. The execution unit 100 and the load / store unit 400 are controlled to execute a command.

各コマンドの各サイクルにおける制御信号の状態は、マイクロコードとして記憶されている。本実施の形態では、マイクロコードは、ハードワイヤードで構成されているため固定値を示すが、RAMやEEPROMでマイクロコード格納領域を構成する場合は、マイクロコードを可変にすることができる。マイクロコードを可変にすると、ダイエリア(半導体上の面積)は大きくなるが、GE17のコマンドを必要な処理に応じて最適化することができる。また、制御ユニット200は、コマンドが実行中か否かを示すコマンド実行中フラグ、およびコマンドの完了時にアサートされるコマンド完了フラグを、I/Oレジスタセット300に出力する。これらのフラグの状態は、I/Oレジスタセット300に含まれるレジスタ「GEStatus」に反映される。   The state of the control signal in each cycle of each command is stored as microcode. In the present embodiment, the microcode is hardwired and thus indicates a fixed value. However, when the microcode storage area is configured by RAM or EEPROM, the microcode can be made variable. If the microcode is made variable, the die area (area on the semiconductor) increases, but the GE 17 command can be optimized according to the required processing. Further, the control unit 200 outputs a command execution flag indicating whether or not the command is being executed and a command completion flag asserted when the command is completed to the I / O register set 300. The states of these flags are reflected in the register “GEStatus” included in the I / O register set 300.

実行ユニット100は、各種演算器を含み、制御ユニット200の制御に応じて各種演算を実行する。また、ロード/ストアユニット400を通じて、メインRAM25からのリードデータを受け取って演算の入力値として用い、演算の結果をライトデータとしてメインRAM25に書き出す。   The execution unit 100 includes various arithmetic units and executes various arithmetic operations according to the control of the control unit 200. Also, read data from the main RAM 25 is received through the load / store unit 400 and used as an input value for the operation, and the operation result is written to the main RAM 25 as write data.

ロード/ストアユニット400は、制御ユニット200から入力されるアドレスと制御信号とに従って、メインRAMアクセスアービタ23にメインRAM25のリード要求またはライト要求を発行する。リード要求が受け付けられると、メインRAM25から読み出されたリードデータを実行ユニット100に引き渡す。また、ライト要求が受け付けられると、実行ユニット100から受け取ったライトデータをメインRAMアクセスアービタ23に引き渡す。   The load / store unit 400 issues a read request or a write request for the main RAM 25 to the main RAM access arbiter 23 according to the address and the control signal input from the control unit 200. When the read request is accepted, the read data read from the main RAM 25 is transferred to the execution unit 100. When the write request is accepted, the write data received from the execution unit 100 is transferred to the main RAM access arbiter 23.

図11は、図10のI/Oレジスタセット300に含まれる各種レジスタの説明図である。図11に示すように、I/Oレジスタセット300は、レジスタ「GR0」〜「GR15」、レジスタ「Distance」、レジスタ「ZNear」、レジスタ「ZFar」、レジスタ「ViewportOffsetX」、レジスタ「ViewportOffsetY」、レジスタ「Ambient」、レジスタ「LightVX」、レジスタ「LightVY」、レジスタ「LightVZ」、レジスタ「DepthBias」、レジスタ「GECommand」、レジスタ「GEStatus」、レジスタ「RepeatCount」、レジスタ「PolygonCount」、レジスタ「GESourceAddress」、レジスタ「GEDestinationAddress」、及びレジスタ「GEBaseAddress」を含む。各レジスタは、図中対応するI/Oバスアドレスに配置される。   FIG. 11 is an explanatory diagram of various registers included in the I / O register set 300 of FIG. As illustrated in FIG. 11, the I / O register set 300 includes registers “GR0” to “GR15”, a register “Distance”, a register “ZNear”, a register “ZFar”, a register “ViewportOffsetX”, a register “ViewportOffsetY”, a register “Ambient”, register “LightVX”, register “LightVY”, register “LightVZ”, register “DepthBias”, register “GECommand”, register “GEStatus”, register “RepeatCount”, register “PolyCount”, register “GESourA register” “GEDestinationAddress” and register “GEBaseAddress” Including the. Each register is arranged at a corresponding I / O bus address in the figure.

レジスタ「GR0」〜「GR15」は、それぞれ、各コマンドの実行の際に、入力データ又は出力データを格納するレジスタである。レジスタ「GR0」〜「GR15」の各々は、32ビットである。コマンドによっては、ハーフワード(16ビット)単位で使用されることもある。   The registers “GR0” to “GR15” are registers for storing input data or output data when executing each command. Each of the registers “GR0” to “GR15” has 32 bits. Some commands may be used in units of half words (16 bits).

レジスタ「Distance」は、透視投影変換における視点から投影面までの距離を、16ビット符号無し整数で指定する。レジスタ「ZNear」は、透視投影変換の際に行われるビューボリュームクリッピングのニアクリップ値(図8のニアクリップ面NC)を、16ビット符号無し整数で指定する。レジスタ「ZFar」は、透視投影変換の際に行われるビューボリュームクリッピングのファークリップ値(図8のファークリップ面FC)を、16ビット符号無し整数で指定する。   The register “Distance” designates the distance from the viewpoint to the projection plane in the perspective projection transformation as a 16-bit unsigned integer. The register “ZNear” designates a near clip value (view clip plane NC in FIG. 8) of view volume clipping performed at the time of perspective projection conversion by a 16-bit unsigned integer. The register “ZFar” specifies a far clip value (far clip plane FC in FIG. 8) of view volume clipping performed at the time of perspective projection conversion by a 16-bit unsigned integer.

レジスタ「ViewportOffsetX」は、ビューポート変換の際にX座標に加算されるオフセット値((数2)の「offx」)を、12ビット符号無し固定小数点数で指定する。レジスタ「ViewportOffsetY」は、ビューポート変換の際にY座標に加算されるオフセット値((数2)の「offy」)を、12ビット符号無し固定小数点数で指定する。レジスタ「Ambient」は、ポリゴン明度算出あるいはポリゴン頂点色算出の際に必要とされる環境光明度の値を、符号無し固定小数点数で指定する((数9)参照)。   The register “ViewportOffsetX” designates an offset value (“offx” in (Expression 2)) to be added to the X coordinate at the time of viewport conversion as a 12-bit unsigned fixed-point number. The register “ViewportOffsetY” designates an offset value (“offy” in (Expression 2)) to be added to the Y coordinate at the time of viewport conversion by a 12-bit unsigned fixed-point number. The register “Ambient” designates the value of the ambient light brightness required for calculating the polygon brightness or the polygon vertex color as an unsigned fixed-point number (see (Expression 9)).

レジスタ「LightVX」は、ベクトル内積算出の際に入力される一方のベクトルのX成分を、符号付き固定小数点数で指定する。ビュー座標系の光源ベクトルのX成分が設定されることを想定している。レジスタ「LightVY」は、ベクトル内積算出の際に入力される一方のベクトルのY成分を、符号付き固定小数点数で指定する。ビュー座標系の光源ベクトルのY成分が設定されることを想定している。レジスタ「LightVZ」は、ベクトル内積算出の際に入力される一方のベクトルのZ成分を、符号付き固定小数点数で指定する。ビュー座標系の光源ベクトルのZ成分が設定されることを想定している。なお、図5のステップS32及び図6のステップS42を参照されたい。   The register “LightVX” designates the X component of one vector input at the time of vector inner product calculation by a signed fixed-point number. It is assumed that the X component of the light source vector in the view coordinate system is set. The register “LightVY” designates the Y component of one vector input at the time of vector inner product calculation by a signed fixed-point number. It is assumed that the Y component of the light source vector in the view coordinate system is set. The register “LightVZ” designates the Z component of one vector input at the time of vector inner product calculation by a signed fixed-point number. It is assumed that the Z component of the light source vector in the view coordinate system is set. Refer to step S32 in FIG. 5 and step S42 in FIG.

レジスタ「DepthBias」は、ポリゴンのデプス値Depthの指数部のバイアス(ゲタ)を設定する。バイアスの値を「DEB」、デプス値Depthの仮数部を「M」、指数部を「E」とすると、デプス値Depthは、(数14)のようになる。   The register “DepthBias” sets the bias (getter) of the exponent part of the depth value Depth of the polygon. When the bias value is “DEB”, the mantissa part of the depth value Depth is “M”, and the exponent part is “E”, the depth value Depth is as shown in (Expression 14).

レジスタ「GECommand」は、GE17の制御のためのコマンドを設定するレジスタである。このレジスタにコマンドコードをライトすることにより、各コマンドの実行が開始される。後で詳細に説明するが、GE17を制御するためのコマンドとして、コマンド「NOP(操作無し)」、コマンド「Affine(ベクトルアフィン変換)」、コマンド「Pproj(透視投影変換)」、コマンド「View(ビューポート変換)」、コマンド「Cull(頂点座標設定およびカリング)」、コマンド「Trans(ベクトル直交変換)」、コマンド「Dot(ベクトル内積)」、コマンド「Bright−P」(ポリゴン明度算出)」、コマンド「Ccale(ポリゴン頂点色算出)」、コマンド「APV(ベクトルアフィン変換/透視投影変換/ビューポート変換)」、コマンド「CWD(頂点座標設定およびカリング/パースペクティブコレクト/デプス算出)」、コマンド「TDBP(ベクトル直交変換/ベクトル内積/ポリゴン明度算出)」、コマンド「TD(ベクトル直交変換/ベクトル内積)」、コマンド「MatrixMulti(行列積)」、およびコマンド「Sqrt(平方根算出)」が用意され、それぞれに5ビットのコマンドコードが割り当てられる。   The register “GECommand” is a register for setting a command for controlling the GE 17. By writing a command code to this register, execution of each command is started. As will be described in detail later, as commands for controlling the GE 17, a command “NOP (no operation)”, a command “Affine (vector affine transformation)”, a command “Pproj (perspective projection transformation)”, a command “View ( Viewport conversion), command “Cull (vertex coordinate setting and culling)”, command “Trans (vector orthogonal transformation)”, command “Dot (vector dot product)”, command “Bright-P” (polygon brightness calculation), Command “Ccal (polygon vertex color calculation)”, command “APV (vector affine transformation / perspective projection transformation / viewport transformation)”, command “CWD (vertex coordinate setting and culling / perspective collect / depth calculation)”, command “TDBP (Vector Orthogonal Transform / Vector Product / polygon brightness calculation), command “TD (vector orthogonal transformation / vector inner product)”, command “MatrixMulti (matrix product)”, and command “Sqrt (square root calculation)”, each having a 5-bit command code Is assigned.

レジスタ「GECommand」は、5ビットのコマンドコードを格納するフィールド、1ビットの「InvalidStructureRemove(不要ポリゴン構造体インスタンス削除制御)」フィールド、及び1ビットの「InterruptEnable(割り込み制御)」フィールドを含む。   The register “GECommand” includes a field for storing a 5-bit command code, a 1-bit “Invalid Structure Remove (unnecessary polygon structure instance deletion control)” field, and a 1-bit “Interrupt Enable (interrupt control)” field.

フィールド「InvalidStructureRemove」は、「0」のとき、カリング/クリッピング判定されたポリゴン構造体インスタンスを配列から削除しないことを示し、「1」のとき、カリング/クリッピング判定されたポリゴン構造体インスタンスを配列から削除することを示す。フィールド「InterruptEnable」は、「0」のとき、コマンド実行完了後、割り込み要求を発生しないことを示し、「1」のとき、コマンド実行完了後、割り込み要求IRQ(図10参照)を発生することを示す。   When the field “InvalidStructureRemove” is “0”, it indicates that the polygon structure instance determined by culling / clipping is not deleted from the array. When the field is “1”, the polygon structure instance determined by culling / clipping is deleted from the array. Indicates to delete. When the field “Interrupt Enable” is “0”, it indicates that an interrupt request is not generated after the command execution is completed. When the field “Interrupt Enable” is “1”, an interrupt request IRQ (see FIG. 10) is generated after the command execution is completed. Show.

レジスタ「GEStatus」は、GE17のステータスおよび演算結果を示す8ビットのレジスタである。レジスタ「GEStatus」は、各々1ビットのキャリーフラグCY,オーバーフローフラグOV,サインフラグS,ゼロ除算フラグZeroDiv,割り込みフラグInterrupt及びコマンド実行中フラグOperatingを含む。   The register “GEStatus” is an 8-bit register indicating the status of GE17 and the operation result. The register “GEStatus” includes a 1-bit carry flag CY, an overflow flag OV, a sign flag S, a zero division flag ZeroDiv, an interrupt flag Interrupt, and a command executing flag Operating.

キャリーフラグCYが「0」の場合、コマンド実行中にキャリーが発生しなかったことを示し、「1」の場合、コマンド実行中に1度以上キャリーが発生したことを意味する。オーバーフローフラグOVが「0」の場合、コマンド実行中にオーバーフローが発生しなかったことを意味し、「1」は、コマンド実行中に1度以上オーバーフローが発生したことを意味する。   When the carry flag CY is “0”, it indicates that no carry has occurred during command execution. When the carry flag CY is “1”, it means that a carry has occurred once or more during command execution. When the overflow flag OV is “0”, it means that no overflow has occurred during command execution, and “1” means that an overflow has occurred once or more during command execution.

サインフラグSが「0」の場合、コマンド実行(最終)結果のサイン(符号)フラグ(MSB)が「0」であることを示し、「1」の場合、コマンド実行(最終)結果のサインフラグ(MSB)が「1」であることを示す。ゼロ除算フラグZeroDivが「0」の場合、ゼロ除算が発生しなかったことを意味し、「1」の場合、ゼロ除算が発生したことを意味する(コマンド実行は中止)。   When the sign flag S is “0”, it indicates that the sign (sign) flag (MSB) of the command execution (final) result is “0”, and when it is “1”, the sign flag of the command execution (final) result (MSB) is “1”. When the zero division flag ZeroDiv is “0”, it means that zero division has not occurred, and when it is “1”, it means that zero division has occurred (command execution is stopped).

割り込みフラグInterruptが「0」の場合、割り込み要求が無いことを意味し、「1」の場合、割り込み要求中であることを意味する。コマンド実行中フラグOperatingが「0」の場合、GE17がアイドル状態であることを意味し、「1」の場合、GE17が、コマンド実行状態であることを意味する。   When the interrupt flag Interrupt is “0”, it means that there is no interrupt request, and when it is “1”, it means that an interrupt is being requested. When the command executing flag Operating is “0”, it means that the GE 17 is in the idle state, and when it is “1”, it means that the GE 17 is in the command executing state.

レジスタ「RepeatCount」は、SIMD(Single Instruction/Multiple Data)型コマンドの実行を繰り返す回数を指定する。コマンドの実行が1回行われる毎にデクリメントされ、アンダーフローが発生すると実行が停止される。したがって、このレジスタに実際に設定する値は、「繰り返し回数−1」になる。また、SIMD型以外のコマンドについては、コマンドの実行開始前に、このレジスタに「0」を設定する。   The register “RepeatCount” specifies the number of times to repeat execution of a SIMD (Single Instruction / Multiple Data) type command. The command is decremented every time the command is executed, and the execution is stopped when an underflow occurs. Therefore, the value actually set in this register is “repetition count−1”. For commands other than SIMD type, “0” is set in this register before the execution of the command is started.

レジスタ「PolygonCount」は、コマンド処理が完了したポリゴン数のカウント値を示す。但し、カリング/クリッピングにより削除されたポリゴンはカウントされない。このレジスタはリードオンリーであり、値はコマンド開始時に「0」にクリアされる。レジスタ「GESourceAddress」は、コマンド実行の際、ソースオペランド(演算対象が格納される領域)のベースアドレスを設定する。アドレスは、メインRAM25領域の物理アドレスである。値は、演算対象のデータ型に応じてアラインされる必要がある。このレジスタの値は、SIMD型コマンド実行時、データ型に応じてインクリメントされる。   The register “PolygonCount” indicates the count value of the number of polygons for which command processing has been completed. However, polygons deleted by culling / clipping are not counted. This register is read-only, and the value is cleared to “0” at the start of the command. The register “GESourceAddress” sets a base address of a source operand (an area where an operation target is stored) when executing a command. The address is a physical address of the main RAM 25 area. Values need to be aligned according to the data type to be computed. The value of this register is incremented according to the data type when the SIMD type command is executed.

レジスタ「GEDestinationAddress」は、コマンドの実行後、デスティネーションオペランド(演算結果が格納される領域)のベースアドレスを設定する。アドレスは、メインRAM25領域の物理アドレスである。値は、演算結果のデータ型に応じてアラインされる必要がある。このレジスタの値は、SIMD型コマンド実行時、データ型に応じてインクリメントされる。   The register “GEDestinationAddress” sets the base address of the destination operand (area where the operation result is stored) after the command is executed. The address is a physical address of the main RAM 25 area. The value needs to be aligned according to the data type of the operation result. The value of this register is incremented according to the data type when the SIMD type command is executed.

レジスタ「GEBaseAddress」は、GE17によって処理されるポリゴン構造体インスタンスのベースアドレスを設定する。アドレスは、メインRAM25領域の物理アドレスである。ポリゴン構造体インスタンスは16バイトアラインで配置される必要があるため、アドレスの下位4ビットは常に「0000」とみなされ、これ以外の値が書き込まれても無視される。このレジスタの値は、SIMD型コマンド実行時、16バイト単位でインクリメントされる。   The register “GEBaseAddress” sets the base address of the polygon structure instance processed by the GE 17. The address is a physical address of the main RAM 25 area. Since the polygon structure instance needs to be arranged in 16-byte alignment, the lower 4 bits of the address are always regarded as “0000”, and any other value is ignored. The value of this register is incremented in units of 16 bytes when a SIMD type command is executed.

次に、GE17で処理されるデータのフォーマットを説明する。   Next, the format of data processed by the GE 17 will be described.

[1]Matrix32配列   [1] Matrix32 array

Matrix32配列は、行列積を求めるコマンド「MatrixMulti」における入力データおよび出力データの形式である。   The Matrix32 array is a format of input data and output data in a command “MatrixMulti” for obtaining a matrix product.

図12(a)は、Matrix32配列の構成を示す図、図12(b)は、図12(a)のMatrix32配列の要素の構成を示す図である。図12(a)に示すように、Matrix32配列は、12個の要素D[0]〜D[11]から成り、各要素D[0]〜D[11]は4行3列の行列の各要素を示す((数15)参照)。コマンド「MatrixMulti」は、4次正方行列同士の行列積を求めるコマンドであるが、第4行の要素は常に(0,0,0,1)に定められているので((数15)参照)、第4行の要素は入力データおよび出力データのどちらにも含まれない。Matrix32配列の各要素D[0]〜D[11]は、第1行第1列の要素D[0]から順にメモリMEMに格納される。   FIG. 12A is a diagram showing a configuration of the Matrix32 array, and FIG. 12B is a diagram showing a configuration of elements of the Matrix32 array of FIG. As shown in FIG. 12A, the Matrix32 array is composed of 12 elements D [0] to D [11], and each element D [0] to D [11] is a matrix of 4 rows and 3 columns. Indicates an element (see (Equation 15)). The command “MatrixMulti” is a command for obtaining a matrix product of quaternary square matrices, but the elements in the fourth row are always set to (0, 0, 0, 1) (see (Equation 15)). The elements in the fourth row are not included in either input data or output data. Each element D [0] to D [11] of the Matrix32 array is stored in the memory MEM in order from the element D [0] in the first row and first column.

図12(b)に示すように、Matrix32配列の各要素は、符号付き32ビット固定小数点数で表される。コマンド「MatrixMulti」の出力データにおいては、全ての要素は32ビット固定小数点数であるが、後述のコマンド「Affine」及び「Trans」で用いられる変換行列においては、第1行〜第3行の第1列〜第3列の行列要素は16ビット固定小数点数である。32ビット固定小数点数から16ビット固定小数点数への変換は、CPU5によって行われる。   As shown in FIG. 12B, each element of the Matrix32 array is represented by a signed 32-bit fixed point number. In the output data of the command “MatrixMulti”, all the elements are 32-bit fixed-point numbers. However, in the conversion matrix used in the commands “Affine” and “Trans” described later, the first to third rows The matrix elements in the first column to the third column are 16-bit fixed point numbers. The conversion from the 32-bit fixed-point number to the 16-bit fixed-point number is performed by the CPU 5.

[2]Vector10構造体   [2] Vector10 structure

Vector10構造体は、コマンド「Affine」及び「Trans」で用いられる入力データの形式である。ローカル座標系における頂点座標配列および単位法線ベクトル配列の各要素が、Vector10構造体の形式で表される。   The Vector 10 structure is a format of input data used in commands “Affine” and “Trans”. Each element of the vertex coordinate array and the unit normal vector array in the local coordinate system is expressed in the form of a Vector10 structure.

図13(a)は、Vector10構造体の構成を示す図、図13(b)は、Vector10構造体のメンバの説明図、図13(c)は、Vector10構造体のメンバ「X」〜「Z」の構成を示す図である。図13(a)に示すように、Vector10構造体は、メンバ「X」、「Y」、「Z」及び「Scale」からなる。図13(c)に示すように、ベクトルの成分を示すメンバ「X」、「Y」及び「Z」の各々は、10ビット符号付き固定小数点数で表される。ローカル座標系の頂点座標配列及び法線ベクトル配列の各成分は、基本的に約−1.0〜約+1.0の範囲に正規化されている。但し、図13(b)に示すように、メンバ「Scale」の値によって、最大約−8.0〜約+8.0の範囲まで拡大した値とすることが可能である。   FIG. 13A is a diagram showing the configuration of the Vector10 structure, FIG. 13B is an explanatory diagram of members of the Vector10 structure, and FIG. 13C is the members “X” to “Z” of the Vector10 structure. FIG. As illustrated in FIG. 13A, the Vector10 structure includes members “X”, “Y”, “Z”, and “Scale”. As shown in FIG. 13C, each of the members “X”, “Y”, and “Z” indicating the vector components is represented by a 10-bit signed fixed-point number. Each component of the vertex coordinate array and the normal vector array of the local coordinate system is basically normalized to a range of about −1.0 to about +1.0. However, as shown in FIG. 13B, it is possible to make the value expanded up to a range of about −8.0 to about +8.0 depending on the value of the member “Scale”.

[3]Vector16構造体   [3] Vector16 structure

Vector16構造体は、コマンド「Pproj」の出力データの形式であり、コマンド「View」の入力データ及び出力データの形式である。透視座標系またはスクリーン座標系における頂点座標配列の各要素が、Vector16構造体の形式で表される。但し、カリングやポリゴンパラメータ算出のために、ビュー座標系のベクトルZ成分の値がVector16構造体に含まれている。   The Vector16 structure is a format of output data of the command “Pproj”, and is a format of input data and output data of the command “View”. Each element of the vertex coordinate array in the perspective coordinate system or the screen coordinate system is expressed in the form of a Vector16 structure. However, the vector 16 component value of the view coordinate system is included in the Vector 16 structure for culling and polygon parameter calculation.

図14(a)は、Vector16構造体の構成を示す図、図14(b)は、Vector16構造体のメンバの説明図、図14(c)は、Vector16構造体のメンバ「Z」の構成を示す図、図14(d)は、Vector16構造体のメンバ「X」及び「Y」の構成を示す図である。図14(a)に示すように、Vector16構造体は、メンバ「Clipping」、「X」、「Y」および「Z」からなる。図14(c)に示すように、ベクトルのZ成分を示すメンバ「Z」は、31ビット符号無し固定小数点数で表される。また、図14(d)に示すように、ベクトルのXY成分を示すメンバ「X」及び「Y」は、16ビット符号付き固定小数点数で表される。   14A is a diagram showing the configuration of the Vector16 structure, FIG. 14B is an explanatory diagram of members of the Vector16 structure, and FIG. 14C is the configuration of the member “Z” of the Vector16 structure. FIG. 14D shows the configuration of members “X” and “Y” of the Vector16 structure. As shown in FIG. 14A, the Vector16 structure includes members “Clipping”, “X”, “Y”, and “Z”. As shown in FIG. 14C, the member “Z” indicating the Z component of the vector is represented by a 31-bit unsigned fixed-point number. Further, as shown in FIG. 14D, members “X” and “Y” indicating the XY component of the vector are represented by 16-bit signed fixed-point numbers.

図14(b)に示すように、メンバ「Clipping」の値は、コマンド「Pproj」および「View」(または複合コマンド「APV」)によって行われるビューボリュームクリッピングにおいて、ベクトルの示す頂点座標がビューボリュームの外にあると判別された場合に「1」にセットされる。   As shown in FIG. 14B, the value of the member “Clipping” is set such that the vertex coordinates indicated by the vector in the view volume clipping performed by the commands “Pproj” and “View” (or the compound command “APV”) are the view volume. Is set to “1” when it is determined that it is outside the range.

[4]Vector32構造体   [4] Vector32 structure

Vector32構造体は、コマンド「Affine」及び「Trans」の出力データの形式であり、コマンド「Pproj」の入力データの形式である。ビュー座標系における頂点座標配列および法線ベクトル配列の各要素が、Vector32構造体の形式で表される。   The Vector32 structure has a format of output data of the commands “Affine” and “Trans”, and a format of input data of the command “Pproj”. Each element of the vertex coordinate array and the normal vector array in the view coordinate system is expressed in the form of a Vector32 structure.

図15(a)は、Vector32構造体の構成を示す図、図15(b)は、Vector32構造体のメンバの説明図である。図15(a)を参照して、Vector32構造体は、メンバ「X」、「Y」および「Z」からなる。図15(b)に示すように、メンバ「X」、「Y」および「Z」は、それぞれ、ベクトルのX成分、Y成分、及びZ成分を示す。メンバ「X」、「Y」及び「Z」の各々は、図12(b)と同じ32ビット符号付き固定小数点数で表される。   FIG. 15A is a diagram illustrating a configuration of the Vector32 structure, and FIG. 15B is an explanatory diagram of members of the Vector32 structure. Referring to FIG. 15A, the Vector 32 structure includes members “X”, “Y”, and “Z”. As shown in FIG. 15B, members “X”, “Y”, and “Z” indicate the X component, Y component, and Z component of the vector, respectively. Each of the members “X”, “Y”, and “Z” is represented by the same 32-bit signed fixed-point number as in FIG.

[5]Dot構造体   [5] Dot structure

Dot構造体は、コマンド「Dot」および「TD」の出力データの形式であり、コマンド「Ccalc」の入力データの形式である。単位法線ベクトルと光源ベクトルとの内積、単位法線ベクトルと視線ベクトルとの内積の演算結果が、Dot構造体に格納される。   The Dot structure is a format of output data of the commands “Dot” and “TD”, and is a format of input data of the command “Ccalc”. An inner product of the unit normal vector and the light source vector and an inner product of the unit normal vector and the line-of-sight vector are stored in the Dot structure.

図16(a)は、Dot構造体の構成を示す図、図16(b)は、Dot構造体のメンバの説明図である。図16(a)を参照して、Dot構造体は、メンバ「Dvalue」、「S2B」および「S1」からなる。図16(b)を参照して、メンバ「Dvalue」は、法線ベクトルと光源ベクトルとの内積演算結果の絶対値(0〜1.0)を6ビット符号なし固定小数点数で表し、この値から1LSBを減算し、5ビット符号なし固定小数点数で表したものである。但し、減算の結果が負である場合には、「0」に飽和される。   FIG. 16A is a diagram illustrating a configuration of a Dot structure, and FIG. 16B is an explanatory diagram of members of the Dot structure. Referring to FIG. 16A, the Dot structure includes members “Dvalue”, “S2B”, and “S1”. Referring to FIG. 16B, the member “Dvalue” represents the absolute value (0 to 1.0) of the inner product operation result of the normal vector and the light source vector as a 6-bit unsigned fixed-point number. 1LSB is subtracted from this and expressed as a 5-bit unsigned fixed-point number. However, when the result of the subtraction is negative, it is saturated to “0”.

メンバ「S2B」は、法線ベクトルと視線ベクトルとの内積の符号の反転値である。メンバ「S1」は、法線ベクトルと光源ベクトルとの内積の符号である。   The member “S2B” is an inverted value of the sign of the inner product of the normal vector and the line-of-sight vector. The member “S1” is a sign of the inner product of the normal vector and the light source vector.

次に、GE17で扱われるポリゴンデータについて説明する。ポリゴンを画面に表示するためには、1ポリゴンにつき1つのポリゴン構造体インスタンスが必要とされる。また、テクスチャマッピングモードのポリゴンを表示するためには、テクスチャアトリビュート構造体インスタンスが必要とされる。   Next, polygon data handled by the GE 17 will be described. In order to display a polygon on the screen, one polygon structure instance is required for each polygon. Further, in order to display a texture mapping mode polygon, a texture attribute structure instance is required.

ポリゴン構造体の形式は、テクスチャマッピングモードとグーローシェーディングモードとでは、大きく異なっている。また、それぞれのモードにおいて、GE17に対する入力データとRPU9に対する入力データとでは形式が異なる。但し、いずれの構成においてもポリゴン構造体の大きさは、128ビット(16バイト)に固定される。   The format of the polygon structure is greatly different between the texture mapping mode and the Gouraud shading mode. In each mode, the format differs between the input data for GE 17 and the input data for RPU 9. However, in any configuration, the size of the polygon structure is fixed to 128 bits (16 bytes).

GE17への入力形式のポリゴン構造体においては、メンバ「Depth」の値は、デプス値に加算される符号付きのオフセット値(つまり、デプス初期値)である。テクスチャマッピングモードのポリゴンを浮かび上がらせる等、ポリゴンの描画優先順位を制御したい場合に、オフセット値として「0」以外の値を設定する。   In the polygon structure in the input format to the GE 17, the value of the member “Depth” is a signed offset value (that is, a depth initial value) added to the depth value. When it is desired to control the drawing priority of polygons, such as when a texture mapping mode polygon is raised, a value other than “0” is set as an offset value.

RPU9への入力形式のポリゴン構造体においては、メンバ「Depth」は、(仮数部8ビット+指数部4ビット)の浮動小数点数で表されるポリゴンのデプス(描画優先順位)を示す。   In the polygon structure of the input format to the RPU 9, the member “Depth” indicates the depth (rendering priority) of the polygon expressed by a floating point number (mantissa part 8 bits + exponent part 4 bits).

図17は、テクスチャマッピングモードのポリゴン構造体(GE入力形式)の構成を示す図である。図18は、テクスチャマッピングモードのポリゴン構造体(GE入力形式)のメンバの説明図である。   FIG. 17 is a diagram illustrating a configuration of a polygon structure (GE input format) in the texture mapping mode. FIG. 18 is an explanatory diagram of members of a polygon structure (GE input format) in texture mapping mode.

図17を参照して、テクスチャマッピングモードでは、GE17への入力形式のポリゴン構造体は、メンバ「Type」、「Face」、「Via」、「Vib」、「Vic」、「Bw」、「Light」、「Tsegment」、「Tattribute」、「Map」、「Cw」、「Depth」、「Viewport」及び「Filter」からなる。そして、これらメンバの内容は、図18に示した通りである。   Referring to FIG. 17, in the texture mapping mode, the polygon structure in the input format to GE 17 includes members “Type”, “Face”, “Via”, “Vib”, “Vic”, “Bw”, “Light”. ”,“ Tsegment ”,“ Tattribute ”,“ Map ”,“ Cw ”,“ Depth ”,“ Viewport ”, and“ Filter ”. The contents of these members are as shown in FIG.

図19は、グーローシェーディングモードのポリゴン構造体(GE入力形式)の構成を示す図である。図20は、グーローシェーディングモードのポリゴン構造体(GE入力形式)のメンバの説明図である。   FIG. 19 is a diagram showing a configuration of a polygon structure (GE input format) in the Gouraud shading mode. FIG. 20 is an explanatory diagram of members of a polygon structure (GE input format) in the Gouraud shading mode.

図19を参照して、グーローシェーディングモードでは、GE17への入力形式のポリゴン構造体は、メンバ「Type」、「Face」、「Via」、「Vib」、「Vic」、「Ac」、「Bc」、「Cc」、「Depth」、「Viewport」及び「Nalpha」からなる。そして、これらメンバの内容は、図20に示した通りである。   Referring to FIG. 19, in the Gouraud shading mode, the polygon structure of the input format to GE 17 has members “Type”, “Face”, “Via”, “Vib”, “Vic”, “Ac”, “Ac”. It consists of “Bc”, “Cc”, “Depth”, “Viewport” and “Nalpha”. The contents of these members are as shown in FIG.

次に、GE17の制御のための各コマンドについて詳細に説明する。   Next, each command for controlling the GE 17 will be described in detail.

[1]コマンド「MatrixMulti」   [1] Command “MatrixMulti”

コマンド「MatrixMulti」は、4次正方行列同士の行列積を求めるコマンドである。但し、行列は3次元直交座標系ベクトルのアフィン変換を想定したものであり、第4行の行列要素は常に(0,0,0,1)であるとみなされ、第4行の行列要素は入力行列及び出力行列には含まれない。   The command “MatrixMulti” is a command for obtaining a matrix product of quaternary square matrices. However, the matrix assumes an affine transformation of a three-dimensional orthogonal coordinate system vector, the matrix elements in the fourth row are always considered to be (0, 0, 0, 1), and the matrix elements in the fourth row are It is not included in the input matrix and output matrix.

このコマンドは、主に複数の座標系変換行列の合成に用いられる。例えば、ローカル座標系からワールド座標系への変換行列と、ワールド座標系からビュー座標系への変換行列と、の行列積を求めることにより、ローカル座標系からビュー座標への変換行列を生成することが可能である。   This command is mainly used to synthesize a plurality of coordinate system transformation matrices. For example, by generating a matrix product of a transformation matrix from the local coordinate system to the world coordinate system and a transformation matrix from the world coordinate system to the view coordinate system, a transformation matrix from the local coordinate system to the view coordinates is generated. Is possible.

このコマンドを1回実行することで、1回の行列積演算が行われる。1回のコマンド実行で複数の行列積演算を行うことはできない。このコマンドで実行される行列演算の式は、次の通りである。   By executing this command once, a matrix product operation is performed once. Multiple matrix product operations cannot be performed with a single command execution. The formula of matrix operation executed by this command is as follows.

Figure 2007128180
Figure 2007128180

(数15)において、配列Dは、演算結果の行列要素を格納するMatrix32配列、一方の入力行列の行列要素GR0〜GR11は、それぞれ、レジスタGR0〜GR11の値、配列Sは、他方の入力行列の行列要素を格納するMatrix32配列である。(数15)を展開すると次のようになる。   In (Expression 15), the array D is a Matrix32 array for storing the matrix elements of the operation results, the matrix elements GR0 to GR11 of one input matrix are the values of the registers GR0 to GR11, respectively, and the array S is the other input matrix This is a Matrix32 array that stores the matrix elements. (Formula 15) is expanded as follows.

Figure 2007128180
Figure 2007128180

(数15)及び(数16)において、配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。配列Sの各要素S[0]〜S[11]は、32ビット符号付き固定小数点フォーマットである。各要素S[0]〜S[11]は、ワード(4バイト)アラインで配置されている必要がある。ここでは、CPU5の演算データのビット数に合わせ、4バイト(32ビット)のデータをワード、2バイト(8ビット)のデータをハーフワードと呼称する。   In (Expression 15) and (Expression 16), the array S is arranged on the main RAM 25 with the value indicated by the register “GESourceAddress” as a base address. Each element S [0] to S [11] of the array S is a 32-bit signed fixed point format. Each element S [0] to S [11] needs to be arranged in a word (4 byte) alignment. Here, 4-byte (32-bit) data is referred to as a word, and 2-byte (8-bit) data is referred to as a halfword in accordance with the number of bits of operation data of the CPU 5.

データ(行列要素)GR0〜GR11の値は、それぞれ32ビット符号付き固定小数点フォーマットである。   The values of the data (matrix elements) GR0 to GR11 are each in a 32-bit signed fixed point format.

配列Dは、レジスタ「GEDestinationAdderss」が示す値をベースアドレスとして、メインRAM25に格納される。配列Dの各要素D[0]〜D[11]は、32ビット符号付き固定小数点フォーマットである。   The array D is stored in the main RAM 25 with the value indicated by the register “GEDestinationAddress” as a base address. Each element D [0] to D [11] of the array D is a 32-bit signed fixed point format.

このコマンドを実行する場合には、レジスタ「ReapeatCount」を「0」に設定する。レジスタ「GESourceAddress」に、配列Sのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列Sの各要素はワードアラインで配置されている必要があるので、下位2ビットには「00」を設定する。レジスタ「GEDestinationAdderss」には、配列Dのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列Dの各要素はワードアラインで格納されるので、下位2ビットには「00」を設定する。   When this command is executed, the register “RepeatCount” is set to “0”. The base address of the array S is set as the physical address of the main RAM 25 in the register “GESourceAddress”. Since each element of the array S needs to be arranged in word alignment, “00” is set in the lower 2 bits. In the register “GEDestinationAddress”, the base address of the array D is set as the physical address of the main RAM 25. Since each element of the array D is stored in word alignment, “00” is set in the lower 2 bits.

なお、レジスタGR12〜GR15は、ワーク領域として使用される。   The registers GR12 to GR15 are used as work areas.

[2]コマンド「Affine」   [2] Command “Affine”

コマンド「Affine」は、3次元ベクトルを4次正方行列によってアフィン変換するコマンドである。この変換では、拡大・縮小、回転、及び平行移動を一度に行うことが可能である。このコマンドは、主にローカル座標系の頂点座標配列および法線ベクトル配列を他の直交座標系に変換するために用いられる。このコマンドはSIMD型コマンドであり、1つの変換行列に対し複数個のベクトルの変換を連続して行うことが可能である。このコマンドで実行される行列演算の式は、次の通りである。   The command “Affine” is a command for affine transformation of a three-dimensional vector using a quartic square matrix. In this conversion, enlargement / reduction, rotation, and translation can be performed at a time. This command is mainly used to convert the vertex coordinate array and normal vector array of the local coordinate system to another orthogonal coordinate system. This command is a SIMD type command, and a plurality of vectors can be continuously converted for one conversion matrix. The formula of matrix operation executed by this command is as follows.

Figure 2007128180
Figure 2007128180

配列Dは、アフィン変換後のベクトルを格納するVector32構造体配列である。行列要素GR0L〜GR2L,GR4L〜GR6L,GR8L〜GR10Lは、それぞれ、レジスタGR0〜GR2,GR4〜GR6,GR8〜GR10の下位16ビットの値である。行列要素GR3,GR7,GR11は、それぞれ、レジスタGR3,GR7,GR11の値である。配列Sは、アフィン変換前のベクトルを格納するVector10構造体配列である。なお、配列D及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図13及び図15参照)。また、n=0〜N(配列の要素数)−1である。(数17)を展開すると次のようになる。   The array D is a Vector32 structure array that stores vectors after affine transformation. The matrix elements GR0L to GR2L, GR4L to GR6L, GR8L to GR10L are values of lower 16 bits of the registers GR0 to GR2, GR4 to GR6, GR8 to GR10, respectively. The matrix elements GR3, GR7, GR11 are the values of the registers GR3, GR7, GR11, respectively. The array S is a Vector10 structure array that stores vectors before affine transformation. Note that the suffix after the period “.” In the arrays D and S indicates the member name of the structure (see FIGS. 13 and 15). Also, n = 0 to N (number of elements in the array) -1. (Expression 17) is expanded as follows.

Figure 2007128180
Figure 2007128180

(数17)及び(数18)において、配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。配列Sの各要素は、ワードアラインで配置されている必要がある。データ(行列要素)GR0L〜GR2L,GR4L〜GR6L,およびGR8L〜GR10Lは、レジスタGR0〜GR2,GR4〜GR6,およびGR8〜GR10の下位16ビットに設定された値である。それぞれの値は、16ビット符号付き固定小数点フォーマットである。但し、後述の型変換ユニット108a及び108bによって、(数17)及び(数18)が行われる前に、16ビット符号付き固定小数点フォーマットの値は、32ビット符号付き固定小数点フォーマットへと変換される。データ(行列要素)GR3,GR7,及びGR11は、レジスタGR3,GR7,及びGR11に設定された値である。それぞれの値は、32ビット符号付き固定小数点フォーマットである。配列Dは、レジスタ「GEDestinationAddress」の示す値をベースアドレスとして、メインRAM25に格納される。   In (Expression 17) and (Expression 18), the array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Each element of the array S needs to be arranged in word alignment. Data (matrix elements) GR0L to GR2L, GR4L to GR6L, and GR8L to GR10L are values set in the lower 16 bits of registers GR0 to GR2, GR4 to GR6, and GR8 to GR10. Each value is a 16-bit signed fixed point format. However, the values of the 16-bit signed fixed-point format are converted to the 32-bit signed fixed-point format before (Equation 17) and (Equation 18) are performed by the type conversion units 108a and 108b described later. . Data (matrix elements) GR3, GR7, and GR11 are values set in the registers GR3, GR7, and GR11. Each value is a 32-bit signed fixed point format. The array D is stored in the main RAM 25 with the value indicated by the register “GEDestinationAddress” as a base address.

このコマンドを実行する場合は、レジスタ「RepeatCount」に、配列Sの要素数−1(=N−1)を設定する。また、レジスタ「GESourceAddresss」に、配列Sのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列Sの各要素はワードアラインで配置されている必要があるので、下位2ビットには「00」を設定する。また、レジスタ「GEDestinationAddress」には、配列Dのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列Dの各要素はワードアラインで格納されるので、下位2ビットには「00」を設定する。   When this command is executed, the number of elements of the array S−1 (= N−1) is set in the register “RepeatCount”. Further, the base address of the array S is set as the physical address of the main RAM 25 in the register “GESourceAddress”. Since each element of the array S needs to be arranged in word alignment, “00” is set in the lower 2 bits. In the register “GEDestinationAddress”, the base address of the array D is set as the physical address of the main RAM 25. Since each element of the array D is stored in word alignment, “00” is set in the lower 2 bits.

なお、レジスタ「RepeatCount」、レジスタ「GESourceAddress」及びレジスタ「GEDestinationAddress」は、コマンドの実行に伴って、その値が変化するレジスタである。   Note that the register “RepeatCount”, the register “GESourceAddress”, and the register “GEDestinationAddress” are registers whose values change as the command is executed.

[3]コマンド「Pproj」   [3] Command “Pproj”

コマンド「Pproj」は、3次元ベクトルを2次元空間に透視投影するとともに、ビューボリュームクリッピングにおけるニアクリップ及びファークリップの処理を行うコマンドである。このコマンドは、ビュー座標系で与えられた3次元座標を透視座標系に投影するために用いられる。また、このコマンドは、入力ベクトルのZ成分の値が所定範囲外である場合に、出力するVector16構造体インスタンスのメンバ「Clipping」に「1」をセットする(図14参照)。このコマンドはSIMD型コマンドであり、複数個のベクトルの変換を連続して行うことが可能である。このコマンドにより、以下の演算が実行される。   The command “Pproj” is a command for perspectively projecting a three-dimensional vector into a two-dimensional space and performing processing of a near clip and a far clip in view volume clipping. This command is used to project the three-dimensional coordinates given in the view coordinate system onto the perspective coordinate system. In addition, this command sets “1” to the member “Clipping” of the Vector16 structure instance to be output when the value of the Z component of the input vector is outside the predetermined range (see FIG. 14). This command is a SIMD type command, and a plurality of vectors can be converted continuously. The following calculation is executed by this command.

Figure 2007128180
Figure 2007128180

(数19)において、配列Dは、変換後のベクトルを格納するVector16構造体配列であり、データdは、レジスタ「Distance」の値(視点から投影面までの距離)であり、データZは、レジスタ「ZNear」の値(ニアクリップ値)であり、データZは、レジスタ「ZFar」の値(ファークリップ値)であり、配列Sは、変換前のベクトルを格納するVector32構造体配列である。なお、配列D及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図14及び図15参照)。 In (Equation 19), the array D is a Vector16 structure array that stores the converted vector, the data d is the value of the register “Distance” (distance from the viewpoint to the projection plane), and the data Z N is , The value of the register “ZNear” (near clip value), the data Z F is the value of the register “ZFar” (far clip value), and the array S is a Vector32 structure array that stores vectors before conversion. is there. Note that the suffix after the period “.” In the arrays D and S indicates the member name of the structure (see FIGS. 14 and 15).

配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。各要素は、ワードアラインで配置されている必要がある。レジスタ「Distance」には、視点から投影面までの距離を設定する。設定値は、16ビット符号無し整数である。レジスタ「RepeatCount」には、配列Sの要素数−1(=N−1)を設定する。   The array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Each element needs to be arranged in word alignment. A distance from the viewpoint to the projection plane is set in the register “Distance”. The set value is a 16-bit unsigned integer. In the register “RepeatCount”, the number of elements of the array S−1 (= N−1) is set.

配列Dは、レジスタ「GEDestinationAddress」が示す値をベースアドレスとして、メインRAM25に格納される。入力ベクトルのZ成分の値がニアクリップ値Z以下、またはファークリップ値Z以上の場合、Vector16構造体インスタンスのメンバ「Clipping」に「1」がセットされる(図14参照)。 The array D is stored in the main RAM 25 with the value indicated by the register “GEDestinationAddress” as a base address. The value of Z components of the input vector is less than the near clip value Z N, or if more far clipping value Z F, "1" is set in the member "Clipping" of Vector16 structure instance (see Figure 14).

レジスタ「GESoueceAddress」には、配列Sのベースアドレスを、メインRAMの物理アドレスとして設定する。配列Sの各要素はワードアラインで配置されている必要があるので、下位2ビットには「00」を設定する。レジスタ「GEDestinationAddress」は、配列Dのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列Dの各要素はワードアラインで格納されるので、下位2ビットには「00」を設定する。   The base address of the array S is set as the physical address of the main RAM in the register “GESouiceAddress”. Since each element of the array S needs to be arranged in word alignment, “00” is set in the lower 2 bits. The register “GEDestinationAddress” sets the base address of the array D with the physical address of the main RAM 25. Since each element of the array D is stored in word alignment, “00” is set in the lower 2 bits.

なお、レジスタGR15はワーク領域として使用される。レジスタ「RepeatCount」、レジスタ「GESourceAddress」及びレジスタ「GEDestinationAddress」は、コマンドの実行に伴って、その値が変化するレジスタである。   The register GR15 is used as a work area. The register “RepeatCount”, the register “GESourceAddress”, and the register “GEDestinationAddress” are registers whose values change as the command is executed.

[4]コマンド「View」   [4] Command “View”

コマンド「View」は、2次元直交座標系のベクトルにオフセットを加える変換を行うとともに、ビューボリュームクリッピングにおけるスクリーン領域のクリッピング処理を行うコマンドである。このコマンドは、透視座標系のXY座標をスクリーン座標系のXY座標に変換するために用いられる。また、このコマンドは、変換結果のX成分が0〜2047の範囲を超えてしまった場合、あるいはY成分が0〜1023の範囲を超えてしまった場合に、出力されるVector16構造体インスタンスのメンバ「Clipping」に「1」をセットする(図14参照)。このコマンドはSIMD型コマンドであり、複数個のベクトルの変換を連続して行うことが可能である。このコマンドにより実行される演算は以下の通りである。   The command “View” is a command for performing a conversion process for adding an offset to a vector in the two-dimensional orthogonal coordinate system and performing a clipping process of the screen area in the view volume clipping. This command is used to convert the XY coordinate in the perspective coordinate system to the XY coordinate in the screen coordinate system. In addition, this command is a member of a Vector16 structure instance that is output when the X component of the conversion result exceeds the range of 0-2047, or when the Y component exceeds the range of 0-1023. “1” is set in “Clipping” (see FIG. 14). This command is a SIMD type command, and a plurality of vectors can be converted continuously. The operations executed by this command are as follows.

Figure 2007128180
Figure 2007128180

(数20)において、配列Dは、変換後のベクトルを格納するVector16構造体配列であり、配列Sは、変換前のベクトルを格納するVector16構造体配列であり、データoffxは、レジスタ「ViewportOffsetX」の値(X成分のオフセット)であり、データoffyは、レジスタ「ViewportOffsetY」の値(Y成分のオフセット)である。なお、配列D及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図14参照)。   In (Equation 20), the array D is a Vector16 structure array that stores the vector after conversion, the array S is a Vector16 structure array that stores the vector before conversion, and the data offx is stored in the register “ViewportOffsetX”. The data offy is the value of the register “ViewportOffsetY” (Y component offset). Note that the subscript after the period “.” In the arrays D and S indicates the member name of the structure (see FIG. 14).

配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。各要素は、ワードアラインで配置されている必要がある。   The array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Each element needs to be arranged in word alignment.

レジスタ「ViewportOffsetX」は、X成分に加算されるオフセット値を設定する。設定値は、12ビット符号無し固定小数点フォーマットである。レジスタ「ViewportOffsetY」は、Y成分に加算されるオフセット値を設定する。設定値は、12ビット符号無し固定小数点フォーマットである。   The register “ViewportOffsetX” sets an offset value to be added to the X component. The set value is a 12-bit unsigned fixed-point format. The register “ViewportOffsetY” sets an offset value to be added to the Y component. The set value is a 12-bit unsigned fixed-point format.

配列Dは、レジスタ「GEDestinationAddress」が示す値をベースアドレスとして、メインRAM25に格納される。演算の結果、X成分が0〜2047の範囲を超えている場合、またはY成分が0〜1023の範囲を超えている場合、Vector16構造体インスタンスのメンバ「Clipping」に「1」がセットされる。   The array D is stored in the main RAM 25 with the value indicated by the register “GEDestinationAddress” as a base address. As a result of the operation, when the X component exceeds the range of 0 to 2047 or the Y component exceeds the range of 0 to 1023, “1” is set to the member “Clipping” of the Vector16 structure instance. .

レジスタ「GESourceAddress」は、配列Sのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列Sの各要素はワードアラインで配置されている必要があるので、下位2ビットには「00」を設定する。レジスタ「GEDestinationAddress」は、配列Dのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列の各要素はワードアラインで格納されるので、下位2ビットには「00」が設定される。   The register “GESourceAddress” sets the base address of the array S as the physical address of the main RAM 25. Since each element of the array S needs to be arranged in word alignment, “00” is set in the lower 2 bits. The register “GEDestinationAddress” sets the base address of the array D as the physical address of the main RAM 25. Since each element of the array is stored in word alignment, “00” is set in the lower 2 bits.

なお、レジスタGR13〜GR15はワーク領域として使用される。レジスタ「RepeatCount」、レジスタ「GESourceAddress」及びレジスタ「GEDestinationAddress」は、コマンドの実行に伴って、その値が変化するレジスタである。   The registers GR13 to GR15 are used as work areas. The register “RepeatCount”, the register “GESourceAddress”, and the register “GEDestinationAddress” are registers whose values change as the command is executed.

[5]コマンド「Trans」   [5] Command “Trans”

コマンド「Trans」は、3次元ベクトルを3次正方行列で直交変換するコマンドである。この変換では、拡大・縮小および回転を行うことが可能である。このコマンドは、主に頂点法線ベクトル/ポリゴン法線ベクトルをローカル座標系から他の直交座標系に変換するために用いられる。また、ワールド座標系で定義されている光源ベクトルをビュー座標系に変換する際にも用いられる。このコマンドはSIMD型コマンドであり、1つの変換行列に対し複数個のベクトルの変換を連続して行うことが可能である。このコマンドにより実行される行列演算は次の通りである。   The command “Trans” is a command for orthogonally transforming a three-dimensional vector with a cubic square matrix. In this conversion, enlargement / reduction and rotation can be performed. This command is mainly used to convert the vertex normal vector / polygon normal vector from the local coordinate system to another orthogonal coordinate system. It is also used when converting a light source vector defined in the world coordinate system into a view coordinate system. This command is a SIMD type command, and a plurality of vectors can be continuously converted for one conversion matrix. The matrix operation executed by this command is as follows.

Figure 2007128180
Figure 2007128180

(数21)において、配列Dは、変換後のベクトルを格納するVector16構造体配列であり、行列要素GR0L〜GR8Lは、レジスタGR0〜GR8の下位16ビットである。配列Sは、変換前のベクトルを格納するVector10構造体配列である。入力ベクトルのVector10構造体に含まれるメンバ「Scale」は、このコマンドの演算では無視される(図13参照)。つまり、メンバ「Scale」の値に関わらず、倍率は常に1倍であるとみなされる。なお、配列D及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図13及び図14参照)。(数21)の行列演算を展開すると以下の式で表される。   In (Expression 21), the array D is a Vector16 structure array that stores the converted vector, and the matrix elements GR0L to GR8L are the lower 16 bits of the registers GR0 to GR8. The array S is a Vector10 structure array that stores vectors before conversion. The member “Scale” included in the Vector10 structure of the input vector is ignored in the operation of this command (see FIG. 13). That is, regardless of the value of the member “Scale”, the magnification is always considered to be 1. The subscripts after the period “.” In the arrays D and S indicate the member names of the structures (see FIGS. 13 and 14). When the matrix operation of (Expression 21) is expanded, it is expressed by the following expression.

Figure 2007128180
Figure 2007128180

(数21)及び(数22)において、配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。データ(行列要素)GR0L〜GR8Lは、レジスタGR0〜GR8の下位16ビットに設定された値である。設定値は、16ビット符号付き固定小数点数である。レジスタ「ReapeaCount」は、配列Sの要素数−1(=N−1)を設定する。配列Dは、レジスタ「GEDestinationAddress」が示す値をベースアドレスとして、メインRAM25に格納される。   In (Expression 21) and (Expression 22), the array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Data (matrix elements) GR0L to GR8L are values set in the lower 16 bits of the registers GR0 to GR8. The set value is a 16-bit signed fixed-point number. The register “RepeaCount” sets the number of elements of the array S−1 (= N−1). The array D is stored in the main RAM 25 with the value indicated by the register “GEDestinationAddress” as a base address.

レジスタ「GESourceAddress」は、配列Sのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列Sの各要素はワードアラインで配置されている必要があるので、下位2ビットには「00」を設定する。レジスタ「GEDestinationAddress」は、配列Dのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列Dの各要素はワードアラインで格納されるので、下位2ビットには「00」を設定する。   The register “GESourceAddress” sets the base address of the array S with the physical address of the main RAM 25. Since each element of the array S needs to be arranged in word alignment, “00” is set in the lower 2 bits. The register “GEDestinationAddress” sets the base address of the array D with the physical address of the main RAM 25. Since each element of the array D is stored in word alignment, “00” is set in the lower 2 bits.

なお、レジスタ「RepeatCount」、レジスタ「GESourceAddress」及びレジスタ「GEDestinationAddress」は、コマンドの実行に伴って、その値が変化するレジスタである。   Note that the register “RepeatCount”, the register “GESourceAddress”, and the register “GEDestinationAddress” are registers whose values change as the command is executed.

[6]コマンド「Dot」   [6] Command “Dot”

コマンド「Dot」は、3次元ベクトル同士の内積を求めるコマンドである。このコマンドは、頂点/ポリゴンの拡散光明度を求めるために、法線ベクトルNと光源ベクトルLとの内積を求めるために用いられる。また、このコマンドは、ポリゴン(面)の拡散光明度算出のために、ベクトルNと視線ベクトルV(0,0,−1)との内積も同時に算出する。このコマンドはSIMD型コマンドであり、1つのベクトルL(光源ベクトル)に対し、数個のベクトルN(頂点/ポリゴンの法線ベクトル)との内積演算を連続して行うことが可能である。このコマンドにより、以下の演算が行われる。   The command “Dot” is a command for obtaining an inner product of three-dimensional vectors. This command is used to obtain the inner product of the normal vector N and the light source vector L in order to obtain the diffused light brightness of the vertex / polygon. This command also calculates the inner product of the vector N and the line-of-sight vector V (0, 0, −1) at the same time in order to calculate the diffused light brightness of the polygon (surface). This command is a SIMD type command, and it is possible to continuously perform an inner product operation with several vectors N (vertex / polygon normal vectors) for one vector L (light source vector). The following calculation is performed by this command.

Figure 2007128180
Figure 2007128180

(数23)において、配列Dは、ベクトルの内積を格納するDot構造体配列であり、データVxは、レジスタ「LightVX」の値(ベクトルLのX成分)であり、データVyは、レジスタ「LightVY」の値(ベクトルLのY成分)であり、データVzは、レジスタ「LightVZ」の値(ベクトルLのZ成分)であり、配列Sは、ベクトルNを格納するVector16構造体配列である。なお、配列D及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図14及び図16参照)。   In (Expression 23), the array D is a Dot structure array that stores the inner product of the vectors, the data Vx is the value of the register “LightVX” (the X component of the vector L), and the data Vy is the register “LightVY” ”(The Y component of the vector L), the data Vz is the value of the register“ LightVZ ”(the Z component of the vector L), and the array S is a Vector16 structure array that stores the vector N. Note that the suffix after the period “.” In the arrays D and S indicates the member name of the structure (see FIGS. 14 and 16).

配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。各要素は、ハーフワードアラインで配置されている必要がある。レジスタ「LightVX」は、ベクトルLのX成分を設定する。設定値は、16ビット符号付き固定小数点数である。レジスタ「LightVY」は、ベクトルLのY成分を設定する。設定値は、16ビット符号付き固定小数点数である。レジスタ「LightVZ」は、ベクトルLのZ成分を設定する。設定値は、16ビット符号付き固定小数点数である。配列Dは、レジスタ「GEDestinationAddress」が示す値をベースアドレスとして、メインRAM25に格納される。   The array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Each element must be arranged in halfword alignment. The register “LightVX” sets the X component of the vector L. The set value is a 16-bit signed fixed-point number. The register “LightVY” sets the Y component of the vector L. The set value is a 16-bit signed fixed-point number. The register “LightVZ” sets the Z component of the vector L. The set value is a 16-bit signed fixed-point number. The array D is stored in the main RAM 25 with the value indicated by the register “GEDestinationAddress” as a base address.

レジスタ「RepeatCount」は、配列Sの要素数−1(=N−1)を設定する。レジスタ「GESourceAddress」は、配列Sのベースアドレスを、メインRAM25の物理アドレスとして設定する。配列Sの各要素はハーフワードアラインで配置されている必要があるので、下位1ビットには「0」を設定する。レジスタ「GEDestinationAddress」は、配列Dのベースアドレスを、メインRAM25の物理アドレスにて設定する。   The register “RepeatCount” sets the number of elements of the array S−1 (= N−1). The register “GESourceAddress” sets the base address of the array S as the physical address of the main RAM 25. Since each element of the array S needs to be arranged in halfword alignment, “0” is set in the lower 1 bit. The register “GEDestinationAddress” sets the base address of the array D with the physical address of the main RAM 25.

なお、レジスタ「RepeatCount」、レジスタ「GESourceAddress」及びレジスタ「GEDestinationAddress」は、コマンドの実行に伴って、その値が変化するレジスタである。   Note that the register “RepeatCount”, the register “GESourceAddress”, and the register “GEDestinationAddress” are registers whose values change as the command is executed.

[7]コマンド「Bright−P」   [7] Command “Bright-P”

コマンド「Bright−P」は、ポリゴン(面)の拡散光明度と環境光明度とを加算し、ポリゴン(面)明度を算出するコマンドである。ポリゴンが片面ポリゴンの場合、光源ベクトルLとポリゴン(面)の法線ベクトルNとの内積が0以上であれば、内積の絶対値をポリゴン(面)の拡散光明度とし、内積が0未満であれば拡散光明度を「0」とする。ポリゴンが両面ポリゴンの場合、光源ベクトルLと法線ベクトルNとの内積の符号と、視線ベクトルVと法線ベクトルNとの内積の符号と、が一致していれば、内積の絶対値をポリゴン(面)の拡散光明度とし、符号が一致していなければ、拡散光明度を「0」とする。拡散光明度と環境光明度の加算において加算結果が最大値を超えている場合には、結果を最大値に飽和させる。このコマンドはSIMD型コマンドであり、複数個のポリゴン(面)の処理を連続して行うことが可能である。このコマンドにより以下の演算が行われる。   The command “Bright-P” is a command for calculating the polygon (surface) brightness by adding the diffused light brightness of the polygon (surface) and the ambient light brightness. When the polygon is a single-sided polygon, if the inner product of the light source vector L and the normal vector N of the polygon (surface) is 0 or more, the absolute value of the inner product is the diffused light brightness of the polygon (surface), and the inner product is less than 0. If there is, the diffused light brightness is set to “0”. When the polygon is a double-sided polygon, if the sign of the inner product of the light source vector L and the normal vector N matches the sign of the inner product of the line-of-sight vector V and the normal vector N, the absolute value of the inner product is determined as a polygon. If the signs do not match, the diffuse light brightness is set to “0”. When the addition result exceeds the maximum value in the addition of the diffuse light brightness and the ambient light brightness, the result is saturated to the maximum value. This command is a SIMD type command, and can process a plurality of polygons (surfaces) continuously. The following calculation is performed by this command.

Figure 2007128180
Figure 2007128180

Figure 2007128180
Figure 2007128180

(数24)及び(数25)において、配列Pは、ポリゴン構造体配列であり(図17参照)、配列Sは、ポリゴン法線ベクトルと光源ベクトルとの内積、およびポリゴン法線ベクトルと視線ベクトルとの内積を格納するDot構造体配列である(図16参照)。データ「ambient」は、レジスタ「Ambient」の値(環境光明度)である。データ「diffuse」は、拡散光明度である。なお、配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している。   In (Equation 24) and (Equation 25), the array P is a polygon structure array (see FIG. 17), and the array S is an inner product of a polygon normal vector and a light source vector, and a polygon normal vector and a line-of-sight vector. This is a Dot structure array that stores the inner product of (see FIG. 16). The data “ambient” is the value (environment lightness) of the register “Ambient”. The data “diffuse” is diffused lightness. The subscript after the period “.” In the array S indicates the member name of the structure.

配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。各要素は、バイトアラインで配置されている必要がある。配列Pは、レジスタ「GEBaseaddress」が示す値をベースアドレスとして、メインRAM25上に配置される必要がある。配列の各要素は、16バイトアラインで配置されている必要がある。   The array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Each element must be arranged in byte alignment. The array P needs to be arranged on the main RAM 25 with the value indicated by the register “GEBaseaddress” as a base address. Each element of the array needs to be arranged in 16-byte alignment.

レジスタ「Ambient」は、環境光明度を設定する。設定値は、5ビット符号無し固定小数点フォーマットである。レジスタ「RepeatCount」は、配列Pの要素数−1(=N−1)を設定する。レジスタ「GESourceAddress」は、配列Sのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列の各要素はハーフワードアラインで配置されている必要があるので、下位1ビットには「0」が設定される。レジスタ「GEBaseaddress」は、配列Pのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列Pの各要素は、16バイトアラインで配置されている必要があるので、下位4ビットにはレジスタの実体はない。   The register “Ambient” sets the ambient lightness. The set value is a 5-bit unsigned fixed-point format. The register “RepeatCount” sets the number of elements of the array P−1 (= N−1). The register “GESourceAddress” sets the base address of the array S with the physical address of the main RAM 25. Since each element of the array needs to be arranged in halfword alignment, “0” is set in the lower 1 bit. The register “GEBaseaddress” sets the base address of the array P with the physical address of the main RAM 25. Since each element of the array P needs to be arranged in a 16-byte alignment, the lower 4 bits have no register entity.

N個のインスタンスを持つポリゴン構造体配列Pのメンバ「Light」(P[n].Light(n=0〜N−1))の値が、このコマンドを実行することにより書き換えられる。   The value of the member “Light” (P [n] .Light (n = 0 to N−1)) of the polygon structure array P having N instances is rewritten by executing this command.

[8]コマンド「Ccalc」   [8] Command “Ccalc”

コマンド「Ccalc」は、頂点の拡散光明度と環境光明度とを加算することにより頂点明度を算出し、算出された頂点明度と本来の頂点色とにより、ライティング後の頂点色を算出するコマンドである。このコマンドは、グーローシェーディングモードのポリゴンに対してのみ用いられ、ポリゴン構造体インスタンスのメンバ「Ac」、「Bc」および「Cc」にライティング後の頂点色が設定される(図19参照)。このコマンドにより次の演算が行われる。   The command “Ccalc” is a command for calculating the vertex lightness by adding the diffuse light brightness of the vertex and the ambient light brightness, and calculating the vertex color after lighting based on the calculated vertex lightness and the original vertex color. is there. This command is used only for polygons in the Gouraud shading mode, and the vertex colors after lighting are set in the members “Ac”, “Bc”, and “Cc” of the polygon structure instance (see FIG. 19). The following calculation is performed by this command.

Figure 2007128180
Figure 2007128180

Figure 2007128180
Figure 2007128180

(数26)及び(数27)において、配列Pは、ポリゴン構造体配列であり(図19参照)、配列Sは、頂点法線ベクトルと光源ベクトルとの内積、および、頂点法線ベクトルと視線ベクトルとの内積を格納するDot構造体配列である(図16参照)。データ「ambient」は、レジスタ「Ambient」の値(環境光明度)である。   In (Equation 26) and (Equation 27), the array P is a polygon structure array (see FIG. 19), and the array S is the inner product of the vertex normal vector and the light source vector, and the vertex normal vector and the line of sight. It is a Dot structure array that stores the inner product with the vector (see FIG. 16). The data “ambient” is the value (environment lightness) of the register “Ambient”.

配列S[m](m=0〜M−1)は、M組の、頂点法線ベクトルと光源ベクトルとの内積および頂点法線ベクトルと視線ベクトルとの内積を格納するDot構造体配列である。この配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。配列P[n](n=0〜N−1)は、N個のインスタンスを持つポリゴン構造体配列である。この配列Pは、レジスタ「GEBaseaddress」が示す値をベースアドレスとして、メインRAM25上に配置される。配列Pの各要素は、16バイトアラインで配置されている必要がある。   The array S [m] (m = 0 to M−1) is a Dot structure array that stores M sets of inner products of vertex normal vectors and light source vectors and inner products of vertex normal vectors and line-of-sight vectors. . This array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. The array P [n] (n = 0 to N−1) is a polygon structure array having N instances. This array P is arranged on the main RAM 25 using the value indicated by the register “GEBaseaddress” as a base address. Each element of the array P needs to be arranged in 16-byte alignment.

レジスタ「Ambient」は、環境光明度を設定する。設定値は、5ビット符号無し固定小数点フォーマットである。レジスタ「RepeatCount」は、配列Pの要素数−1(=N−1)を設定する。レジスタ「GESourceAddress」は、配列Sのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列の各要素はハーフワードアラインで配置されている必要があるので、下位1ビットには「0」を設定する。レジスタ「GEBaseaddress」は、配列Pのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列の各要素は、16バイトアラインで配置されている必要があるので、下位4ビットにはレジスタの実体がない。   The register “Ambient” sets the ambient lightness. The set value is a 5-bit unsigned fixed-point format. The register “RepeatCount” sets the number of elements of the array P−1 (= N−1). The register “GESourceAddress” sets the base address of the array S with the physical address of the main RAM 25. Since each element of the array needs to be arranged in half word alignment, “0” is set in the lower 1 bit. The register “GEBaseaddress” sets the base address of the array P with the physical address of the main RAM 25. Since each element of the array needs to be arranged in 16-byte alignment, the lower 4 bits have no register entity.

なお、配列P及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図16及び図19参照)。また、配列P[n].Ac,P[n].BcおよびP[n].Ccに付された添え字R,G及びBは、それぞれ、R値(色の赤成分)、G値(色の緑成分)及びB値(色の青成分)を示す。   Note that the suffix after the period “.” In the arrays P and S indicates the member name of the structure (see FIGS. 16 and 19). In addition, the array P [n]. Ac, P [n]. Bc and P [n]. Subscripts R, G, and B attached to Cc indicate an R value (color red component), a G value (color green component), and a B value (color blue component), respectively.

[9]コマンド「Cull」   [9] Command “Cull”

コマンド「Cull」は、ポリゴンの頂点座標の設定と、裏面カリングおよびビューボリュームクリッピングの処理を行うコマンドである。このコマンドは、先ず、スクリーン座標系の頂点座標を格納するVector16構造体配列を参照して、ポリゴン構造体インスタンスに格納する各頂点座標を求める。求められた頂点座標を用いてポリゴンの表裏判定を行い、ポリゴンが片面ポリゴンでかつ裏面表示の場合、ポリゴンの全頂点座標に最大値を設定して画面に表示されないようにするか、あるいは当該ポリゴン構造体インスタンスをポリゴン構造体配列から取り除く(裏面カリング)。   The command “Cull” is a command for setting the vertex coordinates of the polygon and processing for back surface culling and view volume clipping. This command first obtains each vertex coordinate stored in the polygon structure instance by referring to the Vector 16 structure array storing the vertex coordinates of the screen coordinate system. Determine the front and back of the polygon using the obtained vertex coordinates, and if the polygon is a single-sided polygon and is displayed on the back side, set the maximum value for all the vertex coordinates of the polygon so that it is not displayed on the screen, or the polygon Remove structure instance from polygon structure array (backside culling).

また、各頂点座標を示すVector16構造体インスタンスの内のいずれか1つでもメンバ「Clipping」の値が「1」である場合、上記の場合と同様にポリゴンの全頂点座標に最大値を設定して画面に表示されないようにするか、あるいは当該ポリゴン構造体インスタンスをポリゴン構造体配列から取り除く(ビューボリュームクリッピング)。このコマンドは次の演算を実行する。   If the value of the member “Clipping” is “1” in any one of the Vector16 structure instances indicating each vertex coordinate, the maximum value is set for all the vertex coordinates of the polygon as in the above case. The polygon structure instance is removed from the polygon structure array (view volume clipping). This command performs the following operations:

Figure 2007128180
Figure 2007128180

Figure 2007128180
Figure 2007128180

Figure 2007128180
Figure 2007128180

Figure 2007128180
Figure 2007128180

(数28)〜(数31)において、配列Pは、ポリゴン構造体配列、配列Sは、スクリーン座標系の頂点座標を格納するVector16構造体配列である。   In (Equation 28) to (Equation 31), the array P is a polygon structure array, and the array S is a Vector16 structure array that stores vertex coordinates of the screen coordinate system.

配列S[m](m=0〜M−1)は、M組のスクリーン座標系の頂点座標を格納するVector16構造体配列である。この配列Sは、レジスタ「GESourceAddress」が示す値をベースアドレスとして、メインRAM25上に配置される。配列Sの各要素は、ワードアラインで配置されている必要がある。配列P[n](n=0〜N−1)は、N個のインスタンスを持つポリゴン構造体配列である。この配列Pは、レジスタ「GEBaseaddress」が示す値をベースアドレスとして、メインRAM25上に配置される。配列Pの各要素は、16バイトアラインで配置されている必要がある。なお、配列P及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している(図14、図17、及び図19参照)。   The array S [m] (m = 0 to M−1) is a Vector16 structure array that stores the vertex coordinates of the M sets of screen coordinate systems. This array S is arranged on the main RAM 25 using the value indicated by the register “GESourceAddress” as a base address. Each element of the array S needs to be arranged in word alignment. The array P [n] (n = 0 to N−1) is a polygon structure array having N instances. This array P is arranged on the main RAM 25 using the value indicated by the register “GEBaseaddress” as a base address. Each element of the array P needs to be arranged in 16-byte alignment. Note that the suffix after the period “.” In the arrays P and S indicates the member name of the structure (see FIGS. 14, 17, and 19).

レジスタ「RepeatCount」は、配列Pの要素数−1(=N−1)を設定する。レジスタ「GESourceAddress」は、配列Sのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列Pの各要素はハーフワードアラインで配置されている必要があるので、下位1ビットには「0」を設定する。レジスタ「GEBaseaddress」は、配列Pのベースアドレスを、メインRAM25の物理アドレスにて設定する。配列Sの各要素は、16バイトアラインで配置されている必要があるので、下位4ビットにはレジスタの実体がない。   The register “RepeatCount” sets the number of elements of the array P−1 (= N−1). The register “GESourceAddress” sets the base address of the array S with the physical address of the main RAM 25. Since each element of the array P needs to be arranged in halfword alignment, “0” is set in the lower 1 bit. The register “GEBaseaddress” sets the base address of the array P with the physical address of the main RAM 25. Since each element of the array S needs to be arranged in 16-byte alignment, the lower 4 bits have no register entity.

各ポリゴン構造体インスタンスのメンバ「Via」、「Vib」、「Vic」及び「Face」が、このコマンドを実行することにより、メンバ「Ax」、「Ay」、「Bx」、「By」、「Cx」及び「Cy」へと書き換えられる。コマンド発行時のレジスタ「GECommand」の「InvalidStructureRemove」の値が「1」の場合、裏面カリング/ビューボリュームクリッピングで非表示と判定されたポリゴン構造体インスタンスを配列から削除し、以降のポリゴン構造体インスタンスを前詰めで再配置する。レジスタ「PolygonCount」は、裏面カリング/ビューボリュームクリッピングの結果、ポリゴン構造体配列から削除されたポリゴン構造体インスタンスを除いた総インスタンス数、すなわち有効なポリゴン数を示す。   The members “Via”, “Vib”, “Vic”, and “Face” of each polygon structure instance execute this command, so that the members “Ax”, “Ay”, “Bx”, “By”, “ Rewritten as “Cx” and “Cy”. When the value of “InvalidStructureRemove” of the register “GECommand” at the time of issuing the command is “1”, the polygon structure instance determined to be hidden by the back surface culling / view volume clipping is deleted from the array, and the subsequent polygon structure instance Rearranged to the front. The register “PolygonCount” indicates the total number of instances excluding the polygon structure instances deleted from the polygon structure array as a result of back surface culling / view volume clipping, that is, the number of effective polygons.

[10]コマンド「Sqrt」   [10] Command “Sqrt”

コマンド「Sqrt」は、平方根を算出するコマンドである。このコマンドは、単位ベクトルを求める際にベクトルの大きさ(スカラー量)を算出する等の用途に用いられる。このコマンドにより次の演算が行われる。   The command “Sqrt” is a command for calculating a square root. This command is used for purposes such as calculating the size of a vector (scalar amount) when obtaining a unit vector. The following calculation is performed by this command.

Figure 2007128180
Figure 2007128180

(数32)において、データGR0は、レジスタGR0の値である。レジスタGR0は、入力値を設定する。値は32ビット符号無し固定小数点数で表される。レジスタGR0[31:16]は整数フィールド、レジスタGR0[15:0]は小数フィールドとして扱われる。32ビット符号付き固定小数点数も、値が負でない限りそのまま入力データとして用いることできる。   In (Expression 32), the data GR0 is the value of the register GR0. The register GR0 sets an input value. The value is expressed as a 32-bit unsigned fixed-point number. The register GR0 [31:16] is treated as an integer field, and the register GR0 [15: 0] is treated as a decimal field. A 32-bit signed fixed-point number can also be used as input data as long as the value is not negative.

データ(算出された平方根の値)GR1Lは、レジスタGR1の下位16ビットに格納される。値は16ビット符号無し固定小数点数で表される。レジスタGR0[15:8]は整数フィールド、レジスタGR0[7:0]は小数フィールドを格納する。   The data (calculated square root value) GR1L is stored in the lower 16 bits of the register GR1. The value is expressed as a 16-bit unsigned fixed-point number. The register GR0 [15: 8] stores an integer field, and the register GR0 [7: 0] stores a decimal field.

[11]コマンド「APV」   [11] Command “APV”

コマンド「APV」は、コマンド「Affine」(アフィン変換)、コマンド「PPproj」(透視投影変換)およびコマンド「View」(ビューポート変換)を1コマンドで実行するコマンドである。但し、演算途中のデータ、すなわちコマンド「Affine」およびコマンド「PPproj」の出力データは、メインRAM25に出力されない。   The command “APV” is a command for executing the command “Affine” (affine transformation), the command “PPproj” (perspective projection transformation), and the command “View” (viewport transformation) with one command. However, data in the middle of calculation, that is, output data of the command “Affine” and the command “PPproj” is not output to the main RAM 25.

コマンド「APV」による演算は、コマンド「Affine」、コマンド「PPproj」およびコマンド「View」と同様なので説明を省略する。また、入力データについては、コマンド「Affine」の場合と同様であり、出力データについては、コマンド「View」の場合と同様であるので、説明を省略する。   The calculation by the command “APV” is the same as the command “Affine”, the command “PPproj”, and the command “View”, and thus description thereof is omitted. The input data is the same as in the case of the command “Affine”, and the output data is the same as in the case of the command “View”.

[12]コマンド「CWD」   [12] Command “CWD”

コマンド「CWD」は、コマンド「Cull」(頂点座標設定およびカリング)の処理に引き続き、パースペクティブコレクト用パラメータの算出、およびデプス算出の処理を行うコマンドである。このコマンドにより、コマンド「Cull」の処理に続いて、次の演算が行われる。   The command “CWD” is a command for performing perspective correction parameter calculation and depth calculation processing following the processing of the command “Cull” (vertex coordinate setting and culling). With this command, the following calculation is performed following the processing of the command “Cull”.

Figure 2007128180
Figure 2007128180

Figure 2007128180
Figure 2007128180

(数34)において、データMは、12ビット浮動小数点数「depth」の仮数フィールド(8ビット)であり、データEは、12ビット浮動小数点数「depth」の指数フィールド(4ビット)であり、データDEBは、レジスタ「DepthBias」の値(0〜7)である。仮数フィールドの丸めモードは、切り捨てである。ここで得られた12ビット値「depth」を配列P[n].Depthに格納されているデプス初期値と加算し、配列P[n].Depthに書き戻す。つまり、以下のようになる。   In (Expression 34), data M is a mantissa field (8 bits) of a 12-bit floating point number “depth”, and data E is an exponent field (4 bits) of a 12-bit floating point number “depth”. The data DEB is a value (0 to 7) of the register “DepthBias”. The rounding mode of the mantissa field is truncation. The 12-bit value “depth” obtained here is stored in the array P [n]. The depth initial value stored in the depth is added to the array P [n]. Write back to Depth. That is, it is as follows.

Figure 2007128180
Figure 2007128180

(数35)において、配列P[n].Depthは、デプス初期値、配列P[n].Depth´は、演算後のデプス値である。   (Expression 35), the array P [n]. Depth is an initial depth value, array P [n]. Depth ′ is a depth value after the calculation.

このコマンドにおける入力データは、コマンド「Cull」の入力データに加え、レジスタ「DepthBias」の値となる。レジスタ「DepthBias」の値は、デプス算出の浮動小数点形式変換における、指数フィールドのバイアス値(ゲタ)である。   The input data in this command is the value of the register “DepthBias” in addition to the input data of the command “Cull”. The value of the register “DepthBias” is a bias value (getter) of the exponent field in floating point format conversion for depth calculation.

このコマンドは、ポリゴン構造体配列のメンバ「P[n].Wb」及び「P[n].Wc」(n=0〜N−1)の値も書き換える。これらは、N個のポリゴン構造体インスタンスを持つポリゴン構造体配列Pのパースペクティブコレクト用パラメータである。テクスチャマッピングモードのポリゴン構造体インスタンスに対してのみ、これらの値が書き込まれる。   This command also rewrites the values of the members “P [n] .Wb” and “P [n] .Wc” (n = 0 to N−1) of the polygon structure array. These are parameters for the perspective collection of the polygon structure array P having N polygon structure instances. These values are written only for polygon structure instances in texture mapping mode.

なお、配列P及び配列Sのピリオド「.」の後の添え字は、構造体のメンバ名を示している。   Note that the suffix after the period “.” In the arrays P and S indicates the member name of the structure.

[13]コマンド「TDBP」   [13] Command “TDBP”

コマンド「TDBP」は、テクスチャマッピングモードのポリゴンに対するライティング処理を一括して行うためのコマンドである。コマンド「Trans」(ベクトル直交変換)、コマンド「Dot」(ベクトル内積)およびコマンド「Bright−P」(ポリゴン明度算出)を1コマンドで実行する。但し、演算途中のデータ、すなわちコマンド「Trans」および「Dot」の出力データは、メインRAM25に出力されない。   The command “TDBP” is a command for collectively performing lighting processing for polygons in the texture mapping mode. The command “Trans” (vector orthogonal transformation), the command “Dot” (vector dot product), and the command “Bright-P” (polygon brightness calculation) are executed with one command. However, data in the middle of calculation, that is, output data of the commands “Trans” and “Dot” is not output to the main RAM 25.

コマンド「TDBP」による演算は、コマンド「Trans」、コマンド「Dot」およびコマンド「Bright−P」と同様なので説明を省略する。また、入力データについては、コマンド「Trans」の場合と同様であり、出力データについては、コマンド「Bright−P」の場合と同様であるので、説明を省略する。   The calculation by the command “TDBP” is the same as the command “Trans”, the command “Dot”, and the command “Bright-P”, and the description thereof will be omitted. The input data is the same as that of the command “Trans”, and the output data is the same as that of the command “Bright-P”.

[14]コマンド「TD」   [14] Command “TD”

コマンド「TD」は、グーローシェーディングモードのポリゴンに対するライティングの前処理を一括して行うためのコマンドである。コマンド「Trans」(ベクトル直交変換)およびコマンド「Dot」(ベクトル内積)を1コマンドで実行する。ただし、演算途中のデータ、すなわちコマンド「Trans」の出力データは、メインRAM25に出力されない。このコマンドの実行後、コマンド「Ccalc」を実行することにより、ライティング処理後のポリゴン頂点色が算出される。   The command “TD” is a command for collectively performing lighting preprocessing for polygons in the Gouraud shading mode. The command “Trans” (vector orthogonal transformation) and the command “Dot” (vector dot product) are executed with one command. However, data in the middle of calculation, that is, output data of the command “Trans” is not output to the main RAM 25. After executing this command, the command “Ccalc” is executed to calculate the polygon vertex color after the lighting processing.

コマンド「TD」による演算は、コマンド「Trans」およびコマンド「Dot」と同様なので説明を省略する。また、入力データについては、コマンド「Trans」の場合と同様であり、出力データについては、コマンド「Dot」の場合と同様であるので、説明を省略する。   The calculation by the command “TD” is the same as the command “Trans” and the command “Dot”, and the description thereof will be omitted. The input data is the same as in the case of the command “Trans”, and the output data is the same as in the case of the command “Dot”.

図21は、図10の実行ユニット100の内部構成を示すブロック図である。なお、図中の各構成の名称の後に付した()内の数字は、その構成のビット数を示す。   FIG. 21 is a block diagram showing an internal configuration of the execution unit 100 of FIG. In addition, the number in () attached | subjected after the name of each structure in a figure shows the bit number of the structure.

図21を参照して、実行ユニット100は、除算ユニット102(32ビット/32ビット)、積和演算ユニット104(16ビット×16ビット+65ビット)、追加演算ユニット106、型変換ユニット108a,108b、マルチプレクサ(MUX)110a,110b、マルチプレクサ(MUX)112a,112b、Vector10形式変換ユニット114、およびバス150a,150b,150cを含む。   Referring to FIG. 21, the execution unit 100 includes a division unit 102 (32 bits / 32 bits), a product-sum operation unit 104 (16 bits × 16 bits + 65 bits), an additional operation unit 106, type conversion units 108a and 108b, Multiplexers (MUX) 110a and 110b, multiplexers (MUX) 112a and 112b, Vector 10 format conversion unit 114, and buses 150a, 150b and 150c are included.

除算ユニット102は、被除数レジスタ116、除数レジスタ118、32ビット除算器120、及び商レジスタ122を含む。積和演算ユニット104は、被乗数調整ユニット124、被乗数レジスタ126、乗数調整ユニット128、乗数レジスタ130、16ビット乗算器132、積調整ユニット134、積レジスタ136、ビット拡張付シフタ138、レジスタ140、ビット拡張ユニット142、マルチプレクサ(MUX)144、65ビット加算器146、及びSUMレジスタ148を含む。   The division unit 102 includes a dividend register 116, a divisor register 118, a 32-bit divider 120, and a quotient register 122. The product-sum operation unit 104 includes a multiplicand adjustment unit 124, a multiplicand register 126, a multiplier adjustment unit 128, a multiplier register 130, a 16-bit multiplier 132, a product adjustment unit 134, a product register 136, a shifter 138 with bit extension, a register 140, and a bit. It includes an expansion unit 142, a multiplexer (MUX) 144, a 65-bit adder 146, and a SUM register 148.

各演算ユニット102,104及び106と入出力データ間は、バス150a、バス150b、及びバス150cで接続される。バス150a、バス150b、及びバス150cの各々は、32ビットのデータを転送する。ここで、入出力データとは、I/Oレジスタセット300からの入力データRGI、I/Oレジスタセット300への出力データRGO、メインRAM25からのリードデータMRE、及びメインRAM25へのライトデータMWRを指す。   The arithmetic units 102, 104, and 106 and the input / output data are connected by a bus 150a, a bus 150b, and a bus 150c. Each of the bus 150a, the bus 150b, and the bus 150c transfers 32-bit data. Here, the input / output data includes input data RGI from the I / O register set 300, output data RGO to the I / O register set 300, read data MRE from the main RAM 25, and write data MWR to the main RAM 25. Point to.

バス150aおよびバス150bに送出されるデータとしては、I/Oレジスタセット300に格納されているデータRGI、メインRAM25からのリードデータMRE、メインRAM25からのリードデータMREがVector10形式変換ユニット114で変換されたデータVCT、およびバス150cから出力されたデータBUCの4通りがある。この点を詳しく説明する。   As data sent to the bus 150a and the bus 150b, the data RGI stored in the I / O register set 300, the read data MRE from the main RAM 25, and the read data MRE from the main RAM 25 are converted by the Vector 10 format conversion unit 114. There are four types of data VCT and data BUC output from the bus 150c. This point will be described in detail.

MUX112aは、I/Oレジスタセット300からのデータREI、メインRAM25からのデータMRE、及びVector10形式変換ユニット114からのデータVCTを受け取り、制御ユニット200からの制御信号に従って、そのうちの1つを選択してMUX110aに出力する。   The MUX 112a receives the data REI from the I / O register set 300, the data MRE from the main RAM 25, and the data VCT from the Vector10 format conversion unit 114, and selects one of them according to the control signal from the control unit 200. Output to the MUX 110a.

MUX110aは、MUX112aからの選択データ及びバス150cからのデータBUCを受け取り、制御ユニット200からの制御信号に従って、そのうちの1つを選択して型変換ユニット108aに出力する。型変換ユニット108aは、制御ユニット200からの制御信号に従って、MUX110aから受け取った選択データに対して、後で詳細に説明する型変換を施し、結果データをバス150aに送出する。   The MUX 110a receives the selection data from the MUX 112a and the data BUC from the bus 150c, selects one of them according to the control signal from the control unit 200, and outputs it to the type conversion unit 108a. The type conversion unit 108a performs type conversion, which will be described in detail later, on the selection data received from the MUX 110a in accordance with the control signal from the control unit 200, and sends the result data to the bus 150a.

一方、MUX112bは、I/Oレジスタセット300からのデータREI、メインRAM25からのデータMRE、及びVector10形式変換ユニット114からのデータVCTを受け取り、制御ユニット200からの制御信号に従って、そのうちの1つを選択してMUX110bに出力する。   On the other hand, the MUX 112b receives the data REI from the I / O register set 300, the data MRE from the main RAM 25, and the data VCT from the Vector10 format conversion unit 114, and in accordance with a control signal from the control unit 200, one of them is received. Select and output to MUX 110b.

MUX110bは、MUX112bからの選択データ及びバス150cからのデータBUCを受け取り、制御ユニット200からの制御信号に従って、そのうちの1つを選択して型変換ユニット108bに出力する。型変換ユニット108bは、制御ユニット200からの制御信号に従って、MUX110bから受け取った選択データに対して、後で詳細に説明する型変換を施し、結果データをバス150bに送出する。   The MUX 110b receives the selection data from the MUX 112b and the data BUC from the bus 150c, selects one of them according to the control signal from the control unit 200, and outputs it to the type conversion unit 108b. The type conversion unit 108b performs type conversion described in detail later on the selection data received from the MUX 110b in accordance with the control signal from the control unit 200, and sends the result data to the bus 150b.

Vector10形式変換ユニット114の詳細を説明する。Vector10形式変換ユニット114は、メインRAM25からのリードデータMREとして入力される32ビットのVector10形式のデータ(図13参照)からメンバX、Y、及びZを抽出し、制御ユニット200からの制御信号に従って、X、Y、及びZのメンバ単位で、データVCTとして、MUX112a及び112bに出力する。ただし、Vector10形式変換ユニット114は、各メンバX,Y及びZを出力する前に、メンバScaleの値に応じて、各メンバX,Y及びZに対して1倍から8倍までの拡大変換を施す。従って、出力データVCTは、拡大変換後のデータである。   Details of the Vector 10 format conversion unit 114 will be described. The Vector 10 format conversion unit 114 extracts members X, Y, and Z from 32-bit Vector 10 format data (see FIG. 13) input as read data MRE from the main RAM 25, and in accordance with a control signal from the control unit 200. , X, Y, and Z are output as data VCT to the MUXs 112a and 112b. However, before outputting each member X, Y, and Z, the Vector 10 format conversion unit 114 performs an expansion conversion from 1 to 8 times on each member X, Y, and Z according to the value of the member Scale. Apply. Therefore, the output data VCT is data after enlargement conversion.

型変換ユニット108aの詳細を説明する。なお、型変換ユニット108bは、型変換ユニット108aと同一の型変換を実行するので説明を省略する。   Details of the type conversion unit 108a will be described. Since the type conversion unit 108b performs the same type conversion as the type conversion unit 108a, the description thereof is omitted.

型変換ユニット108aは、制御ユニット200からの制御信号に応じて、次に示す型変換[1]〜[13]のうちのいずれかを行う。型変換[1]〜[13]の説明において、“IN”は入力値、“OUT”は出力値、記号“=”は代入、“n()”はnビット分の()、記号“{,}”はビットの連接を表す。例えば、「4(0b0)」は、4ビット分の「0」、つまり、「0b0000」のことである。   The type conversion unit 108a performs any one of the following type conversions [1] to [13] in accordance with a control signal from the control unit 200. In the description of type conversions [1] to [13], “IN” is an input value, “OUT” is an output value, symbol “=” is assigned, “n ()” is n bits of (), and symbol “{ ,} ”Represents bit concatenation. For example, “4 (0b0)” is “0” for 4 bits, that is, “0b0000”.

型変換[1]は、下位8ビットから32ビットへのゼロ拡張であり、次式で示される。
OUT[31:0]={24(0b0),IN[7:0]}
Type conversion [1] is zero extension from the lower 8 bits to 32 bits, and is represented by the following equation.
OUT [31: 0] = {24 (0b0), IN [7: 0]}

型変換[2]は、下位8ビットから32ビットへの符号拡張であり、次式で示される。
OUT[31:0]={24(IN[7]),IN[7:0]}
Type conversion [2] is sign extension from the lower 8 bits to 32 bits, and is represented by the following equation.
OUT [31: 0] = {24 (IN [7]), IN [7: 0]}

型変換[3]は、下位16ビットから32ビットへのゼロ拡張であり、次式で示される。
OUT[31:0]={16(0b0),IN[15:0]}
Type conversion [3] is zero extension from lower 16 bits to 32 bits, and is represented by the following equation.
OUT [31: 0] = {16 (0b0), IN [15: 0]}

型変換[4]は、下位16ビットから32ビットへの符号拡張であり、次式で示される。
OUT[31:0]={16(IN[15]),IN[15:0]}
Type conversion [4] is sign extension from lower 16 bits to 32 bits, and is represented by the following equation.
OUT [31: 0] = {16 (IN [15]), IN [15: 0]}

型変換[5]は、下位16ビットのLSB側に1ビットの「0」を連接し、32ビットへゼロ拡張するものであり、次式で示される。
OUT[31:0]={15(0b0),IN[15:0],0b0}
In the type conversion [5], 1-bit “0” is concatenated to the LSB side of the lower 16 bits and zero-extended to 32 bits, and is represented by the following equation.
OUT [31: 0] = {15 (0b0), IN [15: 0], 0b0}

型変換[6]は、下位16ビットのLSB側に1ビットの「0」を連接し、32ビットへ符号拡張するものであり、次式で示される。
OUT[31:0]={15(IN[15]),IN[15:0],0b0}
In the type conversion [6], 1-bit “0” is concatenated to the lower 16-bit LSB side and sign-extended to 32 bits, and is represented by the following equation.
OUT [31: 0] = {15 (IN [15]), IN [15: 0], 0b0}

型変換[7]は、下位16ビットに32ビット中のMSB(符号ビット)を16ビット分追加するものであり、次式で示される。
OUT[31:0]={16(IN[31]),IN[15:0]}
The type conversion [7] is to add 16 bits of MSB (sign bit) in 32 bits to the lower 16 bits, and is represented by the following equation.
OUT [31: 0] = {16 (IN [31]), IN [15: 0]}

型変換[8]は、上位16ビットのLSB側に1ビットの「0」を連接し、32ビットへゼロ拡張するものであり、次式で示される。
OUT[31:0]={15(0b0),IN[31:16],0b0}
In the type conversion [8], 1-bit “0” is concatenated to the upper 16-bit LSB side and zero-extended to 32 bits, and is represented by the following equation.
OUT [31: 0] = {15 (0b0), IN [31:16], 0b0}

型変換[9]は、上位16ビットのLSB側に1ビットの「0」を連接し、32ビットへ符号拡張するものであり、次式で示される。
OUT[31:0]={15(IN[31]),IN[31:16],0b0}
In the type conversion [9], 1-bit “0” is concatenated to the LSB side of the upper 16 bits and the sign is extended to 32 bits, and is represented by the following equation.
OUT [31: 0] = {15 (IN [31]), IN [31:16], 0b0}

型変換[10]は、上位16ビットから32ビットへのゼロ拡張であり、次式で示される。
OUT[31:0]={16(0b0),IN[31:16]}
Type conversion [10] is zero extension from upper 16 bits to 32 bits, and is represented by the following equation.
OUT [31: 0] = {16 (0b0), IN [31:16]}

型変換[11]は、上位16ビットから32ビットへの符号拡張であり、次式で示される。
OUT[31:0]={16(IN[31]),IN[31:16]}
Type conversion [11] is a sign extension from upper 16 bits to 32 bits, and is represented by the following equation.
OUT [31: 0] = {16 (IN [31]), IN [31:16]}

型変換[12]は、上位16ビットのLSB側に16ビットの「0」を連接するものであり、次式で示される。
OUT[31:0]={IN[31:16]),16(0b0)}
The type conversion [12] connects 16 bits “0” to the LSB side of the upper 16 bits, and is represented by the following equation.
OUT [31: 0] = {IN [31:16]), 16 (0b0)}

型変換[13]は、型変換を行わないものであり(32ビットのまま)、次式で示される。
OUT[31:0]=IN[31:0]
Type conversion [13] does not perform type conversion (remaining 32 bits), and is represented by the following equation.
OUT [31: 0] = IN [31: 0]

さて、除算ユニット102は、32ビットの被除数を32ビットの除数で除し、32ビットの商を出力する。具体的な構成は次の通りである。   Now, the division unit 102 divides the 32-bit dividend by the 32-bit divisor and outputs a 32-bit quotient. The specific configuration is as follows.

被除数レジスタ116は、バス150aに送出されている32ビットのデータを取り込み、除算の入力値である被除数として保持する。除数レジスタ118は、バス150bに送出されている32ビットのデータを取り込み、除算の入力値である除数として保持する。32ビット除算器120は、被除数レジスタ116に保持されている被除数を、除数レジスタ118に保持されている除数で除し、32ビットの商を出力する。ただし、剰余は出力されない。本実施の形態では、除算器120は、常に符号無し除算を行うものであるが、符号付き除算を行うようにすることもできる。商レジスタ122は、32ビット除算器120が出力する商を取り込み、追加演算ユニット106に出力する。被除数レジスタ116が保持する値もまた、追加演算ユニット106に出力される。   The dividend register 116 takes in the 32-bit data sent to the bus 150a and holds it as a dividend which is an input value for division. The divisor register 118 takes in the 32-bit data sent to the bus 150b and holds it as a divisor that is an input value for division. The 32-bit divider 120 divides the dividend held in the dividend register 116 by the divisor held in the divisor register 118 and outputs a 32-bit quotient. However, the remainder is not output. In the present embodiment, the divider 120 always performs unsigned division, but it is also possible to perform signed division. The quotient register 122 takes in the quotient output from the 32-bit divider 120 and outputs it to the additional arithmetic unit 106. The value held by the dividend register 116 is also output to the additional arithmetic unit 106.

積和演算ユニット104の具体的な構成は次の通りである。被乗数調整ユニット124は、制御ユニット200からの制御信号及びバス150aから受け取った被乗数の符号に応じて、被乗数の論理反転(ビット反転)、算術反転、及び/又はルックアヘッドキャリーの加算といった処理を行う。被乗数レジスタ126は、被乗数調整ユニット124から出力された被乗数(16ビット)を保持する。   A specific configuration of the product-sum operation unit 104 is as follows. The multiplicand adjustment unit 124 performs a process such as logical inversion (bit inversion), arithmetic inversion, and / or look-ahead carry addition of the multiplicand according to the control signal from the control unit 200 and the sign of the multiplicand received from the bus 150a. . The multiplicand register 126 holds the multiplicand (16 bits) output from the multiplicand adjustment unit 124.

ここで、算術反転とは、2の補数を求めることにより、入力値の符号を反転した値を算出することを指す。   Here, arithmetic inversion refers to calculating a value obtained by inverting the sign of an input value by obtaining a 2's complement.

乗数調整ユニット128は、制御ユニット200からの制御信号及びバス150bから受け取った乗数の符号に応じて、乗数の論理反転(ビット反転)、算術反転、及び/又はルックアヘッドキャリーの加算といった処理を行う。乗数レジスタ130は、乗数調整ユニット128から出力された乗数(16ビット)を保持する。   The multiplier adjustment unit 128 performs processing such as logical inversion (bit inversion) of multiplier, arithmetic inversion, and / or addition of look-ahead carry according to the control signal from the control unit 200 and the sign of the multiplier received from the bus 150b. . The multiplier register 130 holds the multiplier (16 bits) output from the multiplier adjustment unit 128.

16ビット乗算器132は、被乗数レジスタ126に保持されている16ビットの被乗数と、乗数レジスタ130に保持されている16ビットの乗数とを掛け合わせ、32ビットの積を出力する。乗算器132は、原則として、符合無し乗算のみを行う。ただし、乗算器132は、被乗数調整ユニット124、乗数調整ユニット128、及び積調整ユニット134による処理を介することで、乗数及び被乗数の一方または双方が符号付きの値であっても、乗算を行うことができる。   The 16-bit multiplier 132 multiplies the 16-bit multiplicand held in the multiplicand register 126 by the 16-bit multiplier held in the multiplier register 130, and outputs a 32-bit product. In principle, the multiplier 132 performs only unsigned multiplication. However, the multiplier 132 performs multiplication even if one or both of the multiplier and the multiplicand are signed values through the processing by the multiplicand adjustment unit 124, the multiplier adjustment unit 128, and the product adjustment unit 134. Can do.

積調整ユニット134は、乗数及び被乗数の符号に応じて、乗算器132が出力した積の算術反転を行う。積レジスタ136は、積調整ユニット134から出力された33ビットの積を保持する。   The product adjustment unit 134 performs arithmetic inversion of the product output from the multiplier 132 according to the sign of the multiplier and multiplicand. The product register 136 holds the 33-bit product output from the product adjustment unit 134.

ビット拡張付シフタ138は、制御ユニット200からの制御信号に応じて、次の変換[1]〜[5]のうちのいずれかを行う。変換[1]〜[5]において、“IN”は入力値、“OUT”は出力値、記号“=”は代入、“n()”はnビット分の()、記号“{,}”はビットの連接を表す。   The bit extension shifter 138 performs any one of the following conversions [1] to [5] in accordance with a control signal from the control unit 200. In the conversions [1] to [5], “IN” is an input value, “OUT” is an output value, the symbol “=” is assigned, “n ()” is n bits of (), and the symbol “{,}”. Represents the concatenation of bits.

変換[1]は、LSB側に16ビットの「0」を連接し、65ビットへ符号拡張するものであり、次式により表される。
OUT[64:0]={16(IN[32]),IN[32:0],16(0b0)}
The conversion [1] is obtained by concatenating 16-bit “0” on the LSB side and sign-extending to 65 bits, and is represented by the following equation.
OUT [64: 0] = {16 (IN [32]), IN [32: 0], 16 (0b0)}

変換[2]は、LSB側に32ビットの「0」を連接するものであり、次式により表される。
OUT[64:0]={IN[32:0],32(0b0)}
Conversion [2] is a concatenation of 32-bit “0” s on the LSB side and is expressed by the following equation.
OUT [64: 0] = {IN [32: 0], 32 (0b0)}

変換[3]は、32ビット中の上位31ビットを取り出し、65ビットへ符号拡張するものであり、次式により表される。
OUT[64:0]={33(IN[32]),IN[32:1])}
Conversion [3] takes the upper 31 bits out of 32 bits and sign-extends them to 65 bits, and is expressed by the following equation.
OUT [64: 0] = {33 (IN [32]), IN [32: 1])}

変換[4]は、32ビット中の下位31ビットを取り出し、65ビットへゼロ拡張するものであり、次式により表される。
OUT[64:0]={34(0b0),IN[30:0]}
Conversion [4] takes the lower 31 bits out of 32 bits and zero-extends them to 65 bits, and is expressed by the following equation.
OUT [64: 0] = {34 (0b0), IN [30: 0]}

変換[5]は、65ビットへ符号拡張するものであり、次式により表される。
OUT[64:0]={32(IN[32]),IN[32:0]}
Conversion [5] is for sign extension to 65 bits and is expressed by the following equation.
OUT [64: 0] = {32 (IN [32]), IN [32: 0]}

さて、一方、レジスタ140は、バス150bに送出されている32ビットのデータを保持する。ビット拡張ユニット142は、制御ユニット200からの制御信号に応じて、次の変換[1]〜[3]のうちのいずれかを行う。変換[1]〜[3]において、“IN”は入力値、“OUT”は出力値、記号“=”は代入、“n()”はnビット分の()、記号“{,}”はビットの連接を表す。   On the other hand, the register 140 holds 32-bit data transmitted to the bus 150b. The bit extension unit 142 performs any of the following conversions [1] to [3] according to the control signal from the control unit 200. In the conversions [1] to [3], “IN” is an input value, “OUT” is an output value, the symbol “=” is assigned, “n ()” is n bits of (), and the symbol “{,}”. Represents the concatenation of bits.

変換[1]は、65ビットへ符号拡張するものであり、次式により表される。
OUT[64:0]={33(IN[31]),IN[31:0]}
Conversion [1] is a sign extension to 65 bits, and is expressed by the following equation.
OUT [64: 0] = {33 (IN [31]), IN [31: 0]}

変換[2]は、32ビット中の下位31ビットを取り出し、65ビットへ符号拡張するものであり、次式により表される。
OUT[64:0]={34(0b0),IN[30:0]}
Conversion [2] takes the lower 31 bits out of 32 bits and sign-extends them to 65 bits, and is expressed by the following equation.
OUT [64: 0] = {34 (0b0), IN [30: 0]}

変換[3]は、65ビットへゼロ拡張するものであり、次式により表される。
OUT[64:0]={33(0b0),IN[31:0]}
Conversion [3] is zero-extended to 65 bits and is expressed by the following equation.
OUT [64: 0] = {33 (0b0), IN [31: 0]}

MUX144は、制御ユニット200からの制御信号に応じて、ビット拡張ユニット142から出力される65ビットのデータ、あるいは、SUMレジスタ148に保持されている65ビットのデータのいずれかを選択し、加算器146に出力する。   The MUX 144 selects either 65-bit data output from the bit expansion unit 142 or 65-bit data held in the SUM register 148 in accordance with a control signal from the control unit 200, and an adder To 146.

65ビット加算器146は、ビット拡張付シフタ138から出力される65ビットのデータと、MUX144から出力される65ビットのデータとを加算し、65ビットの和を出力する。SUMレジスタ148は、65ビット加算器146から出力される65ビットの和を保持する。   The 65-bit adder 146 adds the 65-bit data output from the bit extension shifter 138 and the 65-bit data output from the MUX 144, and outputs a 65-bit sum. The SUM register 148 holds the 65-bit sum output from the 65-bit adder 146.

以上のように、積和演算ユニット104は、大きく分けて、16ビットの被乗数と16ビットの乗数との乗算から32ビットの積を得る乗算器132と、65ビットのデータ同士の和を得る加算器146とから成る。この構成を用い、32ビット×32ビットの乗算を、4回の16ビット×16ビットの乗算に分解して実行することが可能である。   As described above, the product-sum operation unit 104 is roughly divided into a multiplier 132 that obtains a 32-bit product from multiplication of a 16-bit multiplicand and a 16-bit multiplier, and an addition that obtains the sum of 65-bit data. 146. Using this configuration, 32-bit × 32-bit multiplication can be divided into four 16-bit × 16-bit multiplications and executed.

追加演算ユニット106は、各コマンドに応じて、商レジスタ122に保持されているデータ、SUMレジスタ148に保持されているデータ、I/Oレジスタセット300に格納されているデータRGI、メインRAM25からのリードデータMRE、及び被除数レジスタ116からのデータを入力値として、以下の追加演算を行う。下記において、“SUM”はSUMレジスタ148の値を示し、記号“{,}”はビットの連接、記号“=”は代入、記号“==”は等号、記号“^”は排他的論理和を表す。   In accordance with each command, the additional arithmetic unit 106 receives data stored in the quotient register 122, data stored in the SUM register 148, data RGI stored in the I / O register set 300, and data from the main RAM 25. The following additional operations are performed using the read data MRE and data from the dividend register 116 as input values. In the following, “SUM” indicates the value of the SUM register 148, the symbol “{,}” is a bit concatenation, the symbol “=” is an assignment, the symbol “==” is an equal sign, and the symbol “^” is an exclusive logic. Represents the sum.

追加演算ユニット106は、コマンド「MatrixMulti」に対しては、出力値=SUM[47:16]とする。但し、“SUM”のビット48以上にビット47(符号ビット)の値と異なる値が含まれている場合は符号付き飽和演算を行う。   The additional arithmetic unit 106 sets output value = SUM [47:16] for the command “MatrixMulti”. However, when a bit different from the value of bit 47 (sign bit) is included in bit 48 or more of “SUM”, a signed saturation operation is performed.

追加演算ユニット106は、コマンド「Affine」及びコマンド「Trans」に対しては、出力値=SUM[31:0]とする。但し、“SUM”のビット32以上にビット31(符号ビット)の値と異なる値が含まれている場合は符号付き飽和演算を行う。   The additional arithmetic unit 106 sets output value = SUM [31: 0] for the command “Affine” and the command “Trans”. However, when a bit different from the value of bit 31 (sign bit) is included in bit 32 or more of “SUM”, a signed saturation operation is performed.

追加演算ユニット106は、コマンド「Pproj」に対しては、出力値=SUM[46:31]とする。但し、“SUM”のビット47以上にビット46(符号ビット)の値と異なる値が含まれている場合は符号付き飽和演算を行う。また、出力値がI/Oレジスタセット300のレジスタ「ZNear」の値より小さい、あるいはレジスタ「ZFar」の値より大きい場合には、クリッピングフラグをセットする。   The additional arithmetic unit 106 sets output value = SUM [46:31] for the command “Pproj”. However, when a bit different from the value of bit 46 (sign bit) is included in bit 47 or more of “SUM”, a signed saturation operation is performed. When the output value is smaller than the value of the register “ZNear” of the I / O register set 300 or larger than the value of the register “ZFar”, the clipping flag is set.

追加演算ユニット106は、コマンド「View」に対しては、出力値=SUM[15:0]+(レジスタ「ViewportOffsetX」の値又はレジスタ「ViewportOffsetY」の値)とする。但し、出力値が既定の最大値(X成分は「2047」、Y成分は「1023」)を超えている場合には最大値に飽和させるとともに、クリッピングフラグをセットする。   For the command “View”, the additional arithmetic unit 106 sets output value = SUM [15: 0] + (value of the register “ViewportOffsetX” or value of the register “ViewportOffsetY”). However, if the output value exceeds a predetermined maximum value (X component is “2047”, Y component is “1023”), the output value is saturated to the maximum value and a clipping flag is set.

追加演算ユニット106は、コマンド「Dot」に対しては、出力値={SUM[33](メンバS1),I/Oレジスタセット300のレジスタGR12(法線ベクトルのZ成分を格納)のビット15(メンバS2B),1ビットの「0」,SUMレジスタ148の絶対値のビット[29:25](メンバDvalue)}(=計8ビットのDot構造体)とする。   For the command “Dot”, the additional arithmetic unit 106 outputs bit = {SUM [33] (member S1), bit 15 of the register GR12 (stores the Z component of the normal vector) of the I / O register set 300. (Member S2B), 1 bit “0”, absolute value bits [29:25] (Member Dvalue)} of the SUM register 148 (= 8-bit Dot structure).

追加演算ユニット106は、コマンド「Bright−P」に対しては、次の処理を行う。ここで、(条件1)を(両面ポリゴン(Face==1)かつ(S1^S2B==1))または(片面ポリゴン(Face==0)かつ(S1==0))とする。(条件1)が偽の場合は、拡散光成分=SUM[4:0]とし、(条件1)が真の場合は、拡散光成分=0として、次に従う。つまり、追加演算ユニット106は、出力値(明度)=拡散光成分+環境光成分(レジスタ「Ambient」)+1とする。但し、上記の加算結果が最大値「0b11111」を超える場合は最大値に飽和させる。   The additional arithmetic unit 106 performs the following processing for the command “Bright-P”. Here, (Condition 1) is (Double-sided polygon (Face == 1) and (S1 ^ S2B == 1)) or (Single-sided polygon (Face == 0) and (S1 == 0)). When (Condition 1) is false, the diffused light component = SUM [4: 0] is set. When (Condition 1) is true, the diffused light component = 0 is set as follows. That is, the additional arithmetic unit 106 sets output value (lightness) = diffuse light component + ambient light component (register “Ambient”) + 1. However, when the above addition result exceeds the maximum value “0b11111”, it is saturated to the maximum value.

追加演算ユニット106は、コマンド「Ccalc」に対しては、コマンド「Bright−P」と同じ処理で明度を算出する。つまり、出力値={「B」×明度,「G」×明度,「R」×明度}とする。「R」,「G」及び「B」はそれぞれリードデータのビット[4:0],[9:5]及び[14:10]である。   For the command “Ccalc”, the additional arithmetic unit 106 calculates the brightness by the same process as the command “Bright-P”. That is, output value = {“B” × lightness, “G” × lightness, “R” × lightness}. “R”, “G”, and “B” are bits [4: 0], [9: 5], and [14:10] of the read data, respectively.

追加演算ユニット106は、コマンド「Cull」に対しては、いずれかのクリッピングフラグがセットされていれば、出力値を最大値に設定する。   If any clipping flag is set for the command “Cull”, the additional arithmetic unit 106 sets the output value to the maximum value.

追加演算ユニット106は、コマンド「Sqrt」に対しては、出力値=√(被除数レジスタ116に保持されている32ビット)とする。   The additional arithmetic unit 106 sets an output value = √ (32 bits held in the dividend register 116) for the command “Sqrt”.

追加演算ユニット106は、コマンド「Wcalc(CWDコマンドの一部)」に対しては、商のビット[31:8]==0の場合は、出力値=商のビット[7:0]とし、商のビット[31:8]==0でない場合は、出力値=0xFFとする。   For the command “Wcalc (part of the CWD command)”, the additional arithmetic unit 106 sets the output value = the quotient bits [7: 0] when the quotient bits [31: 8] == 0. If the quotient bits [31: 8] are not 0, the output value is 0xFF.

追加演算ユニット106は、コマンド「Dcalc(CWDコマンドの一部)」に対しては、SUM[32:1]を、レジスタ「DepthBias」の値に応じて論理右シフト(ゼロ・シフトイン)してDEP[31:0]を生成する。この場合、DEP[32:9]中の最も重み付けの大きい「1」位置に応じて、「0x0」〜「0xF」の値を指数部とする。また、DEP[32:9]中の最も重み付けの大きい「1」位置に応じて、SUM[23:1]から「1」に続く連続した8ビットを抽出し仮数部とする。そして、出力値={指数部(4ビット),仮数部(8ビット)}とする。   The additional arithmetic unit 106 logically shifts SUM [32: 1] to the command “Dcalc (part of the CWD command)” according to the value of the register “DepthBias” (zero shift-in). DEP [31: 0] is generated. In this case, the values from “0x0” to “0xF” are used as exponent parts according to the “1” position having the largest weight in DEP [32: 9]. Also, in accordance with the position “1” having the highest weight in DEP [32: 9], consecutive 8 bits following “1” are extracted from SUM [23: 1] and used as a mantissa part. Then, output value = {exponent part (4 bits), mantissa part (8 bits)}.

追加演算ユニット106は、コマンド「APV」に対しては、コマンド「Affine」、コマンド「Pproj」、及びコマンド「View」の組み合わせの処理を行う。   The additional arithmetic unit 106 processes the command “APV” in combination with the command “Affine”, the command “Pproj”, and the command “View”.

追加演算ユニット106は、コマンド「CWD」に対しては、コマンド「Cull」、コマンド「Wcalc」、及びコマンド「Dcalc」の組み合わせの処理を行う。   For the command “CWD”, the additional arithmetic unit 106 performs processing of a combination of the command “Cull”, the command “Wcalc”, and the command “Dcalc”.

追加演算ユニット106は、コマンド「TDBP」に対しては、コマンド「Trans」、コマンド「Dot」、及びコマンド「Bright−P」の組み合わせの処理を行う。   The additional arithmetic unit 106 processes the command “TDBP” in combination with the command “Trans”, the command “Dot”, and the command “Bright-P”.

追加演算ユニット106は、コマンド「TD」に対しては、コマンド「Trans」及びコマンド「Dot」の組み合わせの処理を行う。   The additional arithmetic unit 106 performs a combination process of the command “Trans” and the command “Dot” for the command “TD”.

上記のような各コマンドに応じた処理の他、追加演算ユニット106は、各演算の結果フラグ(キャリーフラグ、オーバーフローフラグ、サインフラグ、及びゼロ除算フラグ)の状態をI/Oレジスタセット300に出力する。   In addition to the processing according to each command as described above, the additional operation unit 106 outputs the state of the result flag (carry flag, overflow flag, sign flag, and divide-by-zero flag) of each operation to the I / O register set 300. To do.

追加演算ユニット106から出力されたデータは、バス150cに送出される。バス150cに送出されたデータは、バス150a又はバス150bに送出されて、次の演算の入力値として用いられるか、あるいは、メインRAM25へのライトデータMWRとしてロード/ストアユニット400へ出力される。   The data output from the additional arithmetic unit 106 is sent to the bus 150c. The data sent to the bus 150c is sent to the bus 150a or the bus 150b and used as an input value for the next calculation or output to the load / store unit 400 as write data MWR to the main RAM 25.

さて、以上のように、本実施の形態では、複数の単独のコマンド(以下、「単独コマンド」と呼ぶ。)による処理を1つのコマンド(以下、「複合コマンド」と呼ぶ。)で実行できる。つまり、複合コマンド「APV」,「CWD」,「TDBP」,及び「TD」を用意している。このため、コマンドの発行回数を減らすことができ、コマンドを発行するCPU5の処理負荷およびシステムのオーバーヘッドが軽くなる。また、複合コマンドの処理過程で生成される中間値(つまり、単独コマンドの出力値)は、メインRAM25に書き出されず、GE17内部のレジスタGR0〜GR15に保持されるため、コマンドの実行に必要なメモリ領域を小さくできるとともに、メモリアクセスに必要なバス帯域を小さくできる。   As described above, in the present embodiment, processing by a plurality of single commands (hereinafter referred to as “single commands”) can be executed with one command (hereinafter referred to as “composite commands”). That is, composite commands “APV”, “CWD”, “TDBP”, and “TD” are prepared. For this reason, the number of times the command is issued can be reduced, and the processing load on the CPU 5 issuing the command and the overhead of the system are reduced. In addition, since an intermediate value (that is, an output value of a single command) generated in the process of the composite command is not written to the main RAM 25 but is held in the registers GR0 to GR15 in the GE 17, a memory necessary for executing the command The area can be reduced and the bus bandwidth required for memory access can be reduced.

また、本実施の形態では、メインRAM25やレジスタGR0〜GR15に、演算対象データとしての各行列の要素のビット数を最適化して格納しておき、演算前に、型変換ユニット108a及び108bが、最適化された演算対象データを、ゼロ拡張又は符号拡張することによって、最大サイズに揃える。従って、演算対象データを格納するメモリ領域及びレジスタ領域を節約することができる。なお、演算対象データとしての各行列の要素の精度および表現可能範囲は必ずしも均一ではないが、型変換ユニット108a及び108bによる変換後のデータ型は、演算回路の都合などで均一に揃えられている。   In the present embodiment, the number of bits of each matrix element as the calculation target data is optimized and stored in the main RAM 25 and the registers GR0 to GR15. Before the calculation, the type conversion units 108a and 108b The optimized operation target data is aligned to the maximum size by zero extension or sign extension. Therefore, it is possible to save a memory area and a register area for storing operation target data. Note that the accuracy and expressible range of each matrix element as the calculation target data are not necessarily uniform, but the data types after conversion by the type conversion units 108a and 108b are uniformly arranged due to the convenience of the arithmetic circuit and the like. .

制御ユニット200は、入力されたコマンドが所定の行列演算の実行を命令するものである場合、例えば、コマンド「Affine」の場合、入力行列中の所定の要素に対しては、型変換ユニット108a及び108bが入力されたデータを型変換するように制御し、入力行列中の所定の要素以外の要素に対しては、型変換ユニット108a及び108bが入力されたデータを型変換せずにそのまま出力するように制御する。   When the input command is for instructing execution of a predetermined matrix operation, for example, in the case of the command “Affine”, the control unit 200 does not convert the type conversion unit 108a and the predetermined element in the input matrix. 108b controls the input data to perform type conversion, and for the elements other than the predetermined elements in the input matrix, the type conversion units 108a and 108b output the input data as it is without performing type conversion. To control.

さらに、本実施の形態では、Vector10形式変換ユニット114は、Vector10形式のデータ(図13参照)からメンバX、Y、及びZを抽出し、X、Y、及びZのメンバ単位で、データVCTとして、MUX112a及び112bに出力する。ただし、Vector10形式変換ユニット114は、各メンバX,Y及びZを出力する前に、メンバScaleの値に応じて、各メンバX,Y及びZに対して1倍から8倍までの拡大変換を施す。このように、拡大変換されたデータを実行ユニット100は処理するので、実際に演算が施されるデータのサイズを一定に保ちながら、倍率Scaleの設定変更によって、複数の、表現可能な範囲(図10(b)参照)をサポートすることができる。これにより、演算対象データを格納するメモリ領域及びレジスタ領域を節約することができる。   Further, in the present embodiment, the Vector 10 format conversion unit 114 extracts members X, Y, and Z from the Vector 10 format data (see FIG. 13), and as data VCT in units of X, Y, and Z members. , Output to MUX 112a and 112b. However, before outputting each member X, Y, and Z, the Vector 10 format conversion unit 114 performs an expansion conversion from 1 to 8 times on each member X, Y, and Z according to the value of the member Scale. Apply. Since the execution unit 100 processes the enlarged and converted data in this way, a plurality of expressible ranges (FIG. 5) can be obtained by changing the setting of the scale factor while keeping the size of the data to be actually subjected to computation constant. 10 (b)) can be supported. Thereby, it is possible to save a memory area and a register area for storing operation target data.

さらに、本実施の形態では、ポリゴンが1つのデプス値で定義されるが(つまり、頂点ごとのデプス値を持っていないが)、コマンド「CWD」及び(数34)によって、3頂点のZ軸成分の加算結果からポリゴンのデプス値を算出することができる。この場合、GE17は、その加算結果を12ビットの浮動小数点数形式に変換し、変換結果の値とポリゴン構造体インスタンスのメンバ「Depth」に格納されているデプス初期値とを加算し、その加算結果をメンバ「Depth」に書き戻す((数35)参照)。デプス初期値は、デプス値のバイアスとして機能し、これにより意図的にポリゴンの描画優先順位を上げたり下げたりする表現が可能になる。また、デプス値を浮動小数点数形式で表現することにより、少ないビット数で広範な座標空間の範囲をカバーできる。また、視点に近い領域では高い精度で、遠い領域では粗い精度でデプス値を表現でき、少ないビット数のデプス値で3次元グラフィックスの描画に求められる精度に応じた表現が可能となる。   Furthermore, in this embodiment, the polygon is defined by one depth value (that is, it does not have a depth value for each vertex), but the command “CWD” and (Equation 34) are used for the Z-axis of three vertices. The polygon depth value can be calculated from the addition result of the components. In this case, the GE 17 converts the addition result into a 12-bit floating point number format, adds the value of the conversion result and the initial depth value stored in the member “Depth” of the polygon structure instance, and adds the result. The result is written back to the member “Depth” (see (Expression 35)). The depth initial value functions as a bias for the depth value, thereby enabling expression that intentionally increases or decreases the drawing priority of polygons. Also, by expressing the depth value in a floating-point number format, a wide range of coordinate space can be covered with a small number of bits. In addition, the depth value can be expressed with high accuracy in a region close to the viewpoint and with coarse accuracy in a far region, and can be expressed in accordance with the accuracy required for rendering three-dimensional graphics with a depth value of a small number of bits.

また、レジスタ「DepthBias」は、ポリゴンのデプス値の指数部のバイアスを設定する((数34)参照)。このレジスタには、CPU5が自由にアクセスできるため、三次元空間中の複数のポリゴンの分散の程度に応じ、デプス値を最適化できる。すなわち、限定的な精度のデプス値であっても、ポリゴンの奥行き方向の並び順を正しく表現できるため、メモリ使用量を節約できる。   The register “DepthBias” sets the bias of the exponent part of the depth value of the polygon (see (Expression 34)). Since the CPU 5 can freely access this register, the depth value can be optimized according to the degree of dispersion of a plurality of polygons in the three-dimensional space. That is, even if the depth value has a limited accuracy, the arrangement order of the polygons in the depth direction can be expressed correctly, so that the memory usage can be saved.

さらに、本実施の形態では、コマンド「Pproj」(あるいは「Pproj」を含む「APV」)およびコマンド「Cull」は、ポリゴンの3頂点のZ座標の少なくとも1つが、ビューボリュームVVの範囲内にないポリゴンについては、レジスタ「GECommand」のフィールド「InvalidStructureRemove」に「0」が設定されていた場合、3頂点の座標に描画範囲外の値を設定して、描画されないようにする(第1カリングと呼ぶ。)。これにより、描画処理の負荷を軽減できる。   Further, in the present embodiment, in the command “Pproj” (or “APV” including “Pproj”) and the command “Cull”, at least one of the Z coordinates of the three vertices of the polygon is not within the range of the view volume VV. As for the polygon, when “0” is set in the field “InvalidStructureRemove” of the register “GECommand”, a value outside the drawing range is set to the coordinates of the three vertices to prevent drawing (referred to as first culling). .) Thereby, the load of drawing processing can be reduced.

一方、コマンド「Pproj」(あるいは「Pproj」を含む「APV」)およびコマンド「Cull」は、ポリゴンの3頂点のZ座標の少なくとも1つが、ビューボリュームVVの範囲内にないポリゴンについては、レジスタ「GECommand」のフィールド「InvalidStructureRemove」に「1」が設定されていた場合、当該ポリゴン構造体インスタンスをポリゴン構造体配列から取り除く(第2カリングと呼ぶ。)。これにより、メモリ使用量の節約および描画処理の負荷を軽減できる。   On the other hand, the command “Pproj” (or “APV” including “Pproj”) and the command “Cull” are used for a polygon in which at least one of the Z coordinates of the three vertices of the polygon is not within the range of the view volume VV. When “1” is set in the field “InvalidStructureRemove” of “GECommand”, the polygon structure instance is removed from the polygon structure array (referred to as second culling). As a result, the memory usage can be saved and the drawing processing load can be reduced.

ポリゴンの3頂点のZ座標の少なくとも1つが、ビューボリュームVVの範囲内にないポリゴンに対する処理として、レジスタ「GECommand」のフィールド「InvalidStructureRemove」への値の設定により、第1カリング及び第2カリングのいずれかを選択可能である。このため、CPU5が出力結果を参照・調製する必要がある場合には、第1カリングを選択し、そうでなければメモリを節約するために第2カリングを選択することが可能となる。   As a process for a polygon in which at least one of the Z coordinates of the three vertices of the polygon is not within the range of the view volume VV, either the first culling or the second culling is set by setting a value in the field “InvalidStructureRemove” of the register “GECommand”. Can be selected. Therefore, the CPU 5 can select the first culling when it is necessary to refer to and prepare the output result, and otherwise the second culling can be selected to save the memory.

CPU5は、レジスタ「ZNear」及び「ZFar」へアクセスすることにより、ビューボリュームVVの大きさを自由に設定できる。従って、CPU5は、描画対象となる三次元空間の範囲を自由に制御できる。   The CPU 5 can freely set the size of the view volume VV by accessing the registers “ZNear” and “ZFar”. Therefore, the CPU 5 can freely control the range of the three-dimensional space to be drawn.

さらに、本実施の形態では、コマンド「Cull」は、裏面カリングのためのベクトル外積演算によるポリゴンの表裏判定を、三次元直交座標系でなく、二次元直交座標系へ投影後の頂点座標を用いて行うことにより、演算量を大幅に削減している。   Further, in the present embodiment, the command “Cull” uses the vertex coordinates after projection to the two-dimensional orthogonal coordinate system, not the three-dimensional orthogonal coordinate system, to determine the front and back of the polygon by the vector cross product operation for back surface culling. This greatly reduces the amount of computation.

さらに、本実施の形態では、コマンド「Cull」は、ポリゴンの表裏判定において裏の面が現れると判定されたポリゴンについては、レジスタ「GECommand」のフィールド「InvalidStructureRemove」に「0」が設定されていた場合、3頂点の座標に描画範囲外の値を設定して、描画されないようにする(第1カリング)。これにより、描画処理の負荷を軽減できる。   Further, in the present embodiment, the command “Cull” is set to “0” in the field “InvalidStructureRemove” of the register “GECommand” for the polygon that is determined that the back surface appears in the front / back determination of the polygon. In this case, a value outside the drawing range is set to the coordinates of the three vertices so as not to be drawn (first culling). Thereby, the load of drawing processing can be reduced.

一方、コマンド「Cull」は、ポリゴンの表裏判定において裏の面が現れると判定されたポリゴンについては、レジスタ「GECommand」のフィールド「InvalidStructureRemove」に「1」が設定されていた場合、当該ポリゴン構造体インスタンスをポリゴン構造体配列から取り除く(第2カリング)。これにより、メモリ使用量の節約および描画処理の負荷を軽減できる。   On the other hand, the command “Cull” indicates that the polygon structure that has been determined that the reverse side appears in the front / back determination of the polygon, if “1” is set in the field “InvalidStructureRemove” of the register “GECommand”. Remove the instance from the polygon structure array (second culling). As a result, the memory usage can be saved and the drawing processing load can be reduced.

裏の面が現れると判定されたポリゴンに対する処理として、レジスタ「GECommand」のフィールド「InvalidStructureRemove」への値の設定により、第1カリング及び第2カリングのいずれかを選択可能である。このため、CPU5が出力結果を参照・調製する必要がある場合には、第1カリングを選択し、そうでなければメモリを節約するために第2カリングを選択することが可能となる。   As a process for the polygon that is determined to have the back surface appearing, either the first culling or the second culling can be selected by setting a value in the field “InvalidStructureRemove” of the register “GECommand”. Therefore, the CPU 5 can select the first culling when it is necessary to refer to and prepare the output result, and otherwise the second culling can be selected to save the memory.

さらに、本実施の形態によれば、コマンド「View」は、透視投影変換後のポリゴンの各頂点座標のX成分及びY成分に、それぞれオフセット「offx」及び「offy」を加算し、加算結果のX成分及びY成分からなる頂点座標が所定の範囲内にあるか否かを判定する。このように、オフセット加算後のポリゴンが所定の範囲内にあるか否かの判定を、三次元直交座標系でなく、二次元直交座標系へ投影後の頂点座標を用いて行うことにより、演算量を大幅に削減している。   Furthermore, according to the present embodiment, the command “View” adds the offsets “offx” and “offy” to the X component and Y component of each vertex coordinate of the polygon after perspective projection conversion, and the addition result It is determined whether or not the vertex coordinates composed of the X component and the Y component are within a predetermined range. In this way, it is possible to calculate whether the polygon after offset addition is within a predetermined range by using the vertex coordinates after projection to the two-dimensional orthogonal coordinate system instead of the three-dimensional orthogonal coordinate system. The amount is greatly reduced.

そして、コマンド「Cull」は、オフセット加算後のポリゴンが所定の範囲外であると判定したときは、レジスタ「GECommand」のフィールド「InvalidStructureRemove」に「0」が設定されていた場合、当該ポリゴンの3頂点の座標に描画範囲外の値を設定して、描画されないようにする(第1カリング)。これにより、描画処理の負荷を軽減できる。   When the command “Cull” determines that the polygon after the offset addition is outside the predetermined range, if “0” is set in the field “InvalidStructureRemove” of the register “GECommand”, the command 3 A value outside the drawing range is set to the coordinates of the vertex to prevent drawing (first culling). Thereby, the load of drawing processing can be reduced.

一方、コマンド「Cull」は、オフセット加算後のポリゴンが所定の範囲外であると判定したときは、レジスタ「GECommand」のフィールド「InvalidStructureRemove」に「1」が設定されていた場合、当該ポリゴン構造体インスタンスをポリゴン構造体配列から取り除く(第2カリング)。これにより、メモリ使用量の節約および描画処理の負荷を軽減できる。   On the other hand, when the command “Cull” determines that the polygon after the offset addition is outside the predetermined range, if “1” is set in the field “InvalidStructureRemove” of the register “GECommand”, the polygon structure Remove the instance from the polygon structure array (second culling). As a result, the memory usage can be saved and the drawing processing load can be reduced.

オフセット加算後のポリゴンが所定の範囲外にある場合の処理として、レジスタ「GECommand」のフィールド「InvalidStructureRemove」への値の設定により、第1カリング及び第2カリングのいずれかを選択可能である。このため、CPU5が出力結果を参照・調製する必要がある場合には、第1カリングを選択し、そうでなければメモリを節約するために第2カリングを選択することが可能となる。   As processing when the polygon after offset addition is outside the predetermined range, either the first culling or the second culling can be selected by setting a value in the field “InvalidStructureRemove” of the register “GECommand”. Therefore, the CPU 5 can select the first culling when it is necessary to refer to and prepare the output result, and otherwise the second culling can be selected to save the memory.

オフセット「offx」及び「offy」は、それぞれ、レジスタ「ViewportOffsetX」及びレジスタ「ViewportOffsetY」に、CPU5がアクセスすることにより、任意の値に設定できる。このように、二次元座標系に投影後の座標に加算するオフセットをCPU5が変更できるようにすることで、表示画面中の任意の位置にビューポートを設定できる。   The offsets “offx” and “offy” can be set to arbitrary values by the CPU 5 accessing the register “ViewportOffsetX” and the register “ViewportOffsetY”, respectively. In this way, by allowing the CPU 5 to change the offset added to the coordinates after projection onto the two-dimensional coordinate system, the viewport can be set at an arbitrary position in the display screen.

なお、本発明は、上記の実施の形態に限られるものではなく、その要旨を逸脱しない範囲で種々の態様において実施することが可能である。   In addition, this invention is not restricted to said embodiment, It is possible to implement in a various aspect in the range which does not deviate from the summary.

本発明の実施の形態によるマルチメディアプロセッサ1の内部構成を示すブロック図である。It is a block diagram which shows the internal structure of the multimedia processor 1 by embodiment of this invention. 図1のマルチメディアプロセッサ1によるグラフィックス処理の流れの概要を示すフローチャートである。2 is a flowchart showing an outline of a flow of graphics processing by the multimedia processor 1 of FIG. 1. 本実施の形態における座標変換フローの一例を示す図である。It is a figure which shows an example of the coordinate conversion flow in this Embodiment. 図1のGE17によるポリゴンの頂点座標変換処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the vertex coordinate conversion process of the polygon by GE17 of FIG. テクスチャマッピングモードでのポリゴンに対するライティング処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the lighting process with respect to the polygon in texture mapping mode. グーローシェーディングモードでのポリゴンに対するライティング処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the lighting process with respect to the polygon in Gouraud shading mode. (a)ポリゴンの表の面の例示図である。(b)ポリゴンの裏の面の例示図である。(A) It is an illustration figure of the surface of a polygon. (B) It is an illustration figure of the back surface of a polygon. ビューボリュームクリッピングの説明図である。It is explanatory drawing of view volume clipping. (a)パースペクティブコレクトを施したテクスチャマッピングの例示図である。(b)パースペクティブコレクトを施していないテクスチャマッピングの例示図である。(A) It is an illustration figure of the texture mapping which gave perspective collect. (B) It is an illustration figure of the texture mapping which has not performed perspective collect. 図1のGE17の内部構成を示すブロック図である。It is a block diagram which shows the internal structure of GE17 of FIG. 図10のI/Oレジスタセット300に含まれる各種レジスタの説明図である。FIG. 11 is an explanatory diagram of various registers included in the I / O register set 300 of FIG. 10. (a)Matrix32配列の構成を示す図である。(b)図12(a)のMatrix32配列の要素の構成を示す図である。(A) It is a figure which shows the structure of a Matrix32 arrangement | sequence. (B) It is a figure which shows the structure of the element of the Matrix32 arrangement | sequence of Fig.12 (a). (a)Vector10構造体の構成を示す図である。(b)Vector10構造体のメンバの説明図である。(c)Vector10構造体のメンバ「X」〜「Z」の構成を示す図である。(A) It is a figure which shows the structure of Vector10 structure. (B) It is explanatory drawing of the member of Vector10 structure. (C) It is a figure which shows the structure of member "X"-"Z" of the Vector10 structure. (a)Vector16構造体の構成を示す図である。(b)Vector16構造体のメンバの説明図である。(c)Vector16構造体のメンバ「Z」の構成を示す図である。(d)Vector16構造体のメンバ「X」及び「Y」の構成を示す図である。(A) It is a figure which shows the structure of Vector16 structure. (B) It is explanatory drawing of the member of Vector16 structure. (C) The structure of the member “Z” of the Vector16 structure. (D) It is a figure which shows the structure of member "X" of a Vector16 structure, and "Y". (a)Vector32構造体の構成を示す図である。(b)Vector32構造体のメンバの説明図である。(A) It is a figure which shows the structure of Vector32 structure. (B) It is explanatory drawing of the member of Vector32 structure. (a)Dot構造体の構成を示す図である。(b)Dot構造体のメンバの説明図である。(A) It is a figure which shows the structure of a Dot structure. (B) It is explanatory drawing of the member of a Dot structure. テクスチャマッピングモードのポリゴン構造体(GE入力形式)の構成を示す図である。It is a figure which shows the structure of the polygon structure (GE input format) of texture mapping mode. テクスチャマッピングモードのポリゴン構造体(GE入力形式)のメンバの説明図である。It is explanatory drawing of the member of the polygon structure (GE input format) of texture mapping mode. グーローシェーディングモードのポリゴン構造体(GE入力形式)の構成を示す図である。It is a figure which shows the structure of the polygon structure (GE input format) of a Gouraud shading mode. グーローシェーディングモードのポリゴン構造体(GE入力形式)のメンバの説明図である。It is explanatory drawing of the member of the polygon structure (GE input format) of Gouraud shading mode. 図10の実行ユニット100の内部構成を示すブロック図である。It is a block diagram which shows the internal structure of the execution unit 100 of FIG.

符号の説明Explanation of symbols

1…マルチメディアプロセッサ、3…外部メモリインタフェース、4…DMAC、5…CPU、7…CPUローカルRAM、9…RPU、11…カラーパレットRAM、13…SPU、15…SPUローカルRAM、17…GE、19…YSU、21…外部インタフェースブロック、23…メインRAMアクセスアービタ、25…メインRAM、27…I/Oバス、29…ビデオDAC、31…オーディオDACブロック、51…外部バス、50…外部メモリ、100…実行ユニット、102…除算ユニット、104…積和演算ユニット、106…追加演算ユニット、108a,108b…型変換ユニット、114…Vector10形式変換ユニット、200…制御ユニット、300…I/Oレジスタセット、400…ロード/ストアユニット。 DESCRIPTION OF SYMBOLS 1 ... Multimedia processor, 3 ... External memory interface, 4 ... DMAC, 5 ... CPU, 7 ... CPU local RAM, 9 ... RPU, 11 ... Color palette RAM, 13 ... SPU, 15 ... SPU local RAM, 17 ... GE, 19 ... YSU, 21 ... external interface block, 23 ... main RAM access arbiter, 25 ... main RAM, 27 ... I / O bus, 29 ... video DAC, 31 ... audio DAC block, 51 ... external bus, 50 ... external memory, DESCRIPTION OF SYMBOLS 100 ... Execution unit, 102 ... Division unit, 104 ... Product-sum operation unit, 106 ... Additional operation unit, 108a, 108b ... Type conversion unit, 114 ... Vector10 format conversion unit, 200 ... Control unit, 300 ... I / O register set , 400 ... Load / Store Uni Door.

Claims (22)

幾何演算を処理する演算処理装置であって、
幾何演算を実行する実行手段と、
外部から入力されるコマンドを解釈し、入力された前記コマンドに応じた処理を前記実行手段に実行させるように前記実行手段を制御する制御手段と、
前記幾何演算に用いられる演算対象データ及び/又は前記幾何演算の結果である演算結果データを保持するデータ保持手段と、を備え、
前記コマンドは、複数種類用意され、
前記実行手段は、前記複数種類のコマンドのうち、第1グループに属する前記コマンドに応じて、前記演算処理装置の外部のメモリ及び/又は前記データ保持手段から前記演算対象データを受け取り、幾何演算を実行し、前記演算結果データを前記外部のメモリに出力し、
前記複数種類のコマンドのうち、第2グループに属する前記コマンドは、前記第1グループに属する異なる前記コマンドの所定の組み合わせを実行することを指示する命令であり、
前記実行手段は、前記第2グループに属する前記コマンドに応じて、前記所定の組み合わせに含まれる前記コマンドのうち、最初の前記コマンドを実行する際には、前記外部のメモリ及び/又は前記データ保持手段から前記演算対象データを受け取って、幾何演算を実行し、最初の前記コマンド以外の前記コマンドを実行する際には、前記データ保持手段から前記演算対象データを受け取って、幾何演算を実行し、
前記所定の組み合わせに含まれる前記コマンドのうち、最後の前記コマンド以外の前記コマンドを実行後には、前記演算結果データを前記データ保持手段に出力し、最後の前記コマンドを実行後には、前記演算結果データを前記外部のメモリ及び/又は前記データ保持手段に出力する、演算処理装置。
An arithmetic processing device for processing geometric operations,
Execution means for performing geometric operations;
Control means for interpreting a command input from the outside and controlling the execution means to cause the execution means to execute processing according to the input command;
Data holding means for holding calculation target data used in the geometric calculation and / or calculation result data which is a result of the geometric calculation;
A plurality of types of the commands are prepared,
The execution means receives the calculation object data from an external memory of the arithmetic processing unit and / or the data holding means according to the command belonging to the first group among the plurality of types of commands, and performs geometric calculation. Execute, and output the operation result data to the external memory,
Of the plurality of types of commands, the command belonging to the second group is an instruction for instructing to execute a predetermined combination of different commands belonging to the first group,
The execution means holds the external memory and / or the data when executing the first command among the commands included in the predetermined combination in response to the command belonging to the second group. The calculation target data is received from the means, the geometric calculation is performed, and when executing the command other than the first command, the calculation target data is received from the data holding means, and the geometric calculation is performed.
After executing the command other than the last command among the commands included in the predetermined combination, the calculation result data is output to the data holding unit, and after executing the last command, the calculation result is output. An arithmetic processing unit that outputs data to the external memory and / or the data holding means.
幾何演算を処理する演算処理装置であって、
幾何演算を実行する実行手段と、
外部から入力されるコマンドを解釈し、入力された前記コマンドに応じた処理を前記実行手段に実行させるように前記実行手段を制御する制御手段と、
前記幾何演算に用いられる演算対象データ及び/又は前記幾何演算の結果である演算結果データを保持するデータ保持手段と、を備え、
前記実行手段は、
前記制御手段からの制御に従って、入力されたデータをそのまま出力する、あるいは所定のデータ型に変換して出力する型変換手段と、
前記型変換手段が出力するデータを用いて演算を実行する演算手段と、を含み、
前記制御手段は、前記演算対象データを前記演算処理装置の外部のメモリ及び/又は前記データ保持手段から読み出して、前記型変換手段に入力し、前記型変換手段から出力されたデータを前記演算手段に入力し、前記演算手段から出力されるデータを前記演算結果データとして前記メモリ及び/又は前記データ保持手段に書き込むように前記実行手段を制御する、演算処理装置。
An arithmetic processing device for processing geometric operations,
Execution means for performing geometric operations;
Control means for interpreting a command input from the outside and controlling the execution means to cause the execution means to execute processing according to the input command;
Data holding means for holding calculation target data used in the geometric calculation and / or calculation result data which is a result of the geometric calculation;
The execution means includes
According to the control from the control means, the input data is output as it is or converted into a predetermined data type and output,
Calculation means for performing calculation using data output from the type conversion means,
The control means reads the calculation target data from an external memory of the arithmetic processing unit and / or the data holding means, inputs the data to the type conversion means, and outputs the data output from the type conversion means to the calculation means The arithmetic processing unit controls the execution unit to write data output from the arithmetic unit to the memory and / or the data holding unit as the arithmetic result data.
前記制御手段は、入力されたコマンドが所定の行列演算の実行を命令するものである場合、入力行列中の所定の要素に対しては前記型変換手段が入力されたデータを前記所定のデータ型へ変換するように前記実行手段を制御し、前記入力行列中の前記所定の要素以外の要素に対しては、前記型変換手段が入力されたデータを前記所定のデータ型へ変換せずにそのまま出力するように前記実行手段を制御する、請求項2記載の演算処理装置。   When the input command is for instructing execution of a predetermined matrix operation, the control means converts the data input by the type conversion means to the predetermined data type for a predetermined element in the input matrix. The execution means is controlled so as to convert the data into the input matrix, and for the elements other than the predetermined element in the input matrix, the type conversion means does not convert the input data into the predetermined data type as it is. The arithmetic processing apparatus according to claim 2, wherein the execution means is controlled to output the data. 前記型変換手段が行う前記所定のデータ型の変換は、ゼロ拡張及び/又は符号拡張である、請求項2又は3記載の演算処理装置。   The arithmetic processing apparatus according to claim 2 or 3, wherein the conversion of the predetermined data type performed by the type conversion means is zero extension and / or sign extension. 幾何演算を処理する演算処理装置であって、
幾何演算を実行する実行手段と、
前記幾何演算に用いられる演算対象データ及び/又は前記幾何演算の結果である演算結果データを保持するデータ保持手段と、を備え、
前記実行手段は、
複数の数値と1つの倍率とを含むデータを入力とし、前記複数の数値のうち1つを選択して前記倍率と乗算を行い、乗算結果を出力する数値抽出手段と、
前記数値抽出手段が出力する前記乗算結果を用いて演算を実行する演算手段と、を含み、
前記実行手段は、前記演算対象データを前記演算処理装置の外部のメモリ及び/又は前記データ保持手段から読み出し、前記数値抽出手段に入力し、前記数値抽出手段から出力された前記乗算結果を前記演算手段に入力し、前記演算手段から出力されるデータを前記演算結果データとして前記メモリ及び/又は前記データ保持手段に書き込む、演算処理装置。
An arithmetic processing device for processing geometric operations,
Execution means for performing geometric operations;
Data holding means for holding calculation target data used in the geometric calculation and / or calculation result data which is a result of the geometric calculation;
The execution means includes
Numerical value extraction means for receiving data including a plurality of numerical values and one magnification, selecting one of the plurality of numerical values, performing multiplication with the magnification, and outputting a multiplication result;
Calculation means for performing an operation using the multiplication result output by the numerical value extraction means,
The execution unit reads the calculation target data from a memory external to the arithmetic processing unit and / or the data holding unit, inputs the data to the numerical value extraction unit, and outputs the multiplication result output from the numerical value extraction unit to the calculation An arithmetic processing apparatus that inputs data to the means and writes data output from the arithmetic means to the memory and / or the data holding means as the arithmetic result data.
幾何演算を処理する演算処理装置であって、
三次元直交座標系で多角形状のグラフィック要素を定義する複数の頂点座標を入力とし、前記各頂点座標の座標変換を行う座標変換手段と、
前記座標変換後の複数の頂点の、所定座標軸成分の総和を求め、求めた総和を前記多角形状のグラフィック要素の奥行き値として出力する総和算出手段と、を備える演算処理装置。
An arithmetic processing device for processing geometric operations,
A plurality of vertex coordinates defining a polygonal graphic element in a three-dimensional orthogonal coordinate system as input, a coordinate conversion means for performing coordinate conversion of each vertex coordinate;
An arithmetic processing unit, comprising: a total calculation unit that calculates a total of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion, and outputs the calculated total as a depth value of the polygonal graphic element.
幾何演算を処理する演算処理装置であって、
三次元直交座標系で多角形状のグラフィック要素を定義する複数の頂点座標を入力とし、前記各頂点座標の座標変換を行う座標変換手段と、
前記座標変換後の複数の頂点の、所定座標軸成分の総和を求める総和算出手段と、
前記総和および前記多角形状のグラフィック要素の奥行き値の初期値を入力とし、前記総和と前記初期値とを加算し、加算結果を前記多角形状のグラフィック要素の奥行き値として出力する加算手段と、を備える演算処理装置。
An arithmetic processing device for processing geometric operations,
A plurality of vertex coordinates defining a polygonal graphic element in a three-dimensional orthogonal coordinate system as input, a coordinate conversion means for performing coordinate conversion of each vertex coordinate;
A sum total calculating means for calculating a sum of predetermined coordinate axis components of the plurality of vertices after the coordinate transformation;
An initial value of the total value and the depth value of the polygonal graphic element as input, an addition means for adding the total and the initial value, and outputting the addition result as a depth value of the polygonal graphic element; Arithmetic processing device provided.
前記総和算出手段は、前記総和を浮動小数点数形式に変換して出力する、請求項6又は7記載の演算処理装置。   The arithmetic processing unit according to claim 6 or 7, wherein the sum calculation means converts the sum into a floating point number format and outputs the result. 浮動小数点数形式における前記総和の指数部のバイアス値を保持するバイアス保持手段をさらに備え、
前記バイアス保持手段は、前記演算処理装置の外部からアクセス可能であり、外部からリード及びライトすることができる、請求項8記載の演算処理装置。
Bias holding means for holding a bias value of the exponent part of the sum in a floating-point number format;
The arithmetic processing apparatus according to claim 8, wherein the bias holding unit is accessible from outside the arithmetic processing apparatus and can be read and written from the outside.
前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが所定の範囲内にない場合、当該多角形状のグラフィック要素の全頂点座標に描画範囲外の値を設定するカリング手段をさらに備える請求項6又は7記載の演算処理装置。   A culling means for setting a value outside the drawing range to all the vertex coordinates of the polygonal graphic element when at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within a predetermined range. The arithmetic processing device according to claim 6 or 7, further comprising: 前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが所定の範囲内にない場合、前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くカリング手段をさらに備える請求項6又は7記載の演算処理装置。   A culling means for removing data defining the polygonal graphic element from the drawing data string when at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within a predetermined range. The arithmetic processing apparatus of Claim 6 or 7 provided. 前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが所定の範囲内にない場合、当該多角形状のグラフィック要素の全頂点座標に描画範囲外の値を設定することができる第1のカリング手段と、
前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが前記所定の範囲内にない場合、前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くことができる第2のカリング手段と、
前記座標変換後の複数の頂点の複数の前記所定座標軸成分のうちの少なくとも1つが前記所定の範囲内にない場合の処理を実行する手段として、前記第1のカリング手段あるいは前記第2のカリング手段のいずれかを選択する選択手段と、をさらに備える請求項6又は7記載の演算処理装置。
When at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within a predetermined range, a value outside the drawing range may be set for all the vertex coordinates of the polygonal graphic element. A first culling means capable of;
When at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate conversion is not within the predetermined range, the data defining the polygonal graphic element can be removed from the drawing data string. A second culling means;
The first culling means or the second culling means as means for executing processing when at least one of the plurality of predetermined coordinate axis components of the plurality of vertices after the coordinate transformation is not within the predetermined range. The arithmetic processing apparatus according to claim 6, further comprising selection means for selecting any of the above.
前記所定の範囲を設定する閾値を保持する閾値保持手段をさらに備え、
前記閾値保持手段は、前記演算処理装置の外部からアクセス可能であり、外部からリード及びライトすることができる、請求項10から12記載の演算処理装置。
A threshold holding means for holding a threshold for setting the predetermined range;
13. The arithmetic processing apparatus according to claim 10, wherein the threshold value holding unit is accessible from outside the arithmetic processing apparatus and can be read and written from the outside.
幾何演算を処理する演算処理装置であって、
三次元直交座標系において、頂点の並び順が、時計回りとなる面を表、反時計回りとなる面を裏と定義された多角形状のグラフィック要素の各頂点座標を二次元直交座標系に投影する投影手段と、
前記投影後の全頂点座標から、第1頂点座標、第2頂点座標、及び第3頂点座標を選択する選択手段と、
前記第2頂点座標から前記第1頂点座標を減算して第1ベクトルを算出する第1のベクトル算出手段と、
前記第3頂点座標から前記第1頂点座標を減算して第2ベクトルを算出する第2のベクトル算出手段と、
前記第1ベクトルと前記第2ベクトルとの外積演算を行う外積演算手段と、
前記外積演算の結果の符号に基づいて、前記二次元直交座標系に前記多角形状のグラフィック要素の表と裏のどちらの面が現れるかを判定する判定手段と、を備える演算処理装置。
An arithmetic processing device for processing geometric operations,
In the 3D Cartesian coordinate system, each vertex coordinate of a polygonal graphic element defined with the vertex arrangement order representing the clockwise surface and the counterclockwise surface as the back is projected onto the 2D Cartesian coordinate system Projecting means,
Selecting means for selecting a first vertex coordinate, a second vertex coordinate, and a third vertex coordinate from all the projected vertex coordinates;
First vector calculating means for calculating a first vector by subtracting the first vertex coordinates from the second vertex coordinates;
Second vector calculating means for calculating a second vector by subtracting the first vertex coordinates from the third vertex coordinates;
Cross product calculation means for performing cross product calculation of the first vector and the second vector;
An arithmetic processing unit comprising: a determination unit that determines whether a front or back surface of the polygonal graphic element appears in the two-dimensional orthogonal coordinate system based on a sign of a result of the outer product operation.
前記裏の面が現れると判定された前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定するカリング手段をさらに備える請求項14記載の演算処理装置。   The arithmetic processing apparatus according to claim 14, further comprising a culling unit that sets a value outside a drawing range to all vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element that is determined that the back surface appears. 前記裏の面が現れると判定された前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くカリング手段をさらに備える請求項14記載の演算処理装置。   The arithmetic processing unit according to claim 14, further comprising a culling unit that removes data defining the polygonal graphic element that is determined to have the back surface from the drawing data sequence. 前記裏の面が現れると判定された前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定することができる第1のカリング手段と、
前記裏の面が現れると判定された前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くことができる第2のカリング手段と、
前記裏の面が現れると判定された場合の処理を実行する手段として、前記第1のカリング手段あるいは前記第2のカリング手段のいずれかを選択する選択手段と、をさらに備える請求項14記載の演算処理装置。
A first culling means capable of setting a value outside the drawing range to all vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element determined to have the back surface appear;
Second culling means capable of removing data defining the polygonal graphic element determined to appear the back surface from the drawing data sequence;
The selection means for selecting either the first culling means or the second culling means as means for executing processing when it is determined that the back surface appears. Arithmetic processing unit.
幾何演算を処理する演算処理装置であって、
三次元直交座標系において定義された多角形状のグラフィック要素の各頂点座標を二次元直交座標系に投影する投影手段と、
前記投影後の頂点座標の座標軸成分の各々に所定値を加算する加算手段と、
前記加算の結果である座標軸成分からなる頂点座標が所定の範囲内にあるか否かを判定する判定手段と、を備える演算処理装置。
An arithmetic processing device for processing geometric operations,
Projection means for projecting each vertex coordinate of a polygonal graphic element defined in the three-dimensional orthogonal coordinate system to the two-dimensional orthogonal coordinate system;
Adding means for adding a predetermined value to each of the coordinate axis components of the projected vertex coordinates;
And a determination unit that determines whether or not a vertex coordinate composed of a coordinate axis component as a result of the addition is within a predetermined range.
前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定するカリング手段をさらに備える請求項18記載の演算処理装置。   A value outside the drawing range is set to all the vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element including the vertex where the vertex coordinate consisting of the coordinate axis component as a result of the addition is determined to be outside the predetermined range. The arithmetic processing device according to claim 18, further comprising culling means. 前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くカリング手段をさらに備える請求項18記載の演算処理装置。   19. A culling unit that removes data defining a polygonal graphic element including a vertex whose vertex coordinate, which is a coordinate axis component as a result of the addition, is determined to be out of a predetermined range, from the drawing data string. Arithmetic processing unit. 前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素の前記二次元直交座標系における全頂点座標に描画範囲外の値を設定することができる第1のカリング手段と、
前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された頂点を含む前記多角形状のグラフィック要素を定義するデータを描画用データ列から取り除くことができる第2のカリング手段と、
前記加算の結果である座標軸成分からなる頂点座標が所定の範囲外と判定された場合の処理を実行する手段として、前記第1のカリング手段あるいは前記第2のカリング手段のいずれかを選択する選択手段と、をさらに備える請求項18記載の演算処理装置。
A value outside the drawing range is set to all the vertex coordinates in the two-dimensional orthogonal coordinate system of the polygonal graphic element including the vertex where the vertex coordinate consisting of the coordinate axis component as a result of the addition is determined to be outside the predetermined range. A first culling means capable of:
Second culling means capable of removing, from the drawing data string, data defining the polygonal graphic element including a vertex whose vertex coordinate consisting of the coordinate axis component as a result of the addition is determined to be outside a predetermined range; ,
Selection for selecting either the first culling means or the second culling means as means for executing processing when it is determined that the vertex coordinate composed of the coordinate axis component as a result of the addition is out of a predetermined range The arithmetic processing apparatus according to claim 18, further comprising means.
前記加算手段が使用する前記所定値を保持する所定値保持手段をさらに備え、
前記所定値保持手段は、前記演算処理装置の外部からアクセス可能であり、外部からリード及びライトすることができる、請求項18から21記載の演算処理装置。
A predetermined value holding means for holding the predetermined value used by the adding means;
The arithmetic processing unit according to claim 18, wherein the predetermined value holding unit is accessible from outside the arithmetic processing unit, and can be read and written from the outside.
JP2005318754A 2005-11-01 2005-11-01 Arithmetic processing unit Withdrawn JP2007128180A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2005318754A JP2007128180A (en) 2005-11-01 2005-11-01 Arithmetic processing unit
PCT/JP2006/321815 WO2007052682A1 (en) 2005-11-01 2006-10-25 Arithmetic processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005318754A JP2007128180A (en) 2005-11-01 2005-11-01 Arithmetic processing unit

Publications (1)

Publication Number Publication Date
JP2007128180A true JP2007128180A (en) 2007-05-24

Family

ID=38005835

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005318754A Withdrawn JP2007128180A (en) 2005-11-01 2005-11-01 Arithmetic processing unit

Country Status (2)

Country Link
JP (1) JP2007128180A (en)
WO (1) WO2007052682A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013539136A (en) * 2010-09-28 2013-10-17 インテル コーポレイション Backface culling for motion blur and depth of field
JP2014127776A (en) * 2012-12-25 2014-07-07 Ricoh Co Ltd Image processing device, image processing method, and program

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5274298B2 (en) * 2009-02-20 2013-08-28 任天堂株式会社 Drawing processing apparatus and drawing processing program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3649478B2 (en) * 1995-07-20 2005-05-18 株式会社ソニー・コンピュータエンタテインメント Image information processing apparatus and image information processing method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013539136A (en) * 2010-09-28 2013-10-17 インテル コーポレイション Backface culling for motion blur and depth of field
JP2014127776A (en) * 2012-12-25 2014-07-07 Ricoh Co Ltd Image processing device, image processing method, and program

Also Published As

Publication number Publication date
WO2007052682A1 (en) 2007-05-10

Similar Documents

Publication Publication Date Title
US5268995A (en) Method for executing graphics Z-compare and pixel merge instructions in a data processor
JP4731028B2 (en) Recirculating shade tree blender for graphics systems
US6417858B1 (en) Processor for geometry transformations and lighting calculations
US7307638B2 (en) Method and apparatus for interleaved processing of direct and indirect texture coordinates in a graphics system
US7755626B2 (en) Cone-culled soft shadows
JP5061273B2 (en) Image generation device, texture mapping device, image processing device, and texture storage method
KR19990072375A (en) Rapid computation of local eye vectors in a fixed point lighting unit
JP2011159306A (en) Drawing apparatus
WO1996027168A1 (en) Data processor and shading device
US6219062B1 (en) Three-dimensional graphic display device
KR910009102B1 (en) Image synthesizing apparatus
US20030160799A1 (en) Reconfigurable hardware filter for texture mapping and image processing
JP2007128180A (en) Arithmetic processing unit
JPH0935084A (en) Image information processor and image information processing method
US6333742B1 (en) Spotlight characteristic forming method and image processor using the same
US6847378B2 (en) System and method for performing scale and bias operations by preclamping input image data
JP2003233830A (en) Picture generating device and method
JPH06266852A (en) Picture synthesizing device
JPWO2007052420A1 (en) Image generation device
JPH04315275A (en) Method for performing saturation operation in computer graphic with data processor
US20030169279A1 (en) Reconfigurable pixel computation unit
JPH11328438A (en) Method and device for high-efficiency floating-point z buffering
JP4483026B2 (en) Graphic information conversion apparatus, graphic information conversion method, and recording medium
JP3358891B2 (en) Z-value perspective transformation processing method and image processing apparatus
JPH06203177A (en) Image data processing method and device therefor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20081029

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20110630