1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gr_RenderState.h
4 
5   Copyright (C)2010 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 33699 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GR_RENDER_STATE_H_
17 #define NN_GR_RENDER_STATE_H_
18 
19 #include <nn/gr/CTR/gr_Prefix.h>
20 
21 namespace nn
22 {
23     namespace gr
24     {
25         namespace CTR
26         {
27 
28             /*!
29                 @brief レンダーステート設定のためのクラスです。
30              */
31             class RenderState
32             {
33             public :
34                 /*!
35                     @brief カラーマスク設定のための定義です。
36                  */
37                 enum ColorMask
38                 {
39                     //! 赤成分を表します。
40                     COLOR_MASK_R    = 1 << 0,
41                     //! 緑成分を表します。
42                     COLOR_MASK_G    = 1 << 1,
43                     //! 青成分を表します。
44                     COLOR_MASK_B    = 1 << 2,
45                     //! アルファ成分を表します。
46                     COLOR_MASK_A    = 1 << 3,
47                     //! すべての成分を表します。
48                     COLOR_MASK_RGBA = COLOR_MASK_R | COLOR_MASK_G | COLOR_MASK_B | COLOR_MASK_A
49                 };
50 
51                 /*!
52                     @brief アルファテスト設定のためのクラスです。
53                  */
54                 /*
55                     各値を設定し、 MakeCommand()を呼ぶことで、描画コマンドを生成することができます。
56                 */
57                 class AlphaTest
58                 {
59                 public :
60                     /*!
61                         @brief アルファテストの有効/無効の設定です。
62                                型は bool です。
63                                無効化されている場合は、必ずパスします。
64                                初期値はfalse(無効)です。
65                      */
66                     bool isEnable;
67 
68                     /*!
69                         @brief アルファテストで参照する定数を設定します。
70                                型は u8 です。
71                                ユニフォーム値[0.f, 1.f]を[0, 255]の8ビットの整数にマップした値を設定します。
72                                初期値は0です。
73                      */
74                     u8 refValue;
75 
76                     /*!
77                         @brief アルファテストで使用される比較方法を設定します。
78                                型は @ref PicaDataAlphaTest です。
79                                初期値は、PICA_DATA_ALPHA_TEST_ALWAYSです。
80                     */
81                     PicaDataAlphaTest func;
82 
83                     NN_PADDING1;
84 
85                 public :
86                     /*!
87                         @brief アルファテスト設定の初期値で初期化します。
88 
89                         @param[in] renderState_ レンダーステートです。
90                      */
91                     explicit AlphaTest( const RenderState& renderState_ );
92 
93                     /*!
94                         @brief 設定された情報をもとに、描画コマンドを生成します。
95 
96                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
97                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します
98 
99                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
100                      */
101                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
102 
103 
104                     /*!
105                         @brief 無効化するコマンドを生成します。
106 
107                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
108                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
109 
110                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
111                      */
112                     static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
113 
114                 protected:
115                     const RenderState& m_RenderState;
116                 };
117 
118                 /*!
119                     @brief ブレンド設定のためのクラスです。
120                            各値を設定し、 MakeCommand()を呼ぶことで、描画コマンドを生成することができます。
121                            レジスタを共有しているため、論理演算設定と同時に使用することはできません。
122                 */
123                 class Blend
124                 {
125                 public :
126                     /*!
127                         @brief ブレンドの有効/無効の設定です。
128                                型は bool です。初期値はfalse(無効)です。
129                      */
130                     bool isEnable;
131 
132                     /*!
133                         @brief RGB成分のブレンド方程式の設定です。型は @ref PicaDataBlendEquation です。
134                              初期値は PICA_DATA_BLEND_EQUATION_ADD です。
135                     */
136                     PicaDataBlendEquation eqRgb;
137 
138 
139                     /*!
140                         @brief アルファ成分のブレンド関数の設定です。型は @ref PicaDataBlendEquation です。
141                                初期値はPICA_DATA_BLEND_EQUATION_ADDです。
142                     */
143                     PicaDataBlendEquation eqAlpha;
144 
145                     /*!
146                         @brief ブレンドのRGB成分のソースの設定です。
147                                型は @ref PicaDataBlendFunc です。
148                                初期値はPICA_DATA_BLEND_FUNC_SRC_ALPHAです。
149                     */
150                     PicaDataBlendFunc srcRgb;
151 
152                     /*!
153                         @brief ブレンドの Alpha 成分のソースの設定です。
154                                型は @ref PicaDataBlendFunc です。
155                                初期値は PICA_DATA_BLEND_FUNC_SRC_ALPHA です。
156                     */
157                     PicaDataBlendFunc srcAlpha;
158 
159 
160                     /*!
161                         @brief ブレンドのRGB成分のデスティネーションの設定です。
162                                型は @ref PicaDataBlendFunc です。
163                                初期値は PICA_DATA_BLEND_FUNC_ONE_MINUS_SRC_ALPHA です。
164                     */
165                     PicaDataBlendFunc dstRgb;
166 
167                     /*!
168                         @brief ブレンドのALPHA成分のデスティネーションの設定です。
169                                型は @ref PicaDataBlendFunc です。
170                             初期値は PICA_DATA_BLEND_FUNC_ONE_MINUS_SRC_ALPHA です。
171                     */
172                     PicaDataBlendFunc dstAlpha;
173 
174 
175                     /*!
176                         @brief ブレンドのコンスタントカラーの赤成分の設定です。
177                                型は u8 です。
178                                [0,255]の範囲で指定します。初期値は255です。
179                     */
180                     u8 colorR;
181 
182 
183                     /*!
184                         @brief ブレンドのコンスタントカラーの緑成分の設定です。
185                                型は u8 です。
186                                [0,255]の範囲で指定します。初期値は255です。
187                     */
188                     u8 colorG;
189 
190 
191                     /*!
192                         @brief ブレンドのコンスタントカラーの青成分の設定です。
193                                型は u8 です。
194                                [0,255]の範囲で指定します。初期値は255です。
195                     */
196                     u8 colorB;
197 
198 
199                     /*!
200                         @brief ブレンドのコンスタントカラーのアルファ成分の設定です。
201                         型は u8 です。[0,255]の範囲で指定します。初期値は255です。
202                     */
203                     u8 colorA;
204 
205                     NN_PADDING1;
206 
207                 public :
208                     /*!
209                         @brief ブレンド設定の初期値で初期化します。
210 
211                         @param[in] renderState_ レンダーステートです。
212                      */
213                     explicit Blend( const RenderState& renderState_ );
214 
215 
216                     /*!
217                         @brief 設定された情報をもとに、描画コマンドを生成します。
218 
219                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
220                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します
221 
222                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
223                      */
224                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
225 
226                     /*!
227                         @brief ブレンドを無効化します。
228 
229                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
230                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
231 
232                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
233                      */
234                     static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
235 
236                 protected:
237                     const RenderState& m_RenderState;
238 
239                 };
240 
241                 /*!
242                     @brief 論理演算設定のためのクラスです。
243                            各値を設定し、 MakeCommand()を呼ぶことで、描画コマンドを生成することができます。
244                            レジスタを共有しているため、ブレンド設定と同時に使用することはできません。
245                 */
246                 class LogicOp
247                 {
248                 public :
249                     /*!
250                         @brief 論理演算の有効/無効の設定です。型は bool です。初期値はfalse(無効)です。
251                      */
252                     bool isEnable;
253 
254                     /*!
255                         @brief 論理演算の設定です。
256                         型は @ref PicaDataLogicOp です。
257                         初期値は PICA_DATA_LOGIC_NOOPです。
258                     */
259                     PicaDataLogicOp opCode;
260 
261                     NN_PADDING2;
262 
263                 public :
264                     /*!
265                         @brief 論理演算設定の初期値で初期化します。
266 
267                         @param[in] renderState_ レンダーステートです。
268                      */
269                     explicit LogicOp( const RenderState& renderState_ );
270 
271                     /*!
272                         @brief 設定された情報をもとに、描画コマンドを生成します。
273 
274                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
275                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します
276 
277                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
278                      */
279                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
280 
281                 protected:
282                     const RenderState& m_RenderState;
283                 };
284 
285                 /*!
286                     @brief ステンシルテスト設定のためのクラスです。
287                  */
288                 class StencilTest
289                 {
290                 public :
291                     /*!
292                         @brief ステンシルテストの有効/無効の設定です。無効化されている場合は、必ずパスします。初期値はfalse(無効)です。
293                      */
294                     bool isEnable;
295 
296                     /*!
297                         @brief ステンシルバッファへのマスクの設定です。
298                                型は bit8 です。初期値は 0 です。glStencilMask( mask ) に相当します
299 
300                      */
301                     bit8 maskOp;
302                     NN_PADDING2;
303 
304                     /*!
305                         @brief ステンシルテストに使用される比較関数の設定です。
306                                型は @ref PicaDataStencilTest です。
307                                初期値は、PICA_DATA_STENCIL_TEST_ALWAYSです。
308                                glStencilFunc( func, ref, mask ) の ref に相当します。
309                     */
310                     PicaDataStencilTest func;
311                     NN_PADDING3;
312 
313 
314                     /*!
315                         @brief ステンシルテストに使用される参照値の設定です。
316                                型は bit32 です。初期値は、0です。
317                     */
318                     bit32  ref;
319 
320 
321                     /*!
322                         @brief ステンシルテストに使用されるマスク値の設定です。
323                                型は bit32 です。初期値は、0xffです。
324                                glStencilFunc( func, ref, mask ) の mask に相当します。
325                     */
326                     /*
327                         ステンシルバッファの値をstencilとすると、
328                         ( stencil & mask )と( ref & mask )との間で比較がおこなわれます。
329                      */
330                     bit32  mask;
331 
332 
333                     /*!
334                         @brief ステンシルテストがフェイルした場合に適用する、
335                                ステンシルバッファの値の操作を設定します。
336                                型は @ref PicaDataStencilOp です。
337                                初期値は、PICA_DATA_STENCIL_OP_KEEPです。
338                                glStencilFunc( func, ref, mask ) の func に相当します。
339                     */
340                     PicaDataStencilOp opFail;
341 
342 
343                     /*!
344                         @brief ステンシルテストにパスし、
345                                デプステストにフェイルした場合に適用する、
346                                ステンシルバッファの値の操作を設定します。
347                                型は @ref PicaDataStencilOp です。
348                                初期値は、PICA_DATA_STENCIL_OP_KEEPです。
349                     */
350                     PicaDataStencilOp  opZFail;
351 
352 
353                     /*!
354                             @brief ステンシルテストとデプステストの両方にパスした場合に適用する、
355                                    ステンシルバッファの値の操作を設定します。
356                                    型は @ref PicaDataStencilOp です。
357                                    初期値は、PICA_DATA_STENCIL_OP_KEEPです。
358                     */
359                     PicaDataStencilOp  opZPass;
360 
361                     NN_PADDING1;
362 
363                 public :
364                     /*!
365                         @brief ステンシルテスト設定の初期値で初期化します。
366 
367                         @param[in] renderState_ レンダーステートです。
368                      */
369                     explicit StencilTest( const RenderState& renderState_ );
370 
371                     /*!
372                         @brief 設定された情報をもとに、描画コマンドを生成します。
373 
374                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
375                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します
376 
377                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
378                      */
379                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
380 
381                     /*!
382                         @brief ステンシルテストを無効化するコマンドを生成します。
383 
384                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
385                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
386 
387                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
388                      */
389                     static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
390 
391                 protected:
392                     const RenderState& m_RenderState;
393                 };
394 
395                 /*!
396                     @brief デプステスト設定のためのクラスです。
397                  */
398                 class DepthTest
399                 {
400                 public :
401 
402                     /*!
403                         @brief デプステストの有効/無効の設定です。
404                                型は bool です。
405                                無効化されている場合は、必ずパスします。
406                                初期値はtrue(有効)です。
407                      */
408                     bool             isEnable;
409 
410 
411                     /*!
412                         @brief デプスバッファへの書き込みの有効/無効の設定です。
413                                型は bool です。
414                                初期値はtrue(有効)です。
415                      */
416                     bool             isEnableWrite;
417 
418                     /*!
419                         @brief デプステストに使用される比較関数の設定です。
420                                型は @ref PicaDataDepthTest です。
421                                初期値は PICA_DATA_DEPTH_TEST_LESS です。
422                     */
423                     PicaDataDepthTest func;
424 
425                     NN_PADDING1;
426 
427                 public :
428                     /*!
429                         @brief デプステスト設定の初期値で初期化します。
430 
431                         @param[in] renderState_ レンダーステートです。
432                      */
433                     explicit DepthTest( const RenderState& renderState_ );
434 
435 
436                     /*!
437                         @brief 設定された情報をもとに、描画コマンドを生成します。
438                                生成される描画コマンドの中には、カラーマスクの設定も含まれますので、
439                                注意してください。
440 
441                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。型は bit32* です。
442                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します。型は bool です。
443 
444                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
445                      */
446                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
447 
448                     /*!
449                         @brief デプステストを無効化します。
450                                またカラーマスクは全て true に設定しますので、注意してください。
451 
452                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。型は bit32* です。
453                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
454 
455                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
456                      */
457                     static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
458 
459                 protected:
460                     const RenderState& m_RenderState;
461                 };
462 
463                 /*!
464                     @brief wバッファ設定のためのクラスです。
465                  */
466                 class WBuffer
467                 {
468                 public :
469 
470                     /*!
471                         @brief wバッファ有効時のスケール値です。型は f32 です。
472                                wScaleが0のとき、wバッファは無効になります。初期値は0です。
473                      */
474                     f32 wScale;
475 
476                     /*!
477                         @brief ポリゴンオフセットの有効/無効の設定です。型は bool です。
478                                一応、wバッファと同時に使用することができます。
479                      */
480                     bool isEnablePolygonOffset;
481 
482                     NN_PADDING3;
483 
484                     /*!
485                         @brief デプス値の分解可能最小値に対するスケール値の設定です。
486                                型は f32 です。
487                                デプス値の分解可能最小値は、デプスバッファのビット値に依存します。
488                                初期値は0です。
489                                wバッファが有効でかつデプスバッファが 24 bit のとき、
490                                精度誤差で消えてしまうの防ぐために
491                                ポリゴンオフセットに定数値をかけています。
492 
493                         @see depthRangeBit;
494                      */
495 
496                     f32  polygonOffsetUnit;
497 
498                     /*!
499                         @brief クリップ空間におけるNear平面のdepth値の設定です。
500                                型は f32 です。
501                                初期値は0です。
502                                0 <= depthRangeNear <= depthRangeFar <= 1となるように設定します。
503                                wバッファを有効にしている場合は設定を無視して0が設定されます。
504                      */
505                     f32  depthRangeNear;
506 
507                     /*!
508                         @brief クリップ空間におけるFar平面のdepth値の設定です。
509                                型は f32 です。
510                                初期値は1です。
511                                0 <= depthRangeNear <= depthRangeFar <= 1となるように設定します。
512                                wバッファを有効にしている場合は設定を無視して1が設定されます。
513                      */
514                     f32  depthRangeFar;
515 
516                     /*!
517                         @brief デブスバッファのビット値を指定します。
518                                型は f32 です。
519                                初期値は24です。
520                      */
521                     u8   depthRangeBit;
522 
523                     NN_PADDING3;
524 
525                 public :
526                     /*!
527                         @brief wバッファ設定の初期値で初期化します。
528 
529                         @param[in] renderState_ レンダーステートです。
530                      */
531                     explicit WBuffer( const RenderState& renderState_ );
532 
533                     /*!
534                         @brief 設定された情報をもとに、描画コマンドを生成します。
535 
536                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
537                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します。
538 
539                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
540                      */
541                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
542 
543                 protected:
544                     const RenderState& m_RenderState;
545                 };
546 
547                 /*!
548                     @brief カリング設定のためのクラスです。
549                  */
550                 class Culling
551                 {
552                 public :
553                     /*!
554                         @brief カリングの有効/無効の設定です。
555                                型は bool です。
556                                無効化されている場合は、両面ポリゴンが描画されます。
557                                初期値はtrue(有効)です。
558                      */
559                     bool isEnable;
560 
561                     /*!
562                         @brief ポリゴン面の表の向きをあらわします。
563                      */
564                     enum FrontFace
565                     {
566                         /*!
567                             @brief 頂点が時計回りに配置されている場合を表とします。
568                         */
569                         FRONT_FACE_CW ,
570 
571                         /*!
572                             @brief 頂点が反時計回りに配置されている場合を表とします。
573                         */
574                         FRONT_FACE_CCW
575                     };
576 
577                     /*!
578                         @brief ポリゴン面の表の向きを設定します。
579                                型は nn:gr::CTR::RenderState::Culling::FrontFace です。
580                                初期値は FRONT_FACE_CCW(反時計回り)です。
581                      */
582                     FrontFace frontFace;
583 
584                     /*!
585                         @brief カリングするポリゴン面をあらわします。
586                      */
587                     enum CullFace
588                     {
589                         /*!
590                             @brief 表面をカリングします。
591                         */
592                         CULL_FACE_FRONT,
593                          /*!
594                             @brief 裏面をカリングします。
595                         */
596                         CULL_FACE_BACK
597                     };
598 
599                     /*!
600                         @brief カリングするポリゴン面を設定します。
601                                型は nn:gr::CTR::RenderState::Culling::CullFace です。
602                                初期値は CULL_FACE_BACK です。
603                      */
604                     CullFace cullFace;
605 
606                     NN_PADDING1;
607 
608                 public :
609                     /*!
610                         @brief カリング設定の初期値で初期化します。
611 
612                         @param[in] renderState_ レンダーステートです。
613                      */
614                     explicit Culling( const RenderState& renderState_ );
615 
616 
617                     /*!
618                         @brief 設定された情報をもとに、描画コマンドを生成します。
619 
620                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
621                         @param[in] isUpdateFBAccess フレームバッファアクセスを更新します
622                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
623                      */
624                     bit32* MakeCommand( bit32* command, bool isUpdateFBAccess = true ) const;
625 
626                     /*!
627                         @brief カリングを無効化します。
628 
629                         @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
630                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
631 
632                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
633                      */
634                     static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
635 
636                 protected:
637                     const RenderState& m_RenderState;
638                 };
639 
640                 /*!
641                     @brief フレームバッファアクセスの設定のためのクラスです。
642                 */
643                 /*
644                     フレームバッファアクセスの設定は、カラーマスク、ブレンド、論理演算、デプステスト、ステンシルテストの設定
645                     に依存するので、コンストラクタで参照を指定します。
646                     上記の設定を変えるコマンドを生成した後で、
647                     フレームバッファアクセスに変更が生じる場合は、
648                     FBAccess::MakeCommand()によりコマンドを生成する必要があります。
649                 */
650                 class FBAccess
651                 {
652                 public :
653                     /*!
654                         @brief フレームバッファアクセスの設定は、カラーマスク、ブレンド、論理演算、デプステスト、ステンシルテストの設定
655                                に依存するので、コンストラクタで参照を指定します。
656 
657                         @param[in] renderState_ レンダーステートです。
658                      */
659                     explicit FBAccess( const RenderState& renderState_ );
660 
661                     /*!
662                         @brief 各種の設定された情報をもとに、描画コマンドを生成します。
663 
664                         @param[in] command                    描画コマンドの書き込み先の先頭アドレスです。
665                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
666 
667                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
668                      */
669                     bit32* MakeCommand( bit32* command, bool isClearFrameBufferCache = true ) const;
670 
671                     /*!
672                         @brief 無効化するコマンドを生成します.
673 
674                         @param[in] command                    描画コマンドの書き込み先の先頭アドレスです。
675                         @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
676 
677                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
678                      */
679                     static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
680 
681                     /*!
682                         @brief フレームバッファのキャッシュフラッシュをするコマンドを生成します.
683 
684                         @param[in] command                    描画コマンドの書き込み先の先頭アドレスです。
685 
686                         @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
687                      */
688                     static bit32* MakeClearCacheCommand( bit32* command );
689 
690                 protected:
691                     const RenderState& m_RenderState;
692                 };
693 
694             public :
695                 /*!
696                     @brief ブレンド設定です。
697                            型は nn::gr::CTR::RenderState::Blend です。
698                  */
699                 Blend       blend;
700 
701                 /*!
702                     @brief 論理演算設定です。
703                            型は nn::gr::CTR::RenderState::LogicOp です。
704                  */
705                 LogicOp     logicOp;
706 
707                 /*!
708                     @brief アルファテスト設定です。
709                            型は nn::gr::CTR::RenderState::AlphaTest です。
710                  */
711                 AlphaTest   alphaTest;
712 
713                 /*!
714                     @brief ステンシルテスト設定です。
715                            型は nn::gr::CTR::RenderState::StencilTest です。
716                  */
717                 StencilTest stencilTest;
718 
719                 /*!
720                     @brief カラーマスク設定です。
721                            型は nn::gr::CTR::RenderState::ColorMask です。
722                  */
723                 ColorMask   colorMask;
724                 NN_PADDING3;
725 
726                 /*!
727                     @brief デプステスト設定です。
728                            型は nn::gr::CTR::RenderState::DepthTest です。
729 
730                     @ref  RenderState::DepthTest
731                  */
732                 DepthTest   depthTest;
733 
734                 /*!
735                     @brief カリング設定です。
736                            型は nn::gr::CTR::RenderState::Culling です。
737 
738                     @ref   RenderState::Culling
739                  */
740                 Culling     cullingTest;
741 
742                 /*!
743                     @brief wバッファ設定です。
744                            型は nn::gr::CTR::RenderState::WBuffer です。
745 
746                     @ref   RenderState::WBuffer
747                  */
748                 WBuffer     wBuffer;
749 
750                 /*!
751                     @brief フレームバッファアクセス設定です。
752                            型は nn::gr::CTR::RenderState::FBAccess です。
753 
754                  */
755                 FBAccess    fbAccess;
756 
757             public :
758                 /*!
759                     @brief レンダーステートの各々の設定を、初期値で初期化します。
760 
761                     @see RenderState::Culling、
762                          RenderState::Blend、
763                          RenderState::LogicOp、
764                          RenderState::AlphaTest、
765                          RenderState::StencilTest、
766                          RenderState::DepthTest、
767                          RenderState::WBuffer、
768                          RenderState::FBAccess
769                  */
770                 explicit RenderState();
771 
772                 /*!
773                     @brief 設定された情報をもとに、すべてのレンダーステートの設定コマンドを生成します。
774 
775                     @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
776                     @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
777 
778                     @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
779 
780                     @see RenderState::Culling::MakeCommand()、
781                          RenderState::Blend::MakeCommand()、
782                          RenderState::LogicOp::MakeCommand()、
783                          RenderState::AlphaTest::MakeCommand()、
784                          RenderState::StencilTest::MakeCommand()、
785                          RenderState::DepthTest::MakeCommand()、
786                          RenderState::WBuffer::MakeCommand()、
787                          RenderState::FBAccess::MakeCommand()
788                  */
789                 bit32* MakeCommand( bit32* command, bool isClearFrameBufferCache = true ) const;
790 
791                 /*!
792                     @brief レンダーステートを無効化するコマンドを生成します。
793 
794                     @param[in] command 描画コマンドの書き込み先の先頭アドレスです。
795                     @param[in] isClearFrameBufferCache    フレームバッファのキャッシュフラッシュを行います。
796 
797                     @return    書き込まれた描画コマンドの終端の次のアドレスを返します。
798                  */
799                 static bit32* MakeDisableCommand( bit32* command, bool isClearFrameBufferCache = true );
800             };
801 
802         } // namespace CTR
803     } // namespace gr
804 } // namespace nn
805 
806 #endif // NN_GR_RENDER_STATE_H_
807