1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gx_CommandAccess.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: 18521 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GX_CTR_GX_COMMAND_ACCESS_H_
17 #define NN_GX_CTR_GX_COMMAND_ACCESS_H_
18 
19 #include <nn/types.h>
20 
21 #include <nn/gx/CTR/gx_MacroReg.h>
22 #include <nn/gx/CTR/gx_MacroCommon.h>
23 #include <nn/gx/CTR/gx_MacroFragment.h>
24 #include <nn/gx/CTR/gx_MacroTexture.h>
25 #include <nn/gx/CTR/gx_MacroShader.h>
26 #include <nn/gx/CTR/gx_MacroMisc.h>
27 #include <nn/gx/CTR/gx_MacroOld.h>
28 
29 /*--------------------------------------------------------------------------
30     C API
31  *-------------------------------------------------------------------------*/
32 /*!
33   @addtogroup  nn_gx    gx
34   @{
35 */
36 
37 #ifdef  __cplusplus
38 extern "C" {
39 #endif // __cplusplus
40 
41     /*!--------------------------------------------------------------------------*
42       :private
43 
44       @brief        仮想アドレスから物理アドレスへの変換を行います。
45 
46                     コマンドリストを直接生成する際に必要となる、
47                     デバイスメモリ領域とVRAM領域のアドレス変換にのみ対応しています。
48 
49       @param[in]    virtualAddr  変換する論理アドレス
50       @return       変換後の物理アドレス
51      *---------------------------------------------------------------------------*/
52     uptr nngxGetPhysicalAddr( uptr virtualAddr );
53 
54     /*!--------------------------------------------------------------------------*
55       :private
56 
57       @brief        メインメモリ上の頂点バッファ・テクスチャバッファの
58                     内容の更新をグラフィックスプロセッサ側に反映させます。
59 
60                     具体的な内部処理としてキャッシュのフラッシュを
61                     行いますが、汎用的なキャッシュフラッシュの目的で
62                     使用した場合の動作は保証されません。
63 
64                     あくまでも頂点バッファやテクスチャバッファの動的な
65                     更新を反映させる用途でのみお使いください。
66 
67       @param[in]    pBuffer  バッファの先頭へのポインタ
68       @param[in]    size     バッファのサイズ
69       @return       なし
70      *---------------------------------------------------------------------------*/
71     void nngxUpdateBuffer( const void* pBuffer, size_t size );
72 
73 #ifdef  __cplusplus
74 } // extern "C"
75 #endif // __cplusplus
76 
77 /*!
78   @}
79 */
80 
81 /*--------------------------------------------------------------------------
82     C++ API
83  *-------------------------------------------------------------------------*/
84 #ifdef  __cplusplus
85 namespace nn {
86 namespace gx {
87 namespace CTR {
88 
89     /*!--------------------------------------------------------------------------*
90       :private
91 
92       @brief        仮想アドレスから物理アドレスへの変換を行います。
93 
94                     コマンドリストを直接生成する際に必要となる、
95                     デバイスメモリ領域とVRAM領域のアドレス変換にのみ対応しています。
96 
97       @param[in]    virtualAddr  変換する論理アドレス
98       @return       変換後の物理アドレス
99      *---------------------------------------------------------------------------*/
GetPhysicalAddr(uptr virtualAddr)100     inline uptr GetPhysicalAddr( uptr virtualAddr )
101     {
102         return nngxGetPhysicalAddr(virtualAddr);
103     }
104 
105     /*!--------------------------------------------------------------------------*
106       :private
107 
108       @brief        メインメモリ上の頂点バッファ・テクスチャバッファの
109                     内容の更新をグラフィックスプロセッサ側に反映させます。
110 
111                     具体的な内部処理としてキャッシュのフラッシュを
112                     行いますが、汎用的なキャッシュフラッシュの目的で
113                     使用した場合の動作は保証されません。
114 
115                     あくまでも頂点バッファやテクスチャバッファの動的な
116                     更新を反映させる用途でのみお使いください。
117 
118       @param[in]    pBuffer  バッファの先頭へのポインタ
119       @param[in]    size     バッファのサイズ
120       @return       なし
121      *---------------------------------------------------------------------------*/
UpdateBuffer(const void * pBuffer,size_t size)122     inline void UpdateBuffer( const void* pBuffer, size_t size )
123     {
124         nngxUpdateBuffer(pBuffer, size);
125     }
126 
127 }}} // namespace nn::gx::CTR
128 #endif // __cplusplus
129 
130 
131 #endif /* NN_GX_CTR_GX_COMMAND_ACCESS_H_ */
132