1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     font_CmdCache.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  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   $Revision: 25674 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_FONT_CTR_FONT_CMD_CACHE_H_
17 #define NN_FONT_CTR_FONT_CMD_CACHE_H_
18 
19 #include <GLES2/gl2.h>
20 #include <nn/gx.h>
21 
22 namespace nn {
23 namespace font {
24 namespace CTR {
25 
26 //! :private
27 //! @brief コマンドキャッシュクラスです。
28 class CmdCache
29 {
30 public:
31                         CmdCache();
32 
33                         ~CmdCache();
34 
35     void                Gen(
36                             GLuint  size,
37                             bool    isUseDrawElements);
38 
39     void                Delete();
40 
41     GLuint              Start(
42                             bool    clear           = true
43                         );
44 
45     void                Stop(
46                             GLuint  cmdListId,
47                             u32     validateMask,
48                             bool    isCopy          = true
49                         );
50 
51     void                Use() const;
52 
53     void                Add(
54                             const u32*  command,
55                             u32         size);
56 
GetAddr()57     GLubyte*            GetAddr() const     { return m_CmdBuffer; }
58 
GetSize()59     GLsizei             GetSize() const     { return m_CmdBufferSize; }
60 
61     void                Dump(
62                             bool    asF32           = false,
63                             bool    showMnemonic    = false
64                         ) const
65 #if !defined(NN_BUILD_NOOPT) && !defined(NN_BUILD_VERBOSE)
66     {
67         (void)asF32;
68         (void)showMnemonic;
69     }
70 #else
71     ;
72 #endif
73 
74     static void         Dump(
75                             const void* from,
76                             const void* to,
77                             bool    asF32           = false,
78                             bool    showMnemonic    = false
79                         )
80 #if !defined(NN_BUILD_NOOPT) && !defined(NN_BUILD_VERBOSE)
81     {
82         (void)from;
83         (void)to;
84         (void)asF32;
85         (void)showMnemonic;
86     }
87 #else
88     ;
89 #endif
90 
91 private:
92     static void         DumpCommon(
93                             const void* from,
94                             const void* to,
95                             bool asF32,
96                             bool showMnemonic
97                         );
98 
99     GLuint              m_CmdListID;
100     GLubyte*            m_CmdBuffer;
101     GLsizei             m_CmdBufferSize;
102     GLsizei             m_CmdMaxBufferSize;
103 
104     GLuint              m_RequestId;
105     GLsizei             m_RequestSize;
106     bool                m_IsCopy;
107     bool                m_IsUseDrawElements;
108     NN_PADDING2;
109 };
110 
111 }   // namespace CTR
112 }   // namespace font
113 }   // namespace nn
114 
115 #endif //  NN_FONT_CTR_FONT_CMD_CACHE_H_
116