1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: ut_CmdCache.h 4 5 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain proprietary 8 information of Nintendo and/or its licensed developers and are protected by 9 national and international copyright laws. They may not be disclosed to third 10 parties or copied or duplicated in any form, in whole or in part, without the 11 prior written consent of Nintendo. 12 13 The content herein is highly confidential and should be handled accordingly. 14 15 $Revision: 31311 $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NW_UT_CMDCACHE_H_ 19 #define NW_UT_CMDCACHE_H_ 20 21 #include <GLES2/gl2.h> 22 #include <nn/gx.h> 23 24 namespace nw { 25 namespace ut { 26 namespace internal { 27 28 //! :private 29 //! @brief コマンドキャッシュクラスです。 30 class CmdCache 31 { 32 public: 33 CmdCache(); 34 35 void Init( 36 void* buffer, 37 u32 size, 38 bool isCopy = true); 39 40 void Use() const; 41 42 void Add( 43 const u32* command, 44 u32 size); 45 46 void RoundUp(u8 align); 47 Clear()48 void Clear() { m_CmdBufferSize = 0; } 49 GetAddr()50 void* GetAddr() const { return m_CmdBuffer; } 51 GetSize()52 GLsizei GetSize() const { return m_CmdBufferSize; } 53 54 void Dump( 55 bool asF32 = false, 56 bool showMnemonic = false 57 ) const 58 #if defined(NW_RELEASE) 59 { 60 (void)asF32; 61 (void)showMnemonic; 62 } 63 #else 64 ; 65 #endif 66 67 static void Dump( 68 const void* from, 69 const void* to, 70 bool asF32 = false, 71 bool showMnemonic = false 72 ) 73 #if defined(NW_RELEASE) 74 { 75 (void)from; 76 (void)to; 77 (void)asF32; 78 (void)showMnemonic; 79 } 80 #else 81 ; 82 #endif 83 84 private: 85 static void DumpCommon( 86 const void* from, 87 const void* to, 88 bool asF32, 89 bool showMnemonic 90 ); 91 92 u8* m_CmdBuffer; 93 GLsizei m_CmdBufferSize; 94 GLsizei m_CmdMaxBufferSize; 95 96 bool m_IsCopy; 97 }; 98 99 } // namespace internal 100 } // namespace ut 101 } // namespace nw 102 103 #endif // NW_UT_CMDCACHE_H_ 104