1 /*---------------------------------------------------------------------------*
2
3 Copyright (C) Nintendo. All rights reserved.
4
5 These coded instructions, statements, and computer programs contain
6 proprietary information of Nintendo of America Inc. and/or Nintendo
7 Company Ltd., and are protected by Federal copyright law. They may
8 not be disclosed to third parties or copied or duplicated in any form,
9 in whole or in part, without the prior written consent of Nintendo.
10
11 *---------------------------------------------------------------------------*/
12 // -----------------------------------------------------------------------------
13 // demoDRC.h
14 //
15 // -----------------------------------------------------------------------------
16
17 #ifndef __DEMO_DRC_H__
18 #define __DEMO_DRC_H__
19
20 #include <cafe/demo.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /// @addtogroup demoDRC
27 /// @{
28
29 #define DEMOMOVColorBuffer DEMODRCColorBuffer
30 #define DEMOMOVDepthBuffer DEMODRCDepthBuffer
31 #define DEMOMOVContextState DEMODRCContextState
32 #define DEMOMOVInit DEMODRCInit
33 #define DEMOMOVShutdown DEMODRCShutdown
34 #define DEMOMOVIsRunning DEMODRCIsRunning
35 #define DEMOMOVBeforeRender DEMODRCBeforeRender
36 #define DEMOMOVDoneRender DEMODRCDoneRender
37 #define DEMOMOVSetDefaultRenderTarget DEMODRCSetDefaultRenderTarget
38
39 /// \brief Default color buffer for DEMODRC (global)
40 extern GX2ColorBuffer DEMODRCColorBuffer;
41
42 /// \brief Default depth buffer for DEMODRC (global)
43 extern GX2DepthBuffer DEMODRCDepthBuffer;
44
45 /// \brief Default context state ptr for DEMODRC (global)
46 extern GX2ContextState *DEMODRCContextState;
47
48 /// \brief Structure used to define an instance of DEMODRC
49 typedef struct
50 {
51 /// \brief Context state ptr for DEMODRC (instance)
52 GX2ContextState *contextState;
53
54 } DEMODRCInstance;
55
56 /// \brief Set up DRC render/depth/scan buffers.
57 ///
58 /// This function should be called after calling \ref DEMOGfxInit and before
59 /// calling any other DRC functions. \n
60 /// The following arguments can be specified:\n
61 ///
62 /// -DEMO_DRC_WIDTH n (set DRC RT width to n) \n
63 /// -DEMO_DRC_HEIGHT n (set DRC RT height to n) \n
64 /// -DEMO_DRC_CB_FORMAT str (set DRC color buffer format to 8_8_8_8 or 10_10_10_2) \n
65 /// -DEMO_DRC_DB_FORMAT str (set DRC depth buffer format to 16, 32F, 8_24, X24_8_32F) \n
66 /// -DEMO_DRC_AA_MODE n (set DRC AA mode to 0/1/2/3) \n
67 ///
68 /// Set up defaults for all options are (854/480/8_8_8_8/32F/no AA).\n
69 /// Unknown args are ignored, and the arg list is left unchanged.\n
70 ///
71 /// \param argc number of arguments
72 /// \param argv argument values
73 ///
74 /// \retval A pointer to the instance created by this function
75 //
76 DEMODRCInstance* DEMODRCInit(int argc, char *argv[]);
77
78 /// \brief Release allocated buffers.
79 ///
80 void DEMODRCShutdown(void);
81
82 /// \brief Release allocated buffers.
83 ///
84 void DEMODRCReleaseForeground(void);
85
86 /// \brief Reacquire allocated buffers.
87 ///
88 void DEMODRCAcquiredForeground(void);
89
90 /// \brief Get demo DRC running state
91 ///
92 /// \retval TRUE if \ref DEMODRCInit() has been called; false otherwise.
93 BOOL DEMODRCIsRunning(void);
94
95 /// Set demo DRC context to current.
96 /// Call this API before Drawing with demo DRC context created in DEMODRCInit.
97 void DEMODRCSetContextState(void);
98
99 /// \brief Change state for DRC
100 /// Functionality may change in the future.
101 ///
102 void DEMODRCBeforeRender(void);
103
104 /// \brief Copy render buffer to scan buffers.
105 /// Note that it does not swap and wait for the new frame to appear.
106 ///
107 void DEMODRCDoneRender(void);
108
109 /// \brief Obtain DRC connect/disconnect status.
110 ///
111 GX2DRCMode DEMODRCGetStatus(void);
112
113 /// \brief A helper function to reset render targets to DEMO DRC buffers.
114 ///
DEMODRCSetDefaultRenderTarget(void)115 inline void DEMODRCSetDefaultRenderTarget(void) {
116 GX2SetColorBuffer(&DEMODRCColorBuffer, GX2_RENDER_TARGET_0);
117 GX2SetDepthBuffer(&DEMODRCDepthBuffer);
118 }
119
120 /// \brief Creates a new instance of DEMODRC
121 ///
122 /// This will create a new instance, in addition to setting the instance.
123 /// This is called by DEMODRCInit().
124 DEMODRCInstance* DEMODRCAddInstance(void);
125
126 /// \brief Deletes an instance of DEMODRC
127 ///
128 /// This is called by DEMODRCShutdown().
129 void DEMODRCDeleteInstance(DEMODRCInstance *instance);
130
131 /// \brief Sets the instance of DEMODRC
132 void DEMODRCSetInstance(DEMODRCInstance *instance);
133
134 /// \brief Gets the instance of DEMODRC
135 DEMODRCInstance* DEMODRCGetInstance(void);
136
137 /// @} // demoDRC
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif /// __DEMO_DRC_H__
144