1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: gr_FrameBuffer.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: 33431 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_GR_FRAME_BUFFER_H_ 17 #define NN_GR_FRAME_BUFFER_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 /* Please see man pages for details 29 30 */ 31 class FrameBuffer 32 { 33 public : 34 static const u32 COLOR_BUFFER_BIT = 0x1; // 35 static const u32 DEPTH_BUFFER_BIT = 0x2; // 36 static const u32 STENCIL_BUFFER_BIT = 0x4; // 37 static const u32 DEPTH_STENCIL_BUFFER_BIT = DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT; // 38 39 /* Please see man pages for details 40 41 */ 42 enum BlockSize 43 { 44 /* Please see man pages for details 45 46 */ 47 BLOCK_SIZE8, 48 49 /* Please see man pages for details 50 51 52 */ 53 BLOCK_SIZE32 54 }; 55 56 /* Please see man pages for details 57 58 */ 59 class ColorBuffer 60 { 61 public : 62 /* Please see man pages for details 63 64 */ 65 uptr virtualAddr; 66 67 /* Please see man pages for details 68 69 */ 70 PicaDataColor format; 71 72 /* Please see man pages for details 73 74 */ 75 BlockSize blockSize; 76 NN_PADDING2; 77 78 /* Please see man pages for details 79 80 */ 81 s32 width; 82 83 /* Please see man pages for details 84 85 */ 86 s32 height; 87 88 /* Please see man pages for details 89 90 91 */ 92 f32 clearColor[ 4 ]; 93 94 public : 95 /* Please see man pages for details 96 97 98 99 */ 100 explicit ColorBuffer( const FrameBuffer& frameBuffer_ ); 101 102 /* Please see man pages for details 103 104 105 106 107 108 */ 109 bit32* MakeCommand( bit32* command ) const; 110 111 protected : 112 const FrameBuffer& m_FrameBuffer; 113 }; 114 115 /* Please see man pages for details 116 117 */ 118 class DepthStencilBuffer 119 { 120 public : 121 /* Please see man pages for details 122 123 */ 124 uptr virtualAddr; 125 126 /* Please see man pages for details 127 128 */ 129 PicaDataDepth format; 130 NN_PADDING3; 131 132 /* Please see man pages for details 133 134 */ 135 s32 width; 136 137 /* Please see man pages for details 138 139 */ 140 s32 height; 141 142 /* Please see man pages for details 143 144 145 146 */ 147 f32 clearDepth; 148 149 /* Please see man pages for details 150 151 152 153 */ 154 u8 clearStencil; 155 NN_PADDING3; 156 157 public : 158 /* Please see man pages for details 159 160 161 162 */ 163 explicit DepthStencilBuffer( const FrameBuffer& frameBuffer_ ); 164 165 /* Please see man pages for details 166 167 168 169 170 171 */ 172 bit32* MakeCommand( bit32* command ) const; 173 174 protected : 175 const FrameBuffer& m_FrameBuffer; 176 }; 177 178 public : 179 /* Please see man pages for details 180 181 182 */ 183 ColorBuffer colorBuffer; 184 185 /* Please see man pages for details 186 187 188 */ 189 DepthStencilBuffer depthStencilBuffer; 190 191 /* Please see man pages for details 192 193 */ 194 s32 width; 195 196 /* Please see man pages for details 197 198 */ 199 s32 height; 200 201 public : 202 /* Please see man pages for details 203 204 205 206 207 */ 208 explicit FrameBuffer(); 209 210 /* Please see man pages for details 211 212 213 214 215 216 217 */ 218 static bit32* MakeClearCacheCommand( bit32* command ); 219 220 /* Please see man pages for details 221 222 223 224 225 226 227 228 229 230 231 */ 232 bit32* MakeCommand( bit32* command, const u32 bufferBit, bool isClearCache = true ) const; 233 234 /* Please see man pages for details 235 236 237 238 239 240 241 */ 242 void MakeClearRequest( const u32 bufferBit, bool isAddSplitDrawCmdlist = true ); 243 }; 244 245 } // namespace CTR 246 } // namespace gr 247 } // namespace nn 248 249 #endif // NN_GR_FRAME_BUFFER_H_ 250