1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: gr_Combiner.h 4 5 Copyright (C)2009-2012 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: 47511 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_GR_CTR_GR_COMBINER_H_ 17 #define NN_GR_CTR_GR_COMBINER_H_ 18 19 #include <nn/gr/CTR/gr_Utility.h> 20 21 namespace nn 22 { 23 namespace gr 24 { 25 namespace CTR 26 { 27 28 /* Please see man pages for details 29 30 */ 31 class Combiner 32 { 33 public : 34 /* Please see man pages for details 35 36 */ 37 class Stage 38 { 39 public : 40 /* Please see man pages for details 41 42 */ 43 struct CombineFunction 44 { 45 /* Please see man pages for details 46 47 48 49 50 51 */ 52 PicaDataTexEnvCombine combine; 53 54 /* Please see man pages for details 55 56 57 58 59 60 61 62 */ 63 PicaDataTexEnvOperand operand[3]; 64 65 /* Please see man pages for details 66 67 68 69 70 71 72 73 74 75 */ 76 PicaDataTexEnvSrc source[3]; 77 78 /* Please see man pages for details 79 80 81 82 83 84 85 */ 86 PicaDataTexEnvScale scale; 87 88 /* Please see man pages for details 89 90 91 92 93 94 95 */ 96 PicaDataTexEnvBufferInput bufferInput; 97 98 /* Please see man pages for details 99 100 101 102 103 */ 104 explicit CombineFunction( const u8 stage_index, bool is_rgb ); 105 106 protected : 107 /* Please see man pages for details 108 109 */ 110 friend class Stage; 111 112 /* Please see man pages for details 113 114 */ CombineFunctionCombineFunction115 explicit CombineFunction(){}; 116 }; 117 118 /* Please see man pages for details 119 120 121 */ 122 CombineFunction rgb; 123 124 /* Please see man pages for details 125 126 127 */ 128 CombineFunction alpha; 129 130 /* Please see man pages for details 131 132 133 */ 134 u8 constColorR; 135 136 /* Please see man pages for details 137 138 139 */ 140 u8 constColorG; 141 142 /* Please see man pages for details 143 144 145 */ 146 u8 constColorB; 147 148 /* Please see man pages for details 149 150 151 */ 152 u8 constColorA; 153 154 /* Please see man pages for details 155 156 157 */ 158 PicaReg headRegister; 159 160 public : 161 /* Please see man pages for details 162 163 */ 164 void SetupPrimary( void ); 165 166 /* Please see man pages for details 167 168 */ 169 void SetupFragmentPrimary( void ); 170 171 /* Please see man pages for details 172 173 */ 174 void SetupTexture0( void ); 175 176 /* Please see man pages for details 177 178 */ 179 void SetupPrevious( void ); 180 181 /* Please see man pages for details 182 183 */ 184 void SetupPrimaryModulateTexture0( void ); 185 186 /* Please see man pages for details 187 188 */ 189 void SetupFragmentPrimaryModulateTexture0( void ); 190 191 /* Please see man pages for details 192 193 194 195 */ 196 explicit Stage( const int stage_index ); 197 198 /* Please see man pages for details 199 200 201 202 203 204 205 206 */ 207 bit32* MakeCommand( bit32* command ) const; 208 209 /* Please see man pages for details 210 211 212 213 214 215 */ MakeConstantColorCommand(bit32 * command)216 bit32* MakeConstantColorCommand( bit32* command ) const 217 { 218 NN_GR_ASSERT( ( PICA_REG_TEX_ENV0 <= headRegister ) && 219 ( PICA_REG_TEX_ENV5 >= headRegister ) ); 220 221 u32 constColorReg = headRegister + 3; 222 223 *command++ = PICA_CMD_DATA_TEX_ENV_CONST( 224 constColorR, constColorG, 225 constColorB, constColorA ); 226 227 *command++ = PICA_CMD_HEADER_SINGLE( constColorReg ); 228 229 return command; 230 } 231 232 protected : 233 /* Please see man pages for details 234 235 */ 236 friend class Combiner; 237 238 /* Please see man pages for details 239 240 */ Stage(void)241 explicit Stage( void ) 242 { 243 }; 244 }; 245 246 public : 247 // 248 static const u32 COMBINER_STAGE_MAX = 6; 249 250 /* Please see man pages for details 251 252 253 254 255 256 */ 257 Stage stage[ COMBINER_STAGE_MAX ]; 258 259 public : 260 /* Please see man pages for details 261 262 263 */ 264 u8 bufferColorR; 265 266 /* Please see man pages for details 267 268 269 */ 270 u8 bufferColorG; 271 272 /* Please see man pages for details 273 274 275 */ 276 u8 bufferColorB; 277 278 /* Please see man pages for details 279 280 281 */ 282 u8 bufferColorA; 283 284 /* Please see man pages for details 285 286 */ 287 explicit Combiner(); 288 289 /* Please see man pages for details 290 291 292 293 294 295 296 297 298 */ 299 bit32* MakeCommand( bit32* command ) const; 300 301 302 /* Please see man pages for details 303 304 305 306 307 308 */ 309 bit32* MakeCombinerBufferCommand( bit32* command ) const; 310 }; 311 312 } // namespace CTR 313 } // namespace gr 314 } // namespace nn 315 316 #endif // NN_GR_CTR_GR_COMBINER_H_ 317