From eb3a9e70bf7f09dfcc4412bee16145bb14ef1d0a Mon Sep 17 00:00:00 2001 From: TravisCI-DocBuilder Date: Wed, 6 Jan 2016 19:18:11 +0000 Subject: [PATCH] Doc generated from commit 57ec5db247ddb1f9703fb87a68d45f78447f8c00 --- 3ds_8h.html | 2 +- 3ds_8h_source.html | 71 +- ac_8h.html | 2 +- ac_8h_source.html | 2 +- am_8h.html | 6 +- am_8h_source.html | 60 +- annotated.html | 2 +- app_launch_2source_2main_8c-example.html | 2 +- apt_8h.html | 4 +- apt_8h_source.html | 2 +- audio_2mic_2source_2main_8c-example.html | 2 +- cam_8h.html | 2 +- cam_8h_source.html | 2 +- cfgnor_8h.html | 2 +- cfgnor_8h_source.html | 2 +- cfgu_8h.html | 2 +- cfgu_8h_source.html | 2 +- channel_8h.html | 2 +- channel_8h_source.html | 2 +- classes.html | 2 +- console_8h.html | 2 +- console_8h_source.html | 2 +- csnd_8h.html | 2 +- csnd_8h_source.html | 2 +- deprecated.html | 2 +- dir_0e005207343684f6967052d1f51a7e66.html | 2 +- dir_0f128149b5f0edcc1e84fa1d13781a04.html | 2 +- dir_1b1aef9f2527d990c50369cf62d7d9a1.html | 2 +- dir_317ea3797c15f4a1d9c156bc812661ca.html | 2 +- dir_6dafe9e8493a4966457f520acc17aa32.html | 2 +- dir_953d82d0b36b92ff36f0c21b90fa146f.html | 2 +- dir_a31f4157c8426a01402443a71f1cf774.html | 2 +- dir_d0a04a149c821e4e65be9315f86ccf56.html | 2 +- dir_d44c64559bbebec7f509842c48db8b23.html | 2 +- dir_d475325f6a9fe3bfc3a495c72a9e475e.html | 2 +- dsp_8h.html | 2 +- dsp_8h_source.html | 2 +- enums_8h.html | 2 +- enums_8h_source.html | 2 +- env_8h.html | 2 +- env_8h_source.html | 2 +- examples.html | 8 +- files.html | 2 +- fs_8h.html | 2 +- fs_8h_source.html | 2 +- functions.html | 2 +- functions_a.html | 2 +- functions_b.html | 2 +- functions_c.html | 2 +- functions_d.html | 2 +- functions_e.html | 2 +- functions_f.html | 2 +- functions_g.html | 2 +- functions_h.html | 2 +- functions_i.html | 2 +- functions_k.html | 2 +- functions_l.html | 2 +- functions_m.html | 2 +- functions_n.html | 2 +- functions_o.html | 2 +- functions_p.html | 2 +- functions_r.html | 2 +- functions_s.html | 2 +- functions_t.html | 2 +- functions_u.html | 2 +- functions_v.html | 2 +- functions_vars.html | 2 +- functions_vars_a.html | 2 +- functions_vars_b.html | 2 +- functions_vars_c.html | 2 +- functions_vars_d.html | 2 +- functions_vars_e.html | 2 +- functions_vars_f.html | 2 +- functions_vars_g.html | 2 +- functions_vars_h.html | 2 +- functions_vars_i.html | 2 +- functions_vars_k.html | 2 +- functions_vars_l.html | 2 +- functions_vars_m.html | 2 +- functions_vars_n.html | 2 +- functions_vars_o.html | 2 +- functions_vars_p.html | 2 +- functions_vars_r.html | 2 +- functions_vars_s.html | 2 +- functions_vars_t.html | 2 +- functions_vars_u.html | 2 +- functions_vars_v.html | 2 +- functions_vars_w.html | 2 +- functions_vars_x.html | 2 +- functions_vars_y.html | 2 +- functions_vars_z.html | 2 +- functions_w.html | 2 +- functions_x.html | 2 +- functions_y.html | 2 +- functions_z.html | 2 +- ...tem_language_2source_2main_8c-example.html | 2 +- gfx_8h.html | 73 ++- gfx_8h_source.html | 165 ++--- globals.html | 5 +- globals_a.html | 5 +- globals_b.html | 2 +- globals_c.html | 2 +- globals_d.html | 2 +- globals_defs.html | 2 +- globals_defs_b.html | 2 +- globals_defs_c.html | 2 +- globals_defs_d.html | 2 +- globals_defs_g.html | 2 +- globals_defs_h.html | 2 +- globals_defs_k.html | 2 +- globals_defs_m.html | 2 +- globals_defs_n.html | 2 +- globals_defs_p.html | 2 +- globals_defs_r.html | 2 +- globals_defs_s.html | 2 +- globals_defs_t.html | 2 +- globals_defs_u.html | 2 +- globals_e.html | 2 +- globals_enum.html | 2 +- globals_eval.html | 2 +- globals_eval_b.html | 2 +- globals_eval_c.html | 2 +- globals_eval_d.html | 2 +- globals_eval_e.html | 2 +- globals_eval_f.html | 2 +- globals_eval_g.html | 2 +- globals_eval_h.html | 2 +- globals_eval_i.html | 2 +- globals_eval_k.html | 2 +- globals_eval_l.html | 2 +- globals_eval_m.html | 2 +- globals_eval_n.html | 2 +- globals_eval_o.html | 2 +- globals_eval_p.html | 2 +- globals_eval_r.html | 2 +- globals_eval_s.html | 2 +- globals_eval_t.html | 2 +- globals_eval_u.html | 2 +- globals_eval_v.html | 2 +- globals_eval_w.html | 2 +- globals_f.html | 2 +- globals_func.html | 5 +- globals_func_a.html | 5 +- globals_func_c.html | 2 +- globals_func_d.html | 2 +- globals_func_e.html | 2 +- globals_func_f.html | 2 +- globals_func_g.html | 14 +- globals_func_h.html | 2 +- globals_func_i.html | 2 +- globals_func_l.html | 2 +- globals_func_m.html | 2 +- globals_func_n.html | 2 +- globals_func_o.html | 2 +- globals_func_p.html | 2 +- globals_func_q.html | 2 +- globals_func_r.html | 2 +- globals_func_s.html | 2 +- globals_func_t.html | 2 +- globals_func_u.html | 2 +- globals_func_v.html | 2 +- globals_func_y.html | 2 +- globals_g.html | 14 +- globals_h.html | 2 +- globals_i.html | 2 +- globals_k.html | 2 +- globals_l.html | 2 +- globals_m.html | 2 +- globals_n.html | 2 +- globals_o.html | 2 +- globals_p.html | 2 +- globals_q.html | 2 +- globals_r.html | 2 +- globals_s.html | 2 +- globals_t.html | 2 +- globals_type.html | 2 +- globals_u.html | 2 +- globals_v.html | 2 +- globals_vars.html | 2 +- globals_w.html | 2 +- globals_y.html | 2 +- gpu-old_8h.html | 56 +- gpu-old_8h_source.html | 2 +- gpu_8h.html | 5 +- gpu_8h_source.html | 2 +- ...224bit-color_2source_2main_8c-example.html | 2 +- ...agment_light_2source_2main_8c-example.html | 333 ++++++++++ ...u_2geoshader_2source_2main_8c-example.html | 587 ++--------------- ..._2gpusprites_2source_2main_8c-example.html | 367 +++++++++++ ...u_2immediate_2source_2main_8c-example.html | 202 ++++++ ..._2simple_tri_2source_2main_8c-example.html | 505 ++------------- ...extured_cube_2source_2main_8c-example.html | 608 +++--------------- ...-screen-text_2source_2main_8c-example.html | 2 +- ...colored-text_2source_2main_8c-example.html | 2 +- ...2hello-world_2source_2main_8c-example.html | 2 +- ...windows-text_2source_2main_8c-example.html | 2 +- gspgpu_8h.html | 81 ++- gspgpu_8h_source.html | 290 +++++---- gsplcd_8h.html | 2 +- gsplcd_8h_source.html | 2 +- gx_8h.html | 51 +- gx_8h_source.html | 280 ++++---- hb_8h.html | 2 +- hb_8h_source.html | 2 +- hid_8h.html | 4 +- hid_8h_source.html | 2 +- http_2source_2main_8c-example.html | 2 +- httpc_8h.html | 2 +- httpc_8h_source.html | 2 +- in_8h_source.html | 2 +- index.html | 4 +- inet_8h_source.html | 2 +- ...ead-controls_2source_2main_8c-example.html | 2 +- ...touch-screen_2source_2main_8c-example.html | 2 +- ioctl_8h_source.html | 2 +- ipc_8h.html | 2 +- ipc_8h_source.html | 2 +- ir_8h.html | 2 +- ir_8h_source.html | 2 +- irrst_8h.html | 2 +- irrst_8h_source.html | 2 +- ...pplet_launch_2source_2main_8c-example.html | 2 +- linear_8h.html | 6 +- linear_8h_source.html | 2 +- mappable_8h.html | 2 +- mappable_8h_source.html | 2 +- ...ravis_build_smealum_ctrulib_Changelog.html | 30 +- mic_8h.html | 2 +- mic_8h_source.html | 2 +- mvd_2source_2main_8c-example.html | 2 +- mvd_8h.html | 2 +- mvd_8h_source.html | 2 +- ndsp_8h.html | 2 +- ndsp_8h_source.html | 2 +- netdb_8h_source.html | 2 +- news_8h.html | 2 +- news_8h_source.html | 2 +- ns_8h.html | 2 +- ns_8h_source.html | 2 +- os_8h.html | 8 +- os_8h_source.html | 2 +- pages.html | 2 +- pm_8h.html | 2 +- pm_8h_source.html | 2 +- poll_8h_source.html | 2 +- ps_8h.html | 2 +- ps_8h_source.html | 2 +- ptmsysm_8h.html | 2 +- ptmsysm_8h_source.html | 2 +- ptmu_8h.html | 2 +- ptmu_8h_source.html | 2 +- qtm_2source_2main_8c-example.html | 2 +- qtm_8h.html | 2 +- qtm_8h_source.html | 2 +- rbtree_8h.html | 2 +- rbtree_8h_source.html | 2 +- registers_8h.html | 2 +- registers_8h_source.html | 2 +- result_8h.html | 2 +- result_8h_source.html | 2 +- romfs_8h.html | 2 +- romfs_8h_source.html | 2 +- sdmc_2source_2main_8c-example.html | 2 +- sdmc_8h.html | 2 +- sdmc_8h_source.html | 2 +- select_8h_source.html | 2 +- shaderProgram_8h.html | 15 +- shaderProgram_8h_source.html | 2 +- shbin_8h.html | 6 +- shbin_8h_source.html | 2 +- soc_8h.html | 2 +- soc_8h_source.html | 2 +- socket_8h_source.html | 2 +- srv_8h.html | 2 +- srv_8h_source.html | 2 +- srvpm_8h.html | 2 +- srvpm_8h_source.html | 2 +- structAM__TitleEntry.html | 2 +- structCAMU__ImageQualityCalibrationData.html | 2 +- structCAMU__PackageParameterCameraSelect.html | 2 +- structCAMU__PackageParameterContext.html | 2 +- ...ctCAMU__PackageParameterContextDetail.html | 2 +- structCAMU__StereoCameraCalibrationData.html | 2 +- structConsoleFont.html | 2 +- structCreateThreadEvent.html | 2 +- structDVLB__s.html | 4 +- structDVLE__constEntry__s.html | 2 +- structDVLE__outEntry__s.html | 2 +- structDVLE__s.html | 2 +- structDVLE__uniformEntry__s.html | 2 +- structDVLP__s.html | 2 +- structDebugEventInfo.html | 2 +- structExceptionEvent.html | 2 +- structExitProcessEvent.html | 2 +- structExitThreadEvent.html | 2 +- structFS__Archive.html | 2 +- structFS__ArchiveResource.html | 2 +- structFS__DeviceMoveContext.html | 2 +- structFS__DirectoryEntry.html | 2 +- structFS__ExtSaveDataInfo.html | 2 +- structFS__IntegrityVerificationSeed.html | 2 +- structFS__Path.html | 2 +- structFS__ProductInfo.html | 2 +- structFS__ProgramInfo.html | 2 +- structFS__SystemSaveDataInfo.html | 2 +- structGSPGPU__CaptureInfo.html | 2 +- structGSPGPU__CaptureInfoEntry.html | 2 +- structGSPGPU__FramebufferInfo.html | 2 +- structMVDSTD__Config.html | 2 +- structMapEvent.html | 2 +- structMemInfo.html | 2 +- structOS__VersionBin.html | 2 +- structOutputStringEvent.html | 2 +- structPageInfo.html | 2 +- structPrintConsole.html | 2 +- structProcessEvent.html | 2 +- structQTM__HeadTrackingInfo.html | 2 +- structQTM__HeadTrackingInfoCoord.html | 2 +- structSchedulerInOutEvent.html | 2 +- structSyscallInOutEvent.html | 2 +- structY2RU__ColorCoefficients.html | 2 +- structY2RU__ConversionParams.html | 2 +- structY2RU__DitheringWeightParams.html | 2 +- structaccelVector.html | 2 +- structangularRate.html | 2 +- structaptHookCookie.html | 2 +- structcirclePosition.html | 2 +- structfloat24Uniform__s.html | 2 +- structhostent.html | 2 +- structhttpcContext.html | 2 +- structin__addr.html | 2 +- structip__mreq.html | 2 +- structlinger.html | 2 +- structndspAdpcmData.html | 2 +- structpollfd.html | 2 +- structrbtree.html | 2 +- structrbtree__node.html | 2 +- structromfs__dir.html | 2 +- structromfs__file.html | 2 +- structromfs__header.html | 2 +- structshaderInstance__s.html | 2 +- structshaderProgram__s.html | 4 +- structsockaddr.html | 2 +- structsockaddr__in.html | 2 +- structsockaddr__storage.html | 2 +- structtag__ndspWaveBuf.html | 2 +- structtouchPosition.html | 2 +- svc_8h.html | 2 +- svc_8h_source.html | 2 +- synchronization_8h.html | 24 +- synchronization_8h_source.html | 64 +- tcp_8h_source.html | 2 +- thread_8h.html | 2 +- thread_8h_source.html | 2 +- threads_2event_2source_2main_8c-example.html | 2 +- ...thread-basic_2source_2main_8c-example.html | 2 +- time_2rtc_2source_2main_8c-example.html | 2 +- types_8h.html | 2 +- types_8h_source.html | 2 +- unionCSND__CapInfo.html | 2 +- unionCSND__ChnInfo.html | 2 +- utf_8h.html | 2 +- utf_8h_source.html | 2 +- vram_8h.html | 8 +- vram_8h_source.html | 2 +- y2r_8h.html | 2 +- y2r_8h_source.html | 2 +- 367 files changed, 2242 insertions(+), 2395 deletions(-) create mode 100644 graphics_2gpu_2fragment_light_2source_2main_8c-example.html create mode 100644 graphics_2gpu_2gpusprites_2source_2main_8c-example.html create mode 100644 graphics_2gpu_2immediate_2source_2main_8c-example.html diff --git a/3ds_8h.html b/3ds_8h.html index f538d75..9791ce7 100644 --- a/3ds_8h.html +++ b/3ds_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/3ds_8h_source.html b/3ds_8h_source.html index f5a8a5f..a411cad 100644 --- a/3ds_8h_source.html +++ b/3ds_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
@@ -172,59 +172,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
79  * @example graphics/printing/both-screen-text/source/main.c
80  * @example graphics/printing/colored-text/source/main.c
81  * @example graphics/printing/multiple-windows-text/source/main.c
-
82 
+
82  * @example graphics/gpu/fragment_light/source/main.c
83  * @example graphics/gpu/geoshader/source/main.c
-
84  graphics/gpu/geoshader/source/gpu.h
-
85  @include graphics/gpu/geoshader/source/gpu.h
-
86  graphics/gpu/geoshader/source/gpu.c
-
87  @include graphics/gpu/geoshader/source/gpu.c
-
88  graphics/gpu/geoshader/source/3dmath.h
-
89  @include graphics/gpu/geoshader/source/3dmath.h
-
90  graphics/gpu/geoshader/source/3dmath.c
-
91  @include graphics/gpu/geoshader/source/3dmath.c
-
92  graphics/gpu/geoshader/source/vshader.pica
-
93  @include graphics/gpu/geoshader/source/vshader.pica
-
94  graphics/gpu/geoshader/source/gshader.pica
-
95  @include graphics/gpu/geoshader/source/gshader.pica
-
96 
-
97 
-
98  * @example graphics/gpu/simple_tri/source/main.c
-
99  graphics/gpu/simple_tri/source/gpu.h
-
100  @include graphics/gpu/simple_tri/source/gpu.h
-
101  graphics/gpu/simple_tri/source/gpu.c
-
102  @include graphics/gpu/simple_tri/source/gpu.c
-
103  graphics/gpu/simple_tri/source/3dmath.h
-
104  @include graphics/gpu/simple_tri/source/3dmath.h
-
105  graphics/gpu/simple_tri/source/3dmath.c
-
106  @include graphics/gpu/simple_tri/source/3dmath.c
-
107  graphics/gpu/simple_tri/source/vshader.pica
-
108  @include graphics/gpu/simple_tri/source/vshader.pica
-
109 
-
110 
-
111  * @example graphics/gpu/textured_cube/source/main.c
-
112  graphics/gpu/textured_cube/source/gpu.h
-
113  @include graphics/gpu/textured_cube/source/gpu.h
-
114  graphics/gpu/textured_cube/source/gpu.c
-
115  @include graphics/gpu/textured_cube/source/gpu.c
-
116  graphics/gpu/textured_cube/source/3dmath.h
-
117  @include graphics/gpu/textured_cube/source/3dmath.h
-
118  graphics/gpu/textured_cube/source/3dmath.c
-
119  @include graphics/gpu/textured_cube/source/3dmath.c
-
120  graphics/gpu/textured_cube/source/vshader.pica
-
121  @include graphics/gpu/textured_cube/source/vshader.pica
-
122 
-
123  * @example http/source/main.c
-
124  * @example input/read-controls/source/main.c
-
125  * @example input/touch-screen/source/main.c
-
126  * @example libapplet_launch/source/main.c
-
127  * @example mvd/source/main.c
-
128  * @example qtm/source/main.c
-
129  * @example sdmc/source/main.c
-
130  * @example threads/thread-basic/source/main.c
-
131  * @example threads/event/source/main.c
-
132  * @example time/rtc/source/main.c
-
133  */
-
134 
+
84  * @example graphics/gpu/gpusprites/source/main.c
+
85  * @example graphics/gpu/immediate/source/main.c
+
86  * @example graphics/gpu/simple_tri/source/main.c
+
87  * @example graphics/gpu/textured_cube/source/main.c
+
88  * @example http/source/main.c
+
89  * @example input/read-controls/source/main.c
+
90  * @example input/touch-screen/source/main.c
+
91  * @example libapplet_launch/source/main.c
+
92  * @example mvd/source/main.c
+
93  * @example qtm/source/main.c
+
94  * @example sdmc/source/main.c
+
95  * @example threads/thread-basic/source/main.c
+
96  * @example threads/event/source/main.c
+
97  * @example time/rtc/source/main.c
+
98  */
+
99 
GSPLCD service.
srv:pm service.
Functions for working with shaders.
diff --git a/ac_8h.html b/ac_8h.html index 224d053..4f65ac5 100644 --- a/ac_8h.html +++ b/ac_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/ac_8h_source.html b/ac_8h_source.html index 8b4c904..59e88ac 100644 --- a/ac_8h_source.html +++ b/ac_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/am_8h.html b/am_8h.html index de046e3..b892d61 100644 --- a/am_8h.html +++ b/am_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
@@ -154,6 +154,10 @@ void Result AM_InstallNativeFirm (void)  Installs the current NATIVE_FIRM title to NAND (firm0:/ & firm1:/)
  + +Result AM_InstallFirm (u64 titleID) + Similar to InstallNativeFirm, but doesn't use AMPXI_GetTitleList (NATIVE_FIRM: 0004013800000002 or 0004013820000002 (N3DS))
Result AM_GetTitleProductCode (u8 mediatype, u64 titleID, char *productCode)  Gets the product code of a title. More...
  diff --git a/am_8h_source.html b/am_8h_source.html index 6035fc8..36c4c05 100644 --- a/am_8h_source.html +++ b/am_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
@@ -190,33 +190,36 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
97 /// Installs the current NATIVE_FIRM title to NAND (firm0:/ & firm1:/)
98 Result AM_InstallNativeFirm(void);
99 
-
100 /**
-
101  * @brief Gets the product code of a title.
-
102  * @param mediatype Mediatype of the title.
-
103  * @param titleID ID of the title.
-
104  * @param productCode Buffer to output the product code to. (length = 16)
-
105  */
-
106 Result AM_GetTitleProductCode(u8 mediatype, u64 titleID, char* productCode);
-
107 
-
108 /**
-
109  * @brief Gets an AM_TitleEntry instance for a CIA file.
-
110  * @param mediatype Mediatype that this CIA would be installed to.
-
111  * @param titleEntry Pointer to write the AM_TitleEntry instance to.
-
112  * @param fileHandle Handle of the CIA file to read.
-
113  */
-
114 Result AM_GetCiaFileInfo(u8 mediatype, AM_TitleEntry *titleEntry, Handle fileHandle);
-
115 
-
116 /**
-
117  * @brief Initializes the external (SD) title database.
-
118  * @param overwrite Overwrites the database if it already exists.
-
119  */
-
120 Result AM_InitializeExternalTitleDatabase(bool overwrite);
-
121 
-
122 /**
-
123  * @brief Queries whether the external title database is available.
-
124  * @param[out] available Pointer to output the availability status to.
-
125  */
-
126 Result AM_QueryAvailableExternalTitleDatabase(bool* available);
+
100 /// Similar to InstallNativeFirm, but doesn't use AMPXI_GetTitleList (NATIVE_FIRM: 0004013800000002 or 0004013820000002 (N3DS))
+
101 Result AM_InstallFirm(u64 titleID);
+
102 
+
103 /**
+
104  * @brief Gets the product code of a title.
+
105  * @param mediatype Mediatype of the title.
+
106  * @param titleID ID of the title.
+
107  * @param productCode Buffer to output the product code to. (length = 16)
+
108  */
+
109 Result AM_GetTitleProductCode(u8 mediatype, u64 titleID, char* productCode);
+
110 
+
111 /**
+
112  * @brief Gets an AM_TitleEntry instance for a CIA file.
+
113  * @param mediatype Mediatype that this CIA would be installed to.
+
114  * @param titleEntry Pointer to write the AM_TitleEntry instance to.
+
115  * @param fileHandle Handle of the CIA file to read.
+
116  */
+
117 Result AM_GetCiaFileInfo(u8 mediatype, AM_TitleEntry *titleEntry, Handle fileHandle);
+
118 
+
119 /**
+
120  * @brief Initializes the external (SD) title database.
+
121  * @param overwrite Overwrites the database if it already exists.
+
122  */
+
123 Result AM_InitializeExternalTitleDatabase(bool overwrite);
+
124 
+
125 /**
+
126  * @brief Queries whether the external title database is available.
+
127  * @param[out] available Pointer to output the availability status to.
+
128  */
+
129 Result AM_QueryAvailableExternalTitleDatabase(bool* available);
Result AM_DeleteAppTitle(u8 mediatype, u64 titleID)
Deletes a title, provided that it is not a system title.
Result AM_GetTitleIdList(u8 mediatype, u32 count, u64 *titleIDs)
Gets a list of title IDs present in a mediatype.
Result AM_FinishCiaInstall(u8 mediatype, Handle *ciaHandle)
Finalizes the CIA install process.
@@ -228,6 +231,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Result AM_CancelCIAInstall(Handle *ciaHandle)
Aborts the CIA install process.
u32 Handle
Resource handle.
Definition: types.h:41
Result AM_StartDlpChildCiaInstall(Handle *ciaHandle)
Initializes the CIA install process for Download Play CIAs, returning a handle to write CIA data to...
+
Result AM_InstallFirm(u64 titleID)
Similar to InstallNativeFirm, but doesn't use AMPXI_GetTitleList (NATIVE_FIRM: 0004013800000002 or 00...
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
Result AM_ListTitles(u8 mediatype, u32 titleCount, u64 *titleIdList, AM_TitleEntry *titleList)
Gets a list of details about installed titles.
diff --git a/annotated.html b/annotated.html index 111aaed..b4730ec 100644 --- a/annotated.html +++ b/annotated.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/app_launch_2source_2main_8c-example.html b/app_launch_2source_2main_8c-example.html index 4c88bae..1befaac 100644 --- a/app_launch_2source_2main_8c-example.html +++ b/app_launch_2source_2main_8c-example.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/apt_8h.html b/apt_8h.html index 999de9c..0981656 100644 --- a/apt_8h.html +++ b/apt_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
@@ -2041,7 +2041,7 @@ Variables

Processes the current APT status.

Generally used within a main loop.

Returns
Whether the application is closing.
-
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.
+
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/fragment_light/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/gpusprites/source/main.c, graphics/gpu/immediate/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.
diff --git a/apt_8h_source.html b/apt_8h_source.html index f2c4560..d1b6700 100644 --- a/apt_8h_source.html +++ b/apt_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/audio_2mic_2source_2main_8c-example.html b/audio_2mic_2source_2main_8c-example.html index e30990b..ba058d2 100644 --- a/audio_2mic_2source_2main_8c-example.html +++ b/audio_2mic_2source_2main_8c-example.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/cam_8h.html b/cam_8h.html index 07c881b..e1502d0 100644 --- a/cam_8h.html +++ b/cam_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/cam_8h_source.html b/cam_8h_source.html index 724169b..5ef06e3 100644 --- a/cam_8h_source.html +++ b/cam_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/cfgnor_8h.html b/cfgnor_8h.html index 52c42c4..f4e8e7f 100644 --- a/cfgnor_8h.html +++ b/cfgnor_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/cfgnor_8h_source.html b/cfgnor_8h_source.html index bb5e181..349a3b4 100644 --- a/cfgnor_8h_source.html +++ b/cfgnor_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/cfgu_8h.html b/cfgu_8h.html index 4b8598d..4fea003 100644 --- a/cfgu_8h.html +++ b/cfgu_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/cfgu_8h_source.html b/cfgu_8h_source.html index 83375d0..56798c0 100644 --- a/cfgu_8h_source.html +++ b/cfgu_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/channel_8h.html b/channel_8h.html index 4d3cdc4..6dbf12b 100644 --- a/channel_8h.html +++ b/channel_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/channel_8h_source.html b/channel_8h_source.html index bad8f51..719a7c7 100644 --- a/channel_8h_source.html +++ b/channel_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/classes.html b/classes.html index 01e4b40..34dafc2 100644 --- a/classes.html +++ b/classes.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/console_8h.html b/console_8h.html index 01527ba..d474159 100644 --- a/console_8h.html +++ b/console_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/console_8h_source.html b/console_8h_source.html index 28d4f9c..4371f67 100644 --- a/console_8h_source.html +++ b/console_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/csnd_8h.html b/csnd_8h.html index 93bdea4..8cd7c90 100644 --- a/csnd_8h.html +++ b/csnd_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/csnd_8h_source.html b/csnd_8h_source.html index 0f811ce..b452b61 100644 --- a/csnd_8h_source.html +++ b/csnd_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/deprecated.html b/deprecated.html index 5ffee81..2a88549 100644 --- a/deprecated.html +++ b/deprecated.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_0e005207343684f6967052d1f51a7e66.html b/dir_0e005207343684f6967052d1f51a7e66.html index 499ecf5..d33a90b 100644 --- a/dir_0e005207343684f6967052d1f51a7e66.html +++ b/dir_0e005207343684f6967052d1f51a7e66.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_0f128149b5f0edcc1e84fa1d13781a04.html b/dir_0f128149b5f0edcc1e84fa1d13781a04.html index 093e0c6..2b625fb 100644 --- a/dir_0f128149b5f0edcc1e84fa1d13781a04.html +++ b/dir_0f128149b5f0edcc1e84fa1d13781a04.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_1b1aef9f2527d990c50369cf62d7d9a1.html b/dir_1b1aef9f2527d990c50369cf62d7d9a1.html index af91f52..171d565 100644 --- a/dir_1b1aef9f2527d990c50369cf62d7d9a1.html +++ b/dir_1b1aef9f2527d990c50369cf62d7d9a1.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_317ea3797c15f4a1d9c156bc812661ca.html b/dir_317ea3797c15f4a1d9c156bc812661ca.html index 8270c07..ad36b2d 100644 --- a/dir_317ea3797c15f4a1d9c156bc812661ca.html +++ b/dir_317ea3797c15f4a1d9c156bc812661ca.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_6dafe9e8493a4966457f520acc17aa32.html b/dir_6dafe9e8493a4966457f520acc17aa32.html index b3f1eb3..b4de6ec 100644 --- a/dir_6dafe9e8493a4966457f520acc17aa32.html +++ b/dir_6dafe9e8493a4966457f520acc17aa32.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_953d82d0b36b92ff36f0c21b90fa146f.html b/dir_953d82d0b36b92ff36f0c21b90fa146f.html index 751cc74..45e5f1b 100644 --- a/dir_953d82d0b36b92ff36f0c21b90fa146f.html +++ b/dir_953d82d0b36b92ff36f0c21b90fa146f.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_a31f4157c8426a01402443a71f1cf774.html b/dir_a31f4157c8426a01402443a71f1cf774.html index 74c08ff..54b6f1b 100644 --- a/dir_a31f4157c8426a01402443a71f1cf774.html +++ b/dir_a31f4157c8426a01402443a71f1cf774.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_d0a04a149c821e4e65be9315f86ccf56.html b/dir_d0a04a149c821e4e65be9315f86ccf56.html index cb5fc90..80e9c98 100644 --- a/dir_d0a04a149c821e4e65be9315f86ccf56.html +++ b/dir_d0a04a149c821e4e65be9315f86ccf56.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html index 20f83ec..fb696d2 100644 --- a/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dir_d475325f6a9fe3bfc3a495c72a9e475e.html b/dir_d475325f6a9fe3bfc3a495c72a9e475e.html index b913301..75cdd28 100644 --- a/dir_d475325f6a9fe3bfc3a495c72a9e475e.html +++ b/dir_d475325f6a9fe3bfc3a495c72a9e475e.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dsp_8h.html b/dsp_8h.html index 8994619..c5b6c3e 100644 --- a/dsp_8h.html +++ b/dsp_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/dsp_8h_source.html b/dsp_8h_source.html index 263079f..f8a87b8 100644 --- a/dsp_8h_source.html +++ b/dsp_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/enums_8h.html b/enums_8h.html index d96761a..7a43d68 100644 --- a/enums_8h.html +++ b/enums_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/enums_8h_source.html b/enums_8h_source.html index 0fe0655..a913807 100644 --- a/enums_8h_source.html +++ b/enums_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/env_8h.html b/env_8h.html index 4deb56e..9382d08 100644 --- a/env_8h.html +++ b/env_8h.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/env_8h_source.html b/env_8h_source.html index 0815a15..a623991 100644 --- a/env_8h_source.html +++ b/env_8h_source.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
diff --git a/examples.html b/examples.html index a70b4cd..4e7d69c 100644 --- a/examples.html +++ b/examples.html @@ -24,7 +24,7 @@
libctru -  v1.0.0 +  v1.1.0
@@ -90,8 +90,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • graphics/bitmap/24bit-color/source/main.c
  • +
  • graphics/gpu/fragment_light/source/main.c
  • +
  • graphics/gpu/geoshader/source/main.c
  • +
  • graphics/gpu/gpusprites/source/main.c
  • + +
  • graphics/gpu/immediate/source/main.c
  • +
  • graphics/gpu/simple_tri/source/main.c
  • graphics/gpu/textured_cube/source/main.c
  • diff --git a/files.html b/files.html index c165401..00d1d62 100644 --- a/files.html +++ b/files.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/fs_8h.html b/fs_8h.html index 90c4076..220d601 100644 --- a/fs_8h.html +++ b/fs_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/fs_8h_source.html b/fs_8h_source.html index 2707671..47689e6 100644 --- a/fs_8h_source.html +++ b/fs_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions.html b/functions.html index 970263a..048a7fe 100644 --- a/functions.html +++ b/functions.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_a.html b/functions_a.html index 817eda3..8c1ead9 100644 --- a/functions_a.html +++ b/functions_a.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_b.html b/functions_b.html index bda1e96..626091c 100644 --- a/functions_b.html +++ b/functions_b.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_c.html b/functions_c.html index 9f2b319..f863fd0 100644 --- a/functions_c.html +++ b/functions_c.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_d.html b/functions_d.html index 3ea0f6d..39f9750 100644 --- a/functions_d.html +++ b/functions_d.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_e.html b/functions_e.html index dcec099..d3cc24f 100644 --- a/functions_e.html +++ b/functions_e.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_f.html b/functions_f.html index 6207c20..c46d605 100644 --- a/functions_f.html +++ b/functions_f.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_g.html b/functions_g.html index 316177e..ad27906 100644 --- a/functions_g.html +++ b/functions_g.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_h.html b/functions_h.html index bb07d58..ada63ba 100644 --- a/functions_h.html +++ b/functions_h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_i.html b/functions_i.html index 80c154e..751106a 100644 --- a/functions_i.html +++ b/functions_i.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_k.html b/functions_k.html index 4062e60..d0d820d 100644 --- a/functions_k.html +++ b/functions_k.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_l.html b/functions_l.html index f23eafd..1fe66d9 100644 --- a/functions_l.html +++ b/functions_l.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_m.html b/functions_m.html index a51471c..89b4a93 100644 --- a/functions_m.html +++ b/functions_m.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_n.html b/functions_n.html index 6c62da6..2ab5d9a 100644 --- a/functions_n.html +++ b/functions_n.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_o.html b/functions_o.html index dfb7bf7..44b46b2 100644 --- a/functions_o.html +++ b/functions_o.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_p.html b/functions_p.html index 8374470..c15436e 100644 --- a/functions_p.html +++ b/functions_p.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_r.html b/functions_r.html index eccac86..7cf2df5 100644 --- a/functions_r.html +++ b/functions_r.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_s.html b/functions_s.html index 8fd8ed0..1416f11 100644 --- a/functions_s.html +++ b/functions_s.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_t.html b/functions_t.html index 4b1dd53..fc288d7 100644 --- a/functions_t.html +++ b/functions_t.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_u.html b/functions_u.html index b14f834..3193041 100644 --- a/functions_u.html +++ b/functions_u.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_v.html b/functions_v.html index 56461e5..d7d53df 100644 --- a/functions_v.html +++ b/functions_v.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars.html b/functions_vars.html index 26fd8f5..d5bf0b0 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_a.html b/functions_vars_a.html index 9e7e470..72eafa0 100644 --- a/functions_vars_a.html +++ b/functions_vars_a.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_b.html b/functions_vars_b.html index 5a69f22..6e48605 100644 --- a/functions_vars_b.html +++ b/functions_vars_b.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_c.html b/functions_vars_c.html index 41def49..5e8b9dd 100644 --- a/functions_vars_c.html +++ b/functions_vars_c.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_d.html b/functions_vars_d.html index 9eeb175..3fce734 100644 --- a/functions_vars_d.html +++ b/functions_vars_d.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_e.html b/functions_vars_e.html index 749f1f3..5c51eed 100644 --- a/functions_vars_e.html +++ b/functions_vars_e.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_f.html b/functions_vars_f.html index 1e3624b..45c808c 100644 --- a/functions_vars_f.html +++ b/functions_vars_f.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_g.html b/functions_vars_g.html index d8e6f9b..a7146d2 100644 --- a/functions_vars_g.html +++ b/functions_vars_g.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_h.html b/functions_vars_h.html index c757668..16c121b 100644 --- a/functions_vars_h.html +++ b/functions_vars_h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_i.html b/functions_vars_i.html index e458941..cc2ebd9 100644 --- a/functions_vars_i.html +++ b/functions_vars_i.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_k.html b/functions_vars_k.html index 7935066..d7af2b2 100644 --- a/functions_vars_k.html +++ b/functions_vars_k.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_l.html b/functions_vars_l.html index 630dd3b..09e3951 100644 --- a/functions_vars_l.html +++ b/functions_vars_l.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_m.html b/functions_vars_m.html index 9239443..ebd3363 100644 --- a/functions_vars_m.html +++ b/functions_vars_m.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_n.html b/functions_vars_n.html index cc24492..a86cedc 100644 --- a/functions_vars_n.html +++ b/functions_vars_n.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_o.html b/functions_vars_o.html index 2cabd31..b879047 100644 --- a/functions_vars_o.html +++ b/functions_vars_o.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_p.html b/functions_vars_p.html index 25e522a..410424d 100644 --- a/functions_vars_p.html +++ b/functions_vars_p.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_r.html b/functions_vars_r.html index e6e62cc..b39db36 100644 --- a/functions_vars_r.html +++ b/functions_vars_r.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_s.html b/functions_vars_s.html index d3b0f0a..15e7961 100644 --- a/functions_vars_s.html +++ b/functions_vars_s.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_t.html b/functions_vars_t.html index cb7822f..aa07719 100644 --- a/functions_vars_t.html +++ b/functions_vars_t.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_u.html b/functions_vars_u.html index 01a653c..de4c7df 100644 --- a/functions_vars_u.html +++ b/functions_vars_u.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_v.html b/functions_vars_v.html index cc15202..43be384 100644 --- a/functions_vars_v.html +++ b/functions_vars_v.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_w.html b/functions_vars_w.html index 6e58cce..1c0355d 100644 --- a/functions_vars_w.html +++ b/functions_vars_w.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_x.html b/functions_vars_x.html index 88eb4e4..f6b04b8 100644 --- a/functions_vars_x.html +++ b/functions_vars_x.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_y.html b/functions_vars_y.html index 62d9497..0833e9d 100644 --- a/functions_vars_y.html +++ b/functions_vars_y.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_vars_z.html b/functions_vars_z.html index 04f1c69..662164d 100644 --- a/functions_vars_z.html +++ b/functions_vars_z.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_w.html b/functions_w.html index 8449765..f2163dd 100644 --- a/functions_w.html +++ b/functions_w.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_x.html b/functions_x.html index d44d097..9b2047c 100644 --- a/functions_x.html +++ b/functions_x.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_y.html b/functions_y.html index 97a58b9..663d006 100644 --- a/functions_y.html +++ b/functions_y.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/functions_z.html b/functions_z.html index a5ae59d..7a77530 100644 --- a/functions_z.html +++ b/functions_z.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/get_system_language_2source_2main_8c-example.html b/get_system_language_2source_2main_8c-example.html index edfdd32..4194b76 100644 --- a/get_system_language_2source_2main_8c-example.html +++ b/get_system_language_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/gfx_8h.html b/gfx_8h.html index 0efaac0..ce782c3 100644 --- a/gfx_8h.html +++ b/gfx_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -149,6 +149,9 @@ Functions void gfxSet3D (bool enable)  Enables the 3D stereoscopic effect. More...
      +bool gfxIs3D (void) + Retrieves the status of the 3D stereoscopic effect. More...
    +  void gfxSetScreenFormat (gfxScreen_t screen, GSPGPU_FramebufferFormats format)  Changes the color format of a screen. More...
      @@ -161,6 +164,9 @@ Functions void gfxFlushBuffers (void)  Flushes the current framebuffers. More...
      +void gfxConfigScreen (gfxScreen_t scr, bool immediate) + Updates the configuration of the specified screen (swapping the buffers if double-buffering is enabled). More...
    +  void gfxSwapBuffers (void)  Swaps the buffers and sets the gsp state. More...
      @@ -234,6 +240,41 @@ Variables

    Function Documentation

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    void gfxConfigScreen (gfxScreen_t scr,
    bool immediate 
    )
    +
    + +

    Updates the configuration of the specified screen (swapping the buffers if double-buffering is enabled).

    +
    Parameters
    + + + +
    scrScreen to configure.
    immediateWhether to apply the updated configuration immediately or let GSPGPU apply it after the next GX transfer completes.
    +
    +
    + +
    +
    @@ -250,7 +291,7 @@ Variables

    Closes the gsp service and frees the framebuffers.

    Just call it when you're done.

    -
    Examples:
    app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.
    +
    Examples:
    app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/fragment_light/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/gpusprites/source/main.c, graphics/gpu/immediate/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.
    @@ -322,7 +363,7 @@ Variables
    Returns
    A pointer to the current framebuffer of the choosen screen.

    Please remember that the returned pointer will change after each call to gfxSwapBuffers if double buffering is enabled.

    -
    Examples:
    graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, http/source/main.c, mvd/source/main.c, qtm/source/main.c, and sdmc/source/main.c.
    +
    Examples:
    graphics/bitmap/24bit-color/source/main.c, http/source/main.c, mvd/source/main.c, qtm/source/main.c, and sdmc/source/main.c.
    @@ -415,8 +456,27 @@ You should always call GSP_BGR8_OES format in linear memory. This is the same as calling :

    1 gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false);
    Note
    You should always call gfxExit once done to free the memory and services
    -
    Examples:
    app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.
    +
    Examples:
    app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/fragment_light/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/gpusprites/source/main.c, graphics/gpu/immediate/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, threads/thread-basic/source/main.c, and time/rtc/source/main.c.
    + + + +
    +
    + + + + + + + + +
    bool gfxIs3D (void )
    +
    + +

    Retrieves the status of the 3D stereoscopic effect.

    +
    Returns
    true if 3D enabled, false otherwise.
    +
    @@ -440,7 +500,8 @@ You should always call graphics/gpu/fragment_light/source/main.c. +
    @@ -552,7 +613,7 @@ You should always call graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, and sdmc/source/main.c. +
    Examples:
    sdmc/source/main.c.
    diff --git a/gfx_8h_source.html b/gfx_8h_source.html index dbdb1cc..cd37793 100644 --- a/gfx_8h_source.html +++ b/gfx_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -175,86 +175,101 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    82 void gfxSet3D(bool enable);
    83 
    84 /**
    -
    85  * @brief Changes the color format of a screen
    -
    86  * @param screen The screen of which format should be changed
    -
    87  * @param format One of the gsp pixel formats.
    -
    88  */
    - -
    90 
    -
    91 /**
    -
    92  * @brief Gets a screen pixel format.
    -
    93  * @param screen Screen to get the pixel format of.
    -
    94  * @return the pixel format of the chosen screen set by ctrulib.
    -
    95  */
    - -
    97 
    -
    98 /**
    -
    99  * @brief Sets whether to use ctrulib's double buffering
    -
    100  * @param screen Screen to toggle double buffering for.
    -
    101  * @param doubleBuffering Whether to use double buffering.
    -
    102  *
    -
    103  * ctrulib is by default using a double buffering scheme.
    -
    104  * If you do not want to swap one of the screen framebuffers when @ref gfxSwapBuffers or @ref gfxSwapBuffers is called,
    -
    105  * then you have to disable double buffering.
    -
    106  *
    -
    107  * It is however recommended to call @ref gfxSwapBuffers even if double buffering is disabled
    -
    108  * for both screens if you want to keep the gsp configuration up to date.
    -
    109  */
    -
    110 void gfxSetDoubleBuffering(gfxScreen_t screen, bool doubleBuffering);
    -
    111 
    -
    112 /**
    -
    113  * @brief Flushes the current framebuffers
    -
    114  *
    -
    115  * Use this if the data within your framebuffers changes a lot and that you want to make sure everything was updated correctly.
    -
    116  * This shouldn't be needed and has a significant overhead.
    -
    117  */
    -
    118 void gfxFlushBuffers(void);
    -
    119 
    -
    120 /**
    -
    121  * @brief Swaps the buffers and sets the gsp state
    -
    122  *
    -
    123  * This is to be called to update the gsp state and swap the framebuffers.
    -
    124  * LCD rendering should start as soon as the gsp state is set.
    -
    125  * When using the GPU, call @ref gfxSwapBuffers instead.
    -
    126  */
    -
    127 void gfxSwapBuffers(void);
    -
    128 
    -
    129 /**
    -
    130  * @brief Swaps the framebuffers
    -
    131  *
    -
    132  * This is the version to be used with the GPU since the GPU will use the gsp shared memory,
    -
    133  * so the gsp state mustn't be set directly by the user.
    -
    134  */
    -
    135 void gfxSwapBuffersGpu(void);
    -
    136 
    -
    137 ///@}
    -
    138 
    -
    139 
    -
    140 ///@name Helper
    -
    141 ///@{
    -
    142 /**
    -
    143  * @brief Retrieves a framebuffer information.
    -
    144  * @param screen Screen to retrieve framebuffer information for.
    -
    145  * @param side Side of the screen to retrieve framebuffer information for.
    -
    146  * @param width Pointer that will hold the width of the framebuffer in pixels.
    -
    147  * @param height Pointer that will hold the height of the framebuffer in pixels.
    -
    148  * @return A pointer to the current framebuffer of the choosen screen.
    -
    149  *
    -
    150  * Please remember that the returned pointer will change after each call to gfxSwapBuffers if double buffering is enabled.
    -
    151  */
    -
    152 u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height);
    -
    153 ///@}
    -
    154 
    -
    155 //global variables
    -
    156 extern u8* gfxTopLeftFramebuffers[2];
    -
    157 extern u8* gfxTopRightFramebuffers[2];
    -
    158 extern u8* gfxBottomFramebuffers[2];
    +
    85  * @brief Retrieves the status of the 3D stereoscopic effect.
    +
    86  * @return true if 3D enabled, false otherwise.
    +
    87  */
    +
    88 bool gfxIs3D(void);
    +
    89 
    +
    90 /**
    +
    91  * @brief Changes the color format of a screen
    +
    92  * @param screen The screen of which format should be changed
    +
    93  * @param format One of the gsp pixel formats.
    +
    94  */
    + +
    96 
    +
    97 /**
    +
    98  * @brief Gets a screen pixel format.
    +
    99  * @param screen Screen to get the pixel format of.
    +
    100  * @return the pixel format of the chosen screen set by ctrulib.
    +
    101  */
    + +
    103 
    +
    104 /**
    +
    105  * @brief Sets whether to use ctrulib's double buffering
    +
    106  * @param screen Screen to toggle double buffering for.
    +
    107  * @param doubleBuffering Whether to use double buffering.
    +
    108  *
    +
    109  * ctrulib is by default using a double buffering scheme.
    +
    110  * If you do not want to swap one of the screen framebuffers when @ref gfxSwapBuffers or @ref gfxSwapBuffers is called,
    +
    111  * then you have to disable double buffering.
    +
    112  *
    +
    113  * It is however recommended to call @ref gfxSwapBuffers even if double buffering is disabled
    +
    114  * for both screens if you want to keep the gsp configuration up to date.
    +
    115  */
    +
    116 void gfxSetDoubleBuffering(gfxScreen_t screen, bool doubleBuffering);
    +
    117 
    +
    118 /**
    +
    119  * @brief Flushes the current framebuffers
    +
    120  *
    +
    121  * Use this if the data within your framebuffers changes a lot and that you want to make sure everything was updated correctly.
    +
    122  * This shouldn't be needed and has a significant overhead.
    +
    123  */
    +
    124 void gfxFlushBuffers(void);
    +
    125 
    +
    126 /**
    +
    127  * @brief Updates the configuration of the specified screen (swapping the buffers if double-buffering is enabled).
    +
    128  * @param scr Screen to configure.
    +
    129  * @param immediate Whether to apply the updated configuration immediately or let GSPGPU apply it after the next GX transfer completes.
    +
    130  */
    +
    131 void gfxConfigScreen(gfxScreen_t scr, bool immediate);
    +
    132 
    +
    133 /**
    +
    134  * @brief Swaps the buffers and sets the gsp state
    +
    135  *
    +
    136  * This is to be called to update the gsp state and swap the framebuffers.
    +
    137  * LCD rendering should start as soon as the gsp state is set.
    +
    138  * When using the GPU, call @ref gfxSwapBuffers instead.
    +
    139  */
    +
    140 void gfxSwapBuffers(void);
    +
    141 
    +
    142 /**
    +
    143  * @brief Swaps the framebuffers
    +
    144  *
    +
    145  * This is the version to be used with the GPU since the GPU will use the gsp shared memory,
    +
    146  * so the gsp state mustn't be set directly by the user.
    +
    147  */
    +
    148 void gfxSwapBuffersGpu(void);
    +
    149 
    +
    150 ///@}
    +
    151 
    +
    152 
    +
    153 ///@name Helper
    +
    154 ///@{
    +
    155 /**
    +
    156  * @brief Retrieves a framebuffer information.
    +
    157  * @param screen Screen to retrieve framebuffer information for.
    +
    158  * @param side Side of the screen to retrieve framebuffer information for.
    +
    159  * @param width Pointer that will hold the width of the framebuffer in pixels.
    +
    160  * @param height Pointer that will hold the height of the framebuffer in pixels.
    +
    161  * @return A pointer to the current framebuffer of the choosen screen.
    +
    162  *
    +
    163  * Please remember that the returned pointer will change after each call to gfxSwapBuffers if double buffering is enabled.
    +
    164  */
    +
    165 u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height);
    +
    166 ///@}
    +
    167 
    +
    168 //global variables
    +
    169 extern u8* gfxTopLeftFramebuffers[2];
    +
    170 extern u8* gfxTopRightFramebuffers[2];
    +
    171 extern u8* gfxBottomFramebuffers[2];
    Various system types.
    +
    void gfxConfigScreen(gfxScreen_t scr, bool immediate)
    Updates the configuration of the specified screen (swapping the buffers if double-buffering is enable...
    uint16_t u16
    16-bit unsigned integer
    Definition: types.h:22
    GSPGPU service.
    Bottom screen.
    Definition: gfx.h:23
    GSPGPU_FramebufferFormats
    Framebuffer format.
    Definition: gspgpu.h:22
    void gfxSwapBuffers(void)
    Swaps the buffers and sets the gsp state.
    +
    bool gfxIs3D(void)
    Retrieves the status of the 3D stereoscopic effect.
    void gfxSetDoubleBuffering(gfxScreen_t screen, bool doubleBuffering)
    Sets whether to use ctrulib's double buffering.
    uint8_t u8
    would be nice if newlib had this already
    Definition: types.h:21
    void gfxInitDefault(void)
    Initializes the LCD framebuffers with default parameters.
    diff --git a/globals.html b/globals.html index aabeb90..56b39bb 100644 --- a/globals.html +++ b/globals.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -140,6 +140,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • __strex() : synchronization.h
  • +
  • __sync_get_arbiter() +: synchronization.h +
  • diff --git a/globals_a.html b/globals_a.html index 6eaab69..75f2970 100644 --- a/globals_a.html +++ b/globals_a.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -170,6 +170,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • AM_InitializeExternalTitleDatabase() : am.h
  • +
  • AM_InstallFirm() +: am.h +
  • AM_InstallNativeFirm() : am.h
  • diff --git a/globals_b.html b/globals_b.html index 6d4f097..d6a0499 100644 --- a/globals_b.html +++ b/globals_b.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_c.html b/globals_c.html index a3f45a2..a4af651 100644 --- a/globals_c.html +++ b/globals_c.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_d.html b/globals_d.html index e7430e3..93a1604 100644 --- a/globals_d.html +++ b/globals_d.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs.html b/globals_defs.html index 29754e7..85eba3c 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_b.html b/globals_defs_b.html index 0dcd441..ea9e2bb 100644 --- a/globals_defs_b.html +++ b/globals_defs_b.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_c.html b/globals_defs_c.html index 01cf3c6..f7c5ffc 100644 --- a/globals_defs_c.html +++ b/globals_defs_c.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_d.html b/globals_defs_d.html index 0498cfe..b0333f5 100644 --- a/globals_defs_d.html +++ b/globals_defs_d.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_g.html b/globals_defs_g.html index 095aed8..3651a6a 100644 --- a/globals_defs_g.html +++ b/globals_defs_g.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_h.html b/globals_defs_h.html index d52777c..2364d45 100644 --- a/globals_defs_h.html +++ b/globals_defs_h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_k.html b/globals_defs_k.html index 9dda32c..767c7a2 100644 --- a/globals_defs_k.html +++ b/globals_defs_k.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_m.html b/globals_defs_m.html index fa8bd73..f994e9f 100644 --- a/globals_defs_m.html +++ b/globals_defs_m.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_n.html b/globals_defs_n.html index d21cb0f..b358430 100644 --- a/globals_defs_n.html +++ b/globals_defs_n.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_p.html b/globals_defs_p.html index 789fe7e..7c0db3a 100644 --- a/globals_defs_p.html +++ b/globals_defs_p.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_r.html b/globals_defs_r.html index a7ee68e..2c73857 100644 --- a/globals_defs_r.html +++ b/globals_defs_r.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_s.html b/globals_defs_s.html index eb8b81c..9725e21 100644 --- a/globals_defs_s.html +++ b/globals_defs_s.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_t.html b/globals_defs_t.html index 48ec22b..589e4da 100644 --- a/globals_defs_t.html +++ b/globals_defs_t.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_defs_u.html b/globals_defs_u.html index 8fa4a12..606863e 100644 --- a/globals_defs_u.html +++ b/globals_defs_u.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_e.html b/globals_e.html index 7b87af1..1ca0c52 100644 --- a/globals_e.html +++ b/globals_e.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_enum.html b/globals_enum.html index 7c6cfd3..0638d14 100644 --- a/globals_enum.html +++ b/globals_enum.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval.html b/globals_eval.html index 6a3cce7..b525346 100644 --- a/globals_eval.html +++ b/globals_eval.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_b.html b/globals_eval_b.html index 08d74ef..e2a06ca 100644 --- a/globals_eval_b.html +++ b/globals_eval_b.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_c.html b/globals_eval_c.html index 5d256a9..fd76cf5 100644 --- a/globals_eval_c.html +++ b/globals_eval_c.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_d.html b/globals_eval_d.html index c1dac2d..2e22923 100644 --- a/globals_eval_d.html +++ b/globals_eval_d.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_e.html b/globals_eval_e.html index ac4deef..180b323 100644 --- a/globals_eval_e.html +++ b/globals_eval_e.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_f.html b/globals_eval_f.html index 4badaa6..f43ab0c 100644 --- a/globals_eval_f.html +++ b/globals_eval_f.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_g.html b/globals_eval_g.html index 791d575..5bb7379 100644 --- a/globals_eval_g.html +++ b/globals_eval_g.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_h.html b/globals_eval_h.html index 7bd43ac..11e9326 100644 --- a/globals_eval_h.html +++ b/globals_eval_h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_i.html b/globals_eval_i.html index 05d3d0a..1ca1e39 100644 --- a/globals_eval_i.html +++ b/globals_eval_i.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_k.html b/globals_eval_k.html index 3db4952..3d25cab 100644 --- a/globals_eval_k.html +++ b/globals_eval_k.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_l.html b/globals_eval_l.html index 1a3f202..6e30006 100644 --- a/globals_eval_l.html +++ b/globals_eval_l.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_m.html b/globals_eval_m.html index 9227867..0a20dfc 100644 --- a/globals_eval_m.html +++ b/globals_eval_m.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_n.html b/globals_eval_n.html index 95b41d0..e059567 100644 --- a/globals_eval_n.html +++ b/globals_eval_n.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_o.html b/globals_eval_o.html index 051b976..dddde20 100644 --- a/globals_eval_o.html +++ b/globals_eval_o.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_p.html b/globals_eval_p.html index 3ff1ce9..95ace3f 100644 --- a/globals_eval_p.html +++ b/globals_eval_p.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_r.html b/globals_eval_r.html index 64e26d3..7343028 100644 --- a/globals_eval_r.html +++ b/globals_eval_r.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_s.html b/globals_eval_s.html index 876631f..9dcf6ba 100644 --- a/globals_eval_s.html +++ b/globals_eval_s.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_t.html b/globals_eval_t.html index beab036..3ef3618 100644 --- a/globals_eval_t.html +++ b/globals_eval_t.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_u.html b/globals_eval_u.html index 95027bb..a965ba0 100644 --- a/globals_eval_u.html +++ b/globals_eval_u.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_v.html b/globals_eval_v.html index 1662e2e..5c8d10a 100644 --- a/globals_eval_v.html +++ b/globals_eval_v.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_eval_w.html b/globals_eval_w.html index e5e186b..a6116fd 100644 --- a/globals_eval_w.html +++ b/globals_eval_w.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_f.html b/globals_f.html index 87e8597..f8919ab 100644 --- a/globals_f.html +++ b/globals_f.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func.html b/globals_func.html index 3219a9c..d5d3d3e 100644 --- a/globals_func.html +++ b/globals_func.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -137,6 +137,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • __strex() : synchronization.h
  • +
  • __sync_get_arbiter() +: synchronization.h +
  • diff --git a/globals_func_a.html b/globals_func_a.html index 100f39c..556b315 100644 --- a/globals_func_a.html +++ b/globals_func_a.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -164,6 +164,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • AM_InitializeExternalTitleDatabase() : am.h
  • +
  • AM_InstallFirm() +: am.h +
  • AM_InstallNativeFirm() : am.h
  • diff --git a/globals_func_c.html b/globals_func_c.html index b8b51c9..5ccb062 100644 --- a/globals_func_c.html +++ b/globals_func_c.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_d.html b/globals_func_d.html index e6994da..1a2cb89 100644 --- a/globals_func_d.html +++ b/globals_func_d.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_e.html b/globals_func_e.html index 87fbffb..352a1b1 100644 --- a/globals_func_e.html +++ b/globals_func_e.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_f.html b/globals_func_f.html index 59863cd..1544fa6 100644 --- a/globals_func_f.html +++ b/globals_func_f.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_g.html b/globals_func_g.html index 277a588..2fcfadd 100644 --- a/globals_func_g.html +++ b/globals_func_g.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -134,6 +134,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • getThreadStaticBuffers() : svc.h
  • +
  • gfxConfigScreen() +: gfx.h +
  • gfxExit() : gfx.h
  • @@ -152,6 +155,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • gfxInitDefault() : gfx.h
  • +
  • gfxIs3D() +: gfx.h +
  • gfxSet3D() : gfx.h
  • @@ -332,9 +338,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • gspLcdInit() : gsplcd.h
  • +
  • gspSetEventCallback() +: gspgpu.h +
  • gspSubmitGxCommand() : gspgpu.h
  • +
  • gspWaitForAnyEvent() +: gspgpu.h +
  • gspWaitForEvent() : gspgpu.h
  • diff --git a/globals_func_h.html b/globals_func_h.html index 66ae579..80f0a42 100644 --- a/globals_func_h.html +++ b/globals_func_h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_i.html b/globals_func_i.html index 4f6d116..529e40f 100644 --- a/globals_func_i.html +++ b/globals_func_i.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_l.html b/globals_func_l.html index f82cd12..75b005c 100644 --- a/globals_func_l.html +++ b/globals_func_l.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_m.html b/globals_func_m.html index 9012c82..5c07945 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_n.html b/globals_func_n.html index c8824b3..9a26cb6 100644 --- a/globals_func_n.html +++ b/globals_func_n.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_o.html b/globals_func_o.html index e120714..43a5c66 100644 --- a/globals_func_o.html +++ b/globals_func_o.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_p.html b/globals_func_p.html index 9059199..643c577 100644 --- a/globals_func_p.html +++ b/globals_func_p.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_q.html b/globals_func_q.html index 9b681be..aa17d94 100644 --- a/globals_func_q.html +++ b/globals_func_q.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_r.html b/globals_func_r.html index 8a7d640..0ae1e72 100644 --- a/globals_func_r.html +++ b/globals_func_r.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_s.html b/globals_func_s.html index 5d6684a..732ebaf 100644 --- a/globals_func_s.html +++ b/globals_func_s.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_t.html b/globals_func_t.html index 4a9f0b4..10dd708 100644 --- a/globals_func_t.html +++ b/globals_func_t.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_u.html b/globals_func_u.html index 437093d..67609b4 100644 --- a/globals_func_u.html +++ b/globals_func_u.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_v.html b/globals_func_v.html index c567828..11a804a 100644 --- a/globals_func_v.html +++ b/globals_func_v.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_func_y.html b/globals_func_y.html index a2a1803..5366db4 100644 --- a/globals_func_y.html +++ b/globals_func_y.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_g.html b/globals_g.html index c9b05a5..c9eea6f 100644 --- a/globals_g.html +++ b/globals_g.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -167,6 +167,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • GFX_TOP : gfx.h
  • +
  • gfxConfigScreen() +: gfx.h +
  • gfxExit() : gfx.h
  • @@ -185,6 +188,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • gfxInitDefault() : gfx.h
  • +
  • gfxIs3D() +: gfx.h +
  • gfxScreen_t : gfx.h
  • @@ -3479,9 +3485,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • gspLcdInit() : gsplcd.h
  • +
  • gspSetEventCallback() +: gspgpu.h +
  • gspSubmitGxCommand() : gspgpu.h
  • +
  • gspWaitForAnyEvent() +: gspgpu.h +
  • gspWaitForDMA : gspgpu.h
  • diff --git a/globals_h.html b/globals_h.html index 11cd65a..0807045 100644 --- a/globals_h.html +++ b/globals_h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_i.html b/globals_i.html index edbfd5a..33f7ea2 100644 --- a/globals_i.html +++ b/globals_i.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_k.html b/globals_k.html index 8210c03..ef5b48c 100644 --- a/globals_k.html +++ b/globals_k.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_l.html b/globals_l.html index c11bad7..defb8fd 100644 --- a/globals_l.html +++ b/globals_l.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_m.html b/globals_m.html index 6b29a63..e8f20e1 100644 --- a/globals_m.html +++ b/globals_m.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_n.html b/globals_n.html index 01dd2e9..44aed5b 100644 --- a/globals_n.html +++ b/globals_n.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_o.html b/globals_o.html index ee7f526..6f78688 100644 --- a/globals_o.html +++ b/globals_o.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_p.html b/globals_p.html index f909291..9d012b8 100644 --- a/globals_p.html +++ b/globals_p.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_q.html b/globals_q.html index 0a79fe5..84f86cb 100644 --- a/globals_q.html +++ b/globals_q.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_r.html b/globals_r.html index 9525fb1..a186750 100644 --- a/globals_r.html +++ b/globals_r.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_s.html b/globals_s.html index 0d56d8e..93f4d0c 100644 --- a/globals_s.html +++ b/globals_s.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_t.html b/globals_t.html index e3a49ed..a9d3b0e 100644 --- a/globals_t.html +++ b/globals_t.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_type.html b/globals_type.html index d0ae1dd..14641ab 100644 --- a/globals_type.html +++ b/globals_type.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_u.html b/globals_u.html index 374d6e9..c16dd4a 100644 --- a/globals_u.html +++ b/globals_u.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_v.html b/globals_v.html index c4e2f85..e5b3897 100644 --- a/globals_v.html +++ b/globals_v.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_vars.html b/globals_vars.html index 226c554..6b44814 100644 --- a/globals_vars.html +++ b/globals_vars.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_w.html b/globals_w.html index 682c568..999ec7a 100644 --- a/globals_w.html +++ b/globals_w.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/globals_y.html b/globals_y.html index 12f3d4e..49608a8 100644 --- a/globals_y.html +++ b/globals_y.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/gpu-old_8h.html b/gpu-old_8h.html index 2e288de..a1a5a2b 100644 --- a/gpu-old_8h.html +++ b/gpu-old_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -209,8 +209,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -253,8 +252,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -315,8 +313,7 @@ Functions

    Finishes drawing.

    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -341,8 +338,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -385,8 +381,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -451,8 +446,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -495,8 +489,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -581,8 +574,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -632,8 +624,7 @@ Functions
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -742,8 +733,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -768,8 +758,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -819,8 +808,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -920,8 +908,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -978,8 +965,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -1057,8 +1043,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -1122,8 +1107,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -1184,8 +1168,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/textured_cube/source/main.c.
    -
    + @@ -1249,8 +1232,7 @@ Only the first four TEV stages can write to the combiner buffer.
    Deprecated:
    -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + diff --git a/gpu-old_8h_source.html b/gpu-old_8h_source.html index 9073fd7..4c7c58a 100644 --- a/gpu-old_8h_source.html +++ b/gpu-old_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/gpu_8h.html b/gpu_8h.html index 52ae550..a2e54bc 100644 --- a/gpu_8h.html +++ b/gpu_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -480,8 +480,7 @@ Variables -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + diff --git a/gpu_8h_source.html b/gpu_8h_source.html index ccb11f5..e969939 100644 --- a/gpu_8h_source.html +++ b/gpu_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/graphics_2bitmap_224bit-color_2source_2main_8c-example.html b/graphics_2bitmap_224bit-color_2source_2main_8c-example.html index e9f805b..243c7f9 100644 --- a/graphics_2bitmap_224bit-color_2source_2main_8c-example.html +++ b/graphics_2bitmap_224bit-color_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/graphics_2gpu_2fragment_light_2source_2main_8c-example.html b/graphics_2gpu_2fragment_light_2source_2main_8c-example.html new file mode 100644 index 0000000..a657f89 --- /dev/null +++ b/graphics_2gpu_2fragment_light_2source_2main_8c-example.html @@ -0,0 +1,333 @@ + + + + + + +libctru: graphics/gpu/fragment_light/source/main.c + + + + + + + + + + +
    +
    + + + + + + +
    +
    libctru +  v1.1.0 +
    +
    +
    + + + + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    graphics/gpu/fragment_light/source/main.c
    +
    +
    +
    #include <3ds.h>
    +
    #include <citro3d.h>
    +
    #include <string.h>
    +
    #include "vshader_shbin.h"
    +
    +
    #define CLEAR_COLOR 0x68B0D8FF
    +
    +
    #define DISPLAY_TRANSFER_FLAGS \
    +
    (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
    +
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
    +
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    +
    +
    typedef struct { float position[3]; float texcoord[2]; float normal[3]; } vertex;
    +
    +
    static const vertex vertex_list[] =
    +
    {
    +
    // First face (PZ)
    +
    // First triangle
    +
    { {-0.5f, -0.5f, +0.5f}, {0.0f, 0.0f}, {0.0f, 0.0f, +1.0f} },
    +
    { {+0.5f, -0.5f, +0.5f}, {1.0f, 0.0f}, {0.0f, 0.0f, +1.0f} },
    +
    { {+0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {0.0f, 0.0f, +1.0f} },
    +
    // Second triangle
    +
    { {+0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {0.0f, 0.0f, +1.0f} },
    +
    { {-0.5f, +0.5f, +0.5f}, {0.0f, 1.0f}, {0.0f, 0.0f, +1.0f} },
    +
    { {-0.5f, -0.5f, +0.5f}, {0.0f, 0.0f}, {0.0f, 0.0f, +1.0f} },
    +
    +
    // Second face (MZ)
    +
    // First triangle
    +
    { {-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {0.0f, 0.0f, -1.0f} },
    +
    { {-0.5f, +0.5f, -0.5f}, {1.0f, 0.0f}, {0.0f, 0.0f, -1.0f} },
    +
    { {+0.5f, +0.5f, -0.5f}, {1.0f, 1.0f}, {0.0f, 0.0f, -1.0f} },
    +
    // Second triangle
    +
    { {+0.5f, +0.5f, -0.5f}, {1.0f, 1.0f}, {0.0f, 0.0f, -1.0f} },
    +
    { {+0.5f, -0.5f, -0.5f}, {0.0f, 1.0f}, {0.0f, 0.0f, -1.0f} },
    +
    { {-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {0.0f, 0.0f, -1.0f} },
    +
    +
    // Third face (PX)
    +
    // First triangle
    +
    { {+0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {+1.0f, 0.0f, 0.0f} },
    +
    { {+0.5f, +0.5f, -0.5f}, {1.0f, 0.0f}, {+1.0f, 0.0f, 0.0f} },
    +
    { {+0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {+1.0f, 0.0f, 0.0f} },
    +
    // Second triangle
    +
    { {+0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {+1.0f, 0.0f, 0.0f} },
    +
    { {+0.5f, -0.5f, +0.5f}, {0.0f, 1.0f}, {+1.0f, 0.0f, 0.0f} },
    +
    { {+0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {+1.0f, 0.0f, 0.0f} },
    +
    +
    // Fourth face (MX)
    +
    // First triangle
    +
    { {-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {-1.0f, 0.0f, 0.0f} },
    +
    { {-0.5f, -0.5f, +0.5f}, {1.0f, 0.0f}, {-1.0f, 0.0f, 0.0f} },
    +
    { {-0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {-1.0f, 0.0f, 0.0f} },
    +
    // Second triangle
    +
    { {-0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {-1.0f, 0.0f, 0.0f} },
    +
    { {-0.5f, +0.5f, -0.5f}, {0.0f, 1.0f}, {-1.0f, 0.0f, 0.0f} },
    +
    { {-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {-1.0f, 0.0f, 0.0f} },
    +
    +
    // Fifth face (PY)
    +
    // First triangle
    +
    { {-0.5f, +0.5f, -0.5f}, {0.0f, 0.0f}, {0.0f, +1.0f, 0.0f} },
    +
    { {-0.5f, +0.5f, +0.5f}, {1.0f, 0.0f}, {0.0f, +1.0f, 0.0f} },
    +
    { {+0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {0.0f, +1.0f, 0.0f} },
    +
    // Second triangle
    +
    { {+0.5f, +0.5f, +0.5f}, {1.0f, 1.0f}, {0.0f, +1.0f, 0.0f} },
    +
    { {+0.5f, +0.5f, -0.5f}, {0.0f, 1.0f}, {0.0f, +1.0f, 0.0f} },
    +
    { {-0.5f, +0.5f, -0.5f}, {0.0f, 0.0f}, {0.0f, +1.0f, 0.0f} },
    +
    +
    // Sixth face (MY)
    +
    // First triangle
    +
    { {-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {0.0f, -1.0f, 0.0f} },
    +
    { {+0.5f, -0.5f, -0.5f}, {1.0f, 0.0f}, {0.0f, -1.0f, 0.0f} },
    +
    { {+0.5f, -0.5f, +0.5f}, {1.0f, 1.0f}, {0.0f, -1.0f, 0.0f} },
    +
    // Second triangle
    +
    { {+0.5f, -0.5f, +0.5f}, {1.0f, 1.0f}, {0.0f, -1.0f, 0.0f} },
    +
    { {-0.5f, -0.5f, +0.5f}, {0.0f, 1.0f}, {0.0f, -1.0f, 0.0f} },
    +
    { {-0.5f, -0.5f, -0.5f}, {0.0f, 0.0f}, {0.0f, -1.0f, 0.0f} },
    +
    };
    +
    +
    #define vertex_list_count (sizeof(vertex_list)/sizeof(vertex_list[0]))
    +
    +
    static DVLB_s* vshader_dvlb;
    +
    static shaderProgram_s program;
    +
    static int uLoc_projection, uLoc_modelView;
    +
    static C3D_Mtx projection;
    +
    +
    static C3D_LightEnv lightEnv;
    +
    static C3D_Light light;
    +
    static C3D_LightLut lut_Phong;
    +
    +
    static void* vbo_data;
    +
    static float angleX = 0.0, angleY = 0.0;
    +
    +
    static void sceneInit(void)
    +
    {
    +
    // Load the vertex shader, create a shader program and bind it
    +
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    +
    shaderProgramInit(&program);
    +
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    C3D_BindProgram(&program);
    +
    +
    // Get the location of the uniforms
    +
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    +
    uLoc_modelView = shaderInstanceGetUniformLocation(program.vertexShader, "modelView");
    +
    +
    // Configure attributes for use with the vertex shader
    +
    C3D_AttrInfo* attrInfo = C3D_GetAttrInfo();
    +
    AttrInfo_Init(attrInfo);
    +
    AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
    +
    AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 2); // v1=texcoord
    +
    AttrInfo_AddLoader(attrInfo, 2, GPU_FLOAT, 3); // v2=normal
    +
    +
    // Create the VBO (vertex buffer object)
    +
    vbo_data = linearAlloc(sizeof(vertex_list));
    +
    memcpy(vbo_data, vertex_list, sizeof(vertex_list));
    +
    +
    // Configure buffers
    +
    C3D_BufInfo* bufInfo = C3D_GetBufInfo();
    +
    BufInfo_Init(bufInfo);
    +
    BufInfo_Add(bufInfo, vbo_data, sizeof(vertex), 3, 0x210);
    +
    +
    // Configure the first fragment shading substage to blend the fragment primary color
    +
    // with the fragment secondary color.
    +
    // See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
    +
    C3D_TexEnv* env = C3D_GetTexEnv(0);
    +
    C3D_TexEnvSrc(env, C3D_Both, GPU_FRAGMENT_PRIMARY_COLOR, GPU_FRAGMENT_SECONDARY_COLOR, 0);
    +
    C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
    +
    C3D_TexEnvFunc(env, C3D_Both, GPU_ADD);
    +
    +
    static const C3D_Material material =
    +
    {
    +
    { 0.2f, 0.2f, 0.2f }, //ambient
    +
    { 0.4f, 0.4f, 0.4f }, //diffuse
    +
    { 0.8f, 0.8f, 0.8f }, //specular0
    +
    { 0.0f, 0.0f, 0.0f }, //specular1
    +
    { 0.0f, 0.0f, 0.0f }, //emission
    +
    };
    +
    +
    C3D_LightEnvInit(&lightEnv);
    +
    C3D_LightEnvBind(&lightEnv);
    +
    C3D_LightEnvMaterial(&lightEnv, &material);
    +
    +
    LightLut_Phong(&lut_Phong, 30);
    +
    C3D_LightEnvLut(&lightEnv, GPU_LUT_D0, GPU_LUTINPUT_LN, false, &lut_Phong);
    +
    +
    C3D_FVec lightVec = { { 1.0, -0.5, 0.0, 0.0 } };
    +
    +
    C3D_LightInit(&light, &lightEnv);
    +
    C3D_LightColor(&light, 1.0, 1.0, 1.0);
    +
    C3D_LightPosition(&light, &lightVec);
    +
    }
    +
    +
    static void sceneRender(float iod)
    +
    {
    +
    // Compute the projection matrix
    +
    Mtx_PerspStereoTilt(&projection, 40.0f*M_PI/180.0f, 400.0f/240.0f, 0.01f, 1000.0f, iod, 2.0f);
    +
    +
    // Calculate the modelView matrix
    +
    C3D_Mtx modelView;
    +
    Mtx_Identity(&modelView);
    +
    Mtx_Translate(&modelView, 0.0, 0.0, -4.0 + sinf(angleX));
    +
    Mtx_RotateX(&modelView, angleX, true);
    +
    Mtx_RotateY(&modelView, angleY, true);
    +
    +
    // Rotate the cube each frame
    +
    if (iod >= 0.0f)
    +
    {
    +
    angleX += M_PI / 180;
    +
    angleY += M_PI / 360;
    +
    }
    +
    +
    // Update the uniforms
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_modelView, &modelView);
    +
    +
    // Draw the VBO
    +
    C3D_DrawArrays(GPU_TRIANGLES, 0, vertex_list_count);
    +
    }
    +
    +
    static void sceneExit(void)
    +
    {
    +
    // Free the VBO
    +
    linearFree(vbo_data);
    +
    +
    // Free the shader program
    +
    shaderProgramFree(&program);
    +
    DVLB_Free(vshader_dvlb);
    +
    }
    +
    +
    int main()
    +
    {
    +
    // Initialize graphics
    + +
    gfxSet3D(true); // Enable stereoscopic 3D
    +
    C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
    +
    +
    // Initialize the render targets
    +
    C3D_RenderTarget* targetLeft = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTarget* targetRight = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTargetSetClear(targetLeft, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetClear(targetRight, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetOutput(targetLeft, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
    +
    C3D_RenderTargetSetOutput(targetRight, GFX_TOP, GFX_RIGHT, DISPLAY_TRANSFER_FLAGS);
    +
    +
    // Initialize the scene
    +
    sceneInit();
    +
    +
    // Main loop
    +
    while (aptMainLoop())
    +
    {
    + +
    +
    // Respond to user input
    +
    u32 kDown = hidKeysDown();
    +
    if (kDown & KEY_START)
    +
    break; // break in order to return to hbmenu
    +
    +
    float slider = osGet3DSliderState();
    +
    float iod = slider/3;
    +
    +
    // Render the scene
    +
    C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
    +
    {
    +
    C3D_FrameDrawOn(targetLeft);
    +
    sceneRender(-iod);
    +
    +
    if (iod > 0.0f)
    +
    {
    +
    C3D_FrameDrawOn(targetRight);
    +
    sceneRender(iod);
    +
    }
    +
    }
    +
    C3D_FrameEnd(0);
    +
    }
    +
    +
    // Deinitialize the scene
    +
    sceneExit();
    +
    +
    // Deinitialize graphics
    +
    C3D_Fini();
    + +
    return 0;
    +
    }
    +
    + + + + diff --git a/graphics_2gpu_2geoshader_2source_2main_8c-example.html b/graphics_2gpu_2geoshader_2source_2main_8c-example.html index 17d4620..a8c7713 100644 --- a/graphics_2gpu_2geoshader_2source_2main_8c-example.html +++ b/graphics_2gpu_2geoshader_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -81,483 +81,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    graphics/gpu/geoshader/source/main.c
    -

    graphics/gpu/geoshader/source/gpu.h

    /*
    -
    * Bare-bones simplistic GPU wrapper
    -
    * This library is common to all libctru GPU examples
    -
    */
    -
    -
    #pragma once
    +
    #include <3ds.h>
    +
    #include <citro3d.h>
    #include <string.h>
    -
    #include <3ds.h>
    -
    #include "3dmath.h"
    -
    -
    void gpuInit(void);
    -
    void gpuExit(void);
    -
    -
    void gpuClearBuffers(u32 clearColor);
    -
    -
    void gpuFrameBegin(void);
    -
    void gpuFrameEnd(void);
    -
    -
    // Configures the specified fixed-function fragment shading substage to be a no-operation
    -
    void GPU_SetDummyTexEnv(int id);
    +
    #include "program_shbin.h"
    -
    // Uploads an uniform matrix
    -
    static inline void GPU_SetFloatUniformMatrix(GPU_SHADER_TYPE type, int location, matrix_4x4* matrix)
    -
    {
    -
    GPU_SetFloatUniform(type, location, (u32*)matrix, 4);
    -
    }
    -

    graphics/gpu/geoshader/source/gpu.c

    #include "gpu.h"
    +
    #define CLEAR_COLOR 0x68B0D8FF
    #define DISPLAY_TRANSFER_FLAGS \
    (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    -
    static u32 *colorBuf, *depthBuf;
    -
    static u32 *cmdBuf;
    -
    -
    void gpuInit(void)
    -
    {
    -
    colorBuf = vramAlloc(400*240*4);
    -
    depthBuf = vramAlloc(400*240*4);
    -
    cmdBuf = linearAlloc(0x40000*4);
    -
    -
    GPU_Init(NULL);
    -
    GPU_Reset(NULL, cmdBuf, 0x40000);
    -
    }
    -
    -
    void gpuExit(void)
    -
    {
    -
    linearFree(cmdBuf);
    -
    vramFree(depthBuf);
    -
    vramFree(colorBuf);
    -
    }
    -
    -
    void gpuClearBuffers(u32 clearColor)
    -
    {
    - -
    colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
    -
    depthBuf, 0, &depthBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH);
    -
    gspWaitForPSC0(); // Wait for the fill to complete
    -
    }
    -
    -
    void gpuFrameBegin(void)
    -
    {
    -
    // Configure the viewport and the depth linear conversion function
    - -
    (u32*)osConvertVirtToPhys(depthBuf),
    -
    (u32*)osConvertVirtToPhys(colorBuf),
    -
    0, 0, 240, 400); // The top screen is physically 240x400 pixels
    -
    GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
    -
    -
    // Configure some boilerplate
    - -
    GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
    - - - -
    -
    // This is unknown
    -
    GPUCMD_AddMaskedWrite(GPUREG_0062, 0x1, 0);
    -
    GPUCMD_AddWrite(GPUREG_0118, 0);
    -
    -
    // Configure alpha blending and test
    - - -
    -
    int i;
    -
    for (i = 0; i < 6; i ++)
    -
    GPU_SetDummyTexEnv(i);
    -
    }
    -
    -
    void gpuFrameEnd(void)
    -
    {
    -
    // Finish rendering
    - - - -
    gspWaitForP3D(); // Wait for the rendering to complete
    -
    -
    // Transfer the GPU output to the framebuffer
    - -
    colorBuf, GX_BUFFER_DIM(240, 400),
    -
    (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 400),
    -
    DISPLAY_TRANSFER_FLAGS);
    -
    gspWaitForPPF(); // Wait for the transfer to complete
    -
    -
    // Reset the command buffer
    - -
    };
    -
    -
    void GPU_SetDummyTexEnv(int id)
    -
    {
    - - - -
    GPU_TEVOPERANDS(0, 0, 0),
    -
    GPU_TEVOPERANDS(0, 0, 0),
    - - -
    0xFFFFFFFF);
    -
    }
    -

    graphics/gpu/geoshader/source/3dmath.h

    /*
    -
    * Bare-bones simplistic 3D math library
    -
    * This library is common to all libctru GPU examples
    -
    */
    -
    -
    #pragma once
    -
    #include <string.h>
    -
    #include <stdbool.h>
    -
    #include <math.h>
    -
    -
    typedef union { struct { float w, z, y, x; }; float c[4]; } vector_4f;
    -
    typedef struct { vector_4f r[4]; } matrix_4x4;
    -
    -
    static inline float v4f_dp4(const vector_4f* a, const vector_4f* b)
    -
    {
    -
    return a->x*b->x + a->y*b->y + a->z*b->z + a->w*b->w;
    -
    }
    -
    -
    static inline float v4f_mod4(const vector_4f* a)
    -
    {
    -
    return sqrtf(v4f_dp4(a,a));
    -
    }
    -
    -
    static inline void v4f_norm4(vector_4f* vec)
    -
    {
    -
    float m = v4f_mod4(vec);
    -
    if (m == 0.0) return;
    -
    vec->x /= m;
    -
    vec->y /= m;
    -
    vec->z /= m;
    -
    vec->w /= m;
    -
    }
    -
    -
    static inline void m4x4_zeros(matrix_4x4* out)
    -
    {
    -
    memset(out, 0, sizeof(*out));
    -
    }
    -
    -
    static inline void m4x4_copy(matrix_4x4* out, const matrix_4x4* in)
    -
    {
    -
    memcpy(out, in, sizeof(*out));
    -
    }
    -
    -
    void m4x4_identity(matrix_4x4* out);
    -
    void m4x4_multiply(matrix_4x4* out, const matrix_4x4* a, const matrix_4x4* b);
    -
    -
    void m4x4_translate(matrix_4x4* mtx, float x, float y, float z);
    -
    void m4x4_scale(matrix_4x4* mtx, float x, float y, float z);
    -
    -
    void m4x4_rotate_x(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    void m4x4_rotate_y(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    void m4x4_rotate_z(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    -
    // Special versions of the projection matrices that take the 3DS' screen orientation into account
    -
    void m4x4_ortho_tilt(matrix_4x4* mtx, float left, float right, float bottom, float top, float near, float far);
    -
    void m4x4_persp_tilt(matrix_4x4* mtx, float fovy, float aspect, float near, float far);
    -

    graphics/gpu/geoshader/source/3dmath.c

    #include "3dmath.h"
    -
    -
    void m4x4_identity(matrix_4x4* out)
    -
    {
    -
    m4x4_zeros(out);
    -
    out->r[0].x = out->r[1].y = out->r[2].z = out->r[3].w = 1.0f;
    -
    }
    -
    -
    void m4x4_multiply(matrix_4x4* out, const matrix_4x4* a, const matrix_4x4* b)
    -
    {
    -
    int i, j;
    -
    for (i = 0; i < 4; i ++)
    -
    for (j = 0; j < 4; j ++)
    -
    out->r[j].c[i] = a->r[j].x*b->r[0].c[i] + a->r[j].y*b->r[1].c[i] + a->r[j].z*b->r[2].c[i] + a->r[j].w*b->r[3].c[i];
    -
    }
    -
    -
    void m4x4_translate(matrix_4x4* mtx, float x, float y, float z)
    -
    {
    -
    matrix_4x4 tm, om;
    -
    -
    m4x4_identity(&tm);
    -
    tm.r[0].w = x;
    -
    tm.r[1].w = y;
    -
    tm.r[2].w = z;
    -
    -
    m4x4_multiply(&om, mtx, &tm);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_scale(matrix_4x4* mtx, float x, float y, float z)
    -
    {
    -
    int i;
    -
    for (i = 0; i < 4; i ++)
    -
    {
    -
    mtx->r[i].x *= x;
    -
    mtx->r[i].y *= y;
    -
    mtx->r[i].z *= z;
    -
    }
    -
    }
    -
    -
    void m4x4_rotate_x(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = 1.0f;
    -
    rm.r[1].y = cosAngle;
    -
    rm.r[1].z = sinAngle;
    -
    rm.r[2].y = -sinAngle;
    -
    rm.r[2].z = cosAngle;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_rotate_y(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = cosAngle;
    -
    rm.r[0].z = sinAngle;
    -
    rm.r[1].y = 1.0f;
    -
    rm.r[2].x = -sinAngle;
    -
    rm.r[2].z = cosAngle;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_rotate_z(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = cosAngle;
    -
    rm.r[0].y = sinAngle;
    -
    rm.r[1].x = -sinAngle;
    -
    rm.r[1].y = cosAngle;
    -
    rm.r[2].z = 1.0f;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_ortho_tilt(matrix_4x4* mtx, float left, float right, float bottom, float top, float near, float far)
    -
    {
    -
    matrix_4x4 mp;
    -
    m4x4_zeros(&mp);
    -
    -
    // Build standard orthogonal projection matrix
    -
    mp.r[0].x = 2.0f / (right - left);
    -
    mp.r[0].w = (left + right) / (left - right);
    -
    mp.r[1].y = 2.0f / (top - bottom);
    -
    mp.r[1].w = (bottom + top) / (bottom - top);
    -
    mp.r[2].z = 2.0f / (near - far);
    -
    mp.r[2].w = (far + near) / (far - near);
    -
    mp.r[3].w = 1.0f;
    -
    -
    // Fix depth range to [-1, 0]
    -
    matrix_4x4 mp2, mp3;
    -
    m4x4_identity(&mp2);
    -
    mp2.r[2].z = 0.5;
    -
    mp2.r[2].w = -0.5;
    -
    m4x4_multiply(&mp3, &mp2, &mp);
    -
    -
    // Fix the 3DS screens' orientation by swapping the X and Y axis
    -
    m4x4_identity(&mp2);
    -
    mp2.r[0].x = 0.0;
    -
    mp2.r[0].y = 1.0;
    -
    mp2.r[1].x = -1.0; // flipped
    -
    mp2.r[1].y = 0.0;
    -
    m4x4_multiply(mtx, &mp2, &mp3);
    -
    }
    -
    -
    void m4x4_persp_tilt(matrix_4x4* mtx, float fovx, float invaspect, float near, float far)
    -
    {
    -
    // Notes:
    -
    // We are passed "fovy" and the "aspect ratio". However, the 3DS screens are sideways,
    -
    // and so are these parameters -- in fact, they are actually the fovx and the inverse
    -
    // of the aspect ratio. Therefore the formula for the perspective projection matrix
    -
    // had to be modified to be expressed in these terms instead.
    -
    -
    // Notes:
    -
    // fovx = 2 atan(tan(fovy/2)*w/h)
    -
    // fovy = 2 atan(tan(fovx/2)*h/w)
    -
    // invaspect = h/w
    -
    -
    // a0,0 = h / (w*tan(fovy/2)) =
    -
    // = h / (w*tan(2 atan(tan(fovx/2)*h/w) / 2)) =
    -
    // = h / (w*tan( atan(tan(fovx/2)*h/w) )) =
    -
    // = h / (w * tan(fovx/2)*h/w) =
    -
    // = 1 / tan(fovx/2)
    -
    -
    // a1,1 = 1 / tan(fovy/2) = (...) = w / (h*tan(fovx/2))
    -
    -
    float fovx_tan = tanf(fovx / 2);
    -
    matrix_4x4 mp;
    -
    m4x4_zeros(&mp);
    -
    -
    // Build standard perspective projection matrix
    -
    mp.r[0].x = 1.0f / fovx_tan;
    -
    mp.r[1].y = 1.0f / (fovx_tan*invaspect);
    -
    mp.r[2].z = (near + far) / (near - far);
    -
    mp.r[2].w = (2 * near * far) / (near - far);
    -
    mp.r[3].z = -1.0f;
    -
    -
    // Fix depth range to [-1, 0]
    -
    matrix_4x4 mp2;
    -
    m4x4_identity(&mp2);
    -
    mp2.r[2].z = 0.5;
    -
    mp2.r[2].w = -0.5;
    -
    m4x4_multiply(mtx, &mp2, &mp);
    -
    -
    // Rotate the matrix one quarter of a turn CCW in order to fix the 3DS screens' orientation
    -
    m4x4_rotate_z(mtx, M_PI / 2, true);
    -
    }
    -

    graphics/gpu/geoshader/source/vshader.pica

    ; Example PICA200 vertex shader
    -
    -
    ; Constants
    -
    .constf myconst(0.0, 1.0, -1.0, -0.5)
    -
    .alias zeros myconst.xxxx ; Vector full of zeros
    -
    .alias ones myconst.yyyy ; Vector full of ones
    -
    -
    ; Outputs - since we are also using a geoshader the output type isn't really used
    -
    .out outpos position
    -
    .out outclr color
    -
    -
    ; Inputs (defined as aliases for convenience)
    -
    .alias inpos v0
    -
    .alias inclr v1
    -
    -
    .proc main
    -
    ; Pass through both inputs to the geoshader
    -
    mov outpos.xyz, inpos
    -
    mov outpos.w, ones
    -
    mov outclr, inclr
    -
    -
    ; We're finished
    -
    end
    -
    .end
    -

    graphics/gpu/geoshader/source/gshader.pica

    ; Example PICA200 geometry shader
    -
    -
    ; Uniforms
    -
    .fvec projection[4]
    -
    -
    ; Constants
    -
    .constf myconst(0.0, 1.0, -1.0, 0.5)
    -
    .alias zeros myconst.xxxx ; Vector full of zeros
    -
    .alias ones myconst.yyyy ; Vector full of ones
    -
    .alias half myconst.wwww
    -
    -
    ; Outputs - this time the type *is* used
    -
    .out outpos position
    -
    .out outclr color
    -
    -
    ; Inputs: we will receive the following inputs:
    -
    ; v0-v1: position/color of the first vertex
    -
    ; v2-v3: position/color of the second vertex
    -
    ; v4-v5: position/color of the third vertex
    -
    -
    .proc main
    -
    ; Calculate the midpoints of the vertices
    -
    mov r4, v0
    -
    add r4, v2, r4
    -
    mul r4, half, r4
    -
    mov r5, v2
    -
    add r5, v4, r5
    -
    mul r5, half, r5
    -
    mov r6, v4
    -
    add r6, v0, r6
    -
    mul r6, half, r6
    -
    -
    ; Emit the first triangle
    -
    mov r0, v0
    -
    mov r1, r4
    -
    mov r2, r6
    -
    call emit_triangle
    -
    -
    ; Emit the second triangle
    -
    mov r0, r4
    -
    mov r1, v2
    -
    mov r2, r5
    -
    call emit_triangle
    -
    -
    ; Emit the third triangle
    -
    mov r0, r6
    -
    mov r1, r5
    -
    mov r2, v4
    -
    call emit_triangle
    -
    -
    ; We're finished
    -
    end
    -
    .end
    -
    -
    .proc emit_triangle
    -
    ; Emit the first vertex
    -
    setemit 0
    -
    mov r8, r0
    -
    mov r9, v1
    -
    call process_vertex
    -
    emit
    -
    -
    ; Emit the second vertex
    -
    setemit 1
    -
    mov r8, r1
    -
    mov r9, v3
    -
    call process_vertex
    -
    emit
    -
    -
    ; Emit the third vertex and finish the primitive
    -
    setemit 2, prim
    -
    mov r8, r2
    -
    mov r9, v5
    -
    call process_vertex
    -
    emit
    -
    .end
    -
    -
    ; Subroutine
    -
    ; Inputs:
    -
    ; r8: vertex position
    -
    ; r9: vertex color
    -
    .proc process_vertex
    -
    ; outpos = projectionMatrix * r8
    -
    dp4 outpos.x, projection[0], r8
    -
    dp4 outpos.y, projection[1], r8
    -
    dp4 outpos.z, projection[2], r8
    -
    dp4 outpos.w, projection[3], r8
    -
    -
    ; outclr = r9
    -
    mov outclr, r9
    -
    .end
    -
    /*
    -
    * ~~ Simple libctru GPU geometry shader example ~~
    -
    * This example demonstrates the basics of using the PICA200 in a 3DS homebrew
    -
    * application in order to render a basic scene using a geoshader.
    -
    * The example geoshader receives the vertices of a triangle and emits three
    -
    * smaller triangles, thus forming a 'triforce' shape.
    -
    */
    -
    -
    #include "gpu.h"
    -
    #include "vshader_shbin.h"
    -
    #include "gshader_shbin.h"
    -
    -
    #define CLEAR_COLOR 0x68B0D8FF
    -
    typedef struct { float position[3]; float color[4]; } vertex;
    static const vertex vertex_list[] =
    @@ -569,10 +104,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    #define vertex_list_count (sizeof(vertex_list)/sizeof(vertex_list[0]))
    -
    static DVLB_s *vshader_dvlb, *gshader_dvlb;
    -
    static shaderProgram_s program;
    +
    static DVLB_s* program_dvlb;
    +
    static shaderProgram_s program;
    static int uLoc_projection;
    -
    static matrix_4x4 projection;
    +
    static C3D_Mtx projection;
    static void* vbo_data;
    @@ -580,107 +115,97 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    {
    // Load the shaders and create a shader program
    // The geoshader stride is set to 6 so that it processes a triangle at a time
    -
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    -
    gshader_dvlb = DVLB_ParseFile((u32*)gshader_shbin, gshader_shbin_size);
    -
    shaderProgramInit(&program);
    -
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    -
    shaderProgramSetGsh(&program, &gshader_dvlb->DVLE[0], 6);
    +
    program_dvlb = DVLB_ParseFile((u32*)program_shbin, program_shbin_size);
    +
    shaderProgramInit(&program);
    +
    shaderProgramSetVsh(&program, &program_dvlb->DVLE[0]);
    +
    shaderProgramSetGsh(&program, &program_dvlb->DVLE[1], 6);
    +
    C3D_BindProgram(&program);
    // Get the location of the projection matrix uniform
    -
    uLoc_projection = shaderInstanceGetUniformLocation(program.geometryShader, "projection");
    +
    uLoc_projection = shaderInstanceGetUniformLocation(program.geometryShader, "projection");
    +
    +
    // Configure attributes for use with the vertex shader
    +
    C3D_AttrInfo* attrInfo = C3D_GetAttrInfo();
    +
    AttrInfo_Init(attrInfo);
    +
    AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
    +
    AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 4); // v1=color
    // Compute the projection matrix
    -
    m4x4_ortho_tilt(&projection, 0.0, 400.0, 0.0, 240.0, 0.0, 1.0);
    +
    Mtx_OrthoTilt(&projection, 0.0, 400.0, 0.0, 240.0, 0.0, 1.0);
    // Create the VBO (vertex buffer object)
    -
    vbo_data = linearAlloc(sizeof(vertex_list));
    +
    vbo_data = linearAlloc(sizeof(vertex_list));
    memcpy(vbo_data, vertex_list, sizeof(vertex_list));
    -
    }
    -
    static void sceneRender(void)
    -
    {
    -
    // Bind the shader program
    -
    shaderProgramUse(&program);
    +
    // Configure buffers
    +
    C3D_BufInfo* bufInfo = C3D_GetBufInfo();
    +
    BufInfo_Init(bufInfo);
    +
    BufInfo_Add(bufInfo, vbo_data, sizeof(vertex), 2, 0x10);
    // Configure the first fragment shading substage to just pass through the vertex color
    // See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
    - - - -
    GPU_TEVOPERANDS(0, 0, 0), // RGB
    -
    GPU_TEVOPERANDS(0, 0, 0), // Alpha
    -
    GPU_REPLACE, GPU_REPLACE, // RGB, Alpha
    -
    0xFFFFFFFF);
    -
    -
    // Configure the "attribute buffers" (that is, the vertex input buffers)
    - -
    2, // Number of inputs per vertex
    -
    (u32*)osConvertVirtToPhys(vbo_data), // Location of the VBO
    - -
    GPU_ATTRIBFMT(1, 4, GPU_FLOAT), // Format of the inputs (in this case the only input is a 3-element float vector)
    -
    0xFFC, // Unused attribute mask, in our case bit 0 is cleared since it is used
    -
    0x10, // Attribute permutations (here it is the identity)
    -
    1, // Number of buffers
    -
    (u32[]) { 0x0 }, // Buffer offsets (placeholders)
    -
    (u64[]) { 0x10 }, // Attribute permutations for each buffer (identity again)
    -
    (u8[]) { 2 }); // Number of attributes for each buffer
    +
    C3D_TexEnv* env = C3D_GetTexEnv(0);
    +
    C3D_TexEnvSrc(env, C3D_Both, GPU_PRIMARY_COLOR, 0, 0);
    +
    C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
    +
    C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
    +
    }
    -
    // Upload the projection matrix
    -
    GPU_SetFloatUniformMatrix(GPU_GEOMETRY_SHADER, uLoc_projection, &projection);
    +
    static void sceneRender(void)
    +
    {
    +
    // Update the uniforms
    +
    C3D_FVUnifMtx4x4(GPU_GEOMETRY_SHADER, uLoc_projection, &projection);
    // Draw the VBO - GPU_GEOMETRY_PRIM allows the geoshader to control primitive emission
    -
    GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, vertex_list_count);
    +
    C3D_DrawArrays(GPU_GEOMETRY_PRIM, 0, vertex_list_count);
    }
    static void sceneExit(void)
    {
    // Free the VBO
    -
    linearFree(vbo_data);
    +
    linearFree(vbo_data);
    // Free the shader program
    -
    shaderProgramFree(&program);
    -
    DVLB_Free(vshader_dvlb);
    -
    DVLB_Free(gshader_dvlb);
    +
    shaderProgramFree(&program);
    +
    DVLB_Free(program_dvlb);
    }
    int main()
    {
    // Initialize graphics
    - -
    gpuInit();
    + +
    C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
    +
    +
    // Initialize the render target
    +
    C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
    // Initialize the scene
    sceneInit();
    -
    gpuClearBuffers(CLEAR_COLOR);
    // Main loop
    -
    while (aptMainLoop())
    +
    while (aptMainLoop())
    {
    -
    gspWaitForVBlank(); // Synchronize with the start of VBlank
    -
    gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
    -
    hidScanInput(); // Read the user input
    +
    // Respond to user input
    -
    u32 kDown = hidKeysDown();
    -
    if (kDown & KEY_START)
    +
    u32 kDown = hidKeysDown();
    +
    if (kDown & KEY_START)
    break; // break in order to return to hbmenu
    // Render the scene
    -
    gpuFrameBegin();
    -
    sceneRender();
    -
    gpuFrameEnd();
    -
    gpuClearBuffers(CLEAR_COLOR);
    -
    -
    // Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
    -
    //gfxFlushBuffers();
    +
    C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
    +
    C3D_FrameDrawOn(target);
    +
    sceneRender();
    +
    C3D_FrameEnd(0);
    }
    // Deinitialize the scene
    sceneExit();
    // Deinitialize graphics
    -
    gpuExit();
    - +
    C3D_Fini();
    +
    return 0;
    }
    diff --git a/graphics_2gpu_2gpusprites_2source_2main_8c-example.html b/graphics_2gpu_2gpusprites_2source_2main_8c-example.html new file mode 100644 index 0000000..36942b3 --- /dev/null +++ b/graphics_2gpu_2gpusprites_2source_2main_8c-example.html @@ -0,0 +1,367 @@ + + + + + + +libctru: graphics/gpu/gpusprites/source/main.c + + + + + + + + + + +
    +
    + + + + + + +
    +
    libctru +  v1.1.0 +
    +
    +
    + + + + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    graphics/gpu/gpusprites/source/main.c
    +
    +
    +
    /*
    +
    +
    Simple demo of sprites using citro3d, lodepng and immediate mode.
    +
    +
    Citra doesn't yet emulate immediate mode so this is hw only.
    +
    +
    */
    +
    +
    #include <3ds.h>
    +
    #include <citro3d.h>
    +
    +
    #include <string.h>
    +
    #include <stdlib.h>
    +
    #include <time.h>
    +
    +
    #include "lodepng.h"
    +
    +
    // These headers are generated by the build process
    +
    #include "vshader_shbin.h"
    +
    #include "ballsprites_png.h"
    +
    +
    #define CLEAR_COLOR 0x000000FF
    +
    +
    // Used to transfer the final rendered display to the framebuffer
    +
    #define DISPLAY_TRANSFER_FLAGS \
    +
    (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
    +
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
    +
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    +
    +
    // Used to convert textures to 3DS tiled format
    +
    // Note: vertical flip flag set so 0,0 is top left of texture
    +
    #define TEXTURE_TRANSFER_FLAGS \
    +
    (GX_TRANSFER_FLIP_VERT(1) | GX_TRANSFER_OUT_TILED(1) | GX_TRANSFER_RAW_COPY(0) | \
    +
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGBA8) | \
    +
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    +
    +
    #define NUM_SPRITES 256
    +
    +
    //simple sprite struct
    +
    typedef struct {
    +
    int x,y; // screen co-ordinates
    +
    int dx, dy; // velocity
    +
    int image;
    +
    }Sprite;
    +
    +
    Sprite sprites[NUM_SPRITES];
    +
    +
    struct { float left, right, top, bottom; } images[4] = {
    +
    {0.0f, 0.5f, 0.0f, 0.5f},
    +
    {0.5f, 1.0f, 0.0f, 0.5f},
    +
    {0.0f, 0.5f, 0.5f, 1.0f},
    +
    {0.5f, 1.0f, 0.5f, 1.0f},
    +
    };
    +
    +
    //---------------------------------------------------------------------------------
    +
    void drawSprite( int x, int y, int width, int height, int image ) {
    +
    //---------------------------------------------------------------------------------
    +
    +
    float left = images[image].left;
    +
    float right = images[image].right;
    +
    float top = images[image].top;
    +
    float bottom = images[image].bottom;
    +
    +
    // Draw a textured quad directly
    +
    C3D_ImmDrawBegin(GPU_TRIANGLES);
    +
    C3D_ImmSendAttrib(x, y, 0.5f, 0.0f); // v0=position
    +
    C3D_ImmSendAttrib( left, top, 0.0f, 0.0f);
    +
    +
    C3D_ImmSendAttrib(x+width, y+height, 0.5f, 0.0f);
    +
    C3D_ImmSendAttrib( right, bottom, 0.0f, 0.0f);
    +
    +
    C3D_ImmSendAttrib(x+width, y, 0.5f, 0.0f);
    +
    C3D_ImmSendAttrib( right, top, 0.0f, 0.0f);
    +
    +
    C3D_ImmSendAttrib(x, y, 0.5f, 0.0f); // v0=position
    +
    C3D_ImmSendAttrib( left, top, 0.0f, 0.0f);
    +
    +
    C3D_ImmSendAttrib(x, y+height, 0.5f, 0.0f);
    +
    C3D_ImmSendAttrib( left, bottom, 0.0f, 0.0f);
    +
    +
    C3D_ImmSendAttrib(x+width, y+height, 0.5f, 0.0f);
    +
    C3D_ImmSendAttrib( right, bottom, 0.0f, 0.0f);
    +
    +
    +
    C3D_ImmDrawEnd();
    +
    +
    }
    +
    +
    +
    static DVLB_s* vshader_dvlb;
    +
    static shaderProgram_s program;
    +
    static int uLoc_projection;
    +
    static C3D_Mtx projection;
    +
    +
    static C3D_Tex spritesheet_tex;
    +
    +
    //---------------------------------------------------------------------------------
    +
    static void sceneInit(void) {
    +
    //---------------------------------------------------------------------------------
    +
    int i;
    +
    +
    // Load the vertex shader, create a shader program and bind it
    +
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    +
    shaderProgramInit(&program);
    +
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    C3D_BindProgram(&program);
    +
    +
    // Get the location of the uniforms
    +
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    +
    +
    // Configure attributes for use with the vertex shader
    +
    // Attribute format and element count are ignored in immediate mode
    +
    C3D_AttrInfo* attrInfo = C3D_GetAttrInfo();
    +
    AttrInfo_Init(attrInfo);
    +
    AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
    +
    AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 2); // v2=texcoord
    +
    +
    // Compute the projection matrix
    +
    // Note: we're setting top to 240 here so origin is at top left.
    +
    Mtx_OrthoTilt(&projection, 0.0, 400.0, 240.0, 0.0, 0.0, 1.0);
    +
    +
    // Configure buffers
    +
    C3D_BufInfo* bufInfo = C3D_GetBufInfo();
    +
    BufInfo_Init(bufInfo);
    +
    +
    unsigned char* image;
    +
    unsigned width, height;
    +
    +
    lodepng_decode32(&image, &width, &height, ballsprites_png, ballsprites_png_size);
    +
    +
    u8 *gpusrc = linearAlloc(width*height*4);
    +
    +
    // GX_DisplayTransfer needs input buffer in linear RAM
    +
    u8* src=image; u8 *dst=gpusrc;
    +
    +
    // lodepng outputs big endian rgba so we need to convert
    +
    for(int i = 0; i<width*height; i++) {
    +
    int r = *src++;
    +
    int g = *src++;
    +
    int b = *src++;
    +
    int a = *src++;
    +
    +
    *dst++ = a;
    +
    *dst++ = b;
    +
    *dst++ = g;
    +
    *dst++ = r;
    +
    }
    +
    +
    // ensure data is in physical ram
    +
    GSPGPU_FlushDataCache(gpusrc, width*height*4);
    +
    +
    // Load the texture and bind it to the first texture unit
    +
    C3D_TexInit(&spritesheet_tex, width, height, GPU_RGBA8);
    +
    +
    // Convert image to 3DS tiled texture format
    +
    GX_DisplayTransfer ((u32*)gpusrc, GX_BUFFER_DIM(width,height), (u32*)spritesheet_tex.data, GX_BUFFER_DIM(width,height), TEXTURE_TRANSFER_FLAGS);
    + +
    +
    C3D_TexSetFilter(&spritesheet_tex, GPU_LINEAR, GPU_NEAREST);
    +
    C3D_TexBind(0, &spritesheet_tex);
    +
    +
    free(image);
    +
    linearFree(gpusrc);
    +
    +
    // Configure the first fragment shading substage to just pass through the texture color
    +
    // See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
    +
    C3D_TexEnv* env = C3D_GetTexEnv(0);
    +
    C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, 0, 0);
    +
    C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
    +
    C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
    +
    +
    srand(time(NULL));
    +
    +
    for(i = 0; i < NUM_SPRITES; i++) {
    +
    //random place and speed
    +
    sprites[i].x = (rand() % (400 - 32 )) << 8;
    +
    sprites[i].y = (rand() % (240 - 32 )) << 8 ;
    +
    sprites[i].dx = (rand() & 0xFF) + 0x100;
    +
    sprites[i].dy = (rand() & 0xFF) + 0x100;
    +
    sprites[i].image = rand() & 3;
    +
    +
    if(rand() & 1)
    +
    sprites[i].dx = -sprites[i].dx;
    +
    if(rand() & 1)
    +
    sprites[i].dy = -sprites[i].dy;
    +
    }
    +
    +
    // Configure depth test to overwrite pixels with the same depth (needed to draw overlapping sprites)
    +
    C3D_DepthTest(true, GPU_GEQUAL, GPU_WRITE_ALL);
    +
    }
    +
    +
    //---------------------------------------------------------------------------------
    +
    static void moveSprites() {
    +
    //---------------------------------------------------------------------------------
    +
    +
    int i;
    +
    +
    for(i = 0; i < NUM_SPRITES; i++) {
    +
    sprites[i].x += sprites[i].dx;
    +
    sprites[i].y += sprites[i].dy;
    +
    +
    //check for collision with the screen boundaries
    +
    if(sprites[i].x < (1<<8) || sprites[i].x > ((400-32) << 8))
    +
    sprites[i].dx = -sprites[i].dx;
    +
    +
    if(sprites[i].y < (1<<8) || sprites[i].y > ((240-32) << 8))
    +
    sprites[i].dy = -sprites[i].dy;
    +
    }
    +
    }
    +
    +
    //---------------------------------------------------------------------------------
    +
    static void sceneRender(void) {
    +
    //---------------------------------------------------------------------------------
    +
    int i;
    +
    // Update the uniforms
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    +
    +
    for(i = 0; i < NUM_SPRITES; i++) {
    +
    +
    drawSprite( sprites[i].x >> 8, sprites[i].y >> 8, 32, 32, sprites[i].image);
    +
    }
    +
    +
    }
    +
    +
    //---------------------------------------------------------------------------------
    +
    static void sceneExit(void) {
    +
    //---------------------------------------------------------------------------------
    +
    +
    // Free the shader program
    +
    shaderProgramFree(&program);
    +
    DVLB_Free(vshader_dvlb);
    +
    }
    +
    +
    //---------------------------------------------------------------------------------
    +
    int main(int argc, char **argv) {
    +
    //---------------------------------------------------------------------------------
    +
    // Initialize graphics
    + +
    C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
    +
    +
    // Initialize the render target
    +
    C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
    +
    +
    // Initialize the scene
    +
    sceneInit();
    +
    +
    // Main loop
    +
    while (aptMainLoop()) {
    +
    + +
    +
    // Respond to user input
    +
    u32 kDown = hidKeysDown();
    +
    if (kDown & KEY_START)
    +
    break; // break in order to return to hbmenu
    +
    +
    moveSprites();
    +
    +
    // Render the scene
    +
    C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
    +
    C3D_FrameDrawOn(target);
    +
    sceneRender();
    +
    C3D_FrameEnd(0);
    +
    }
    +
    +
    // Deinitialize the scene
    +
    sceneExit();
    +
    +
    // Deinitialize graphics
    +
    C3D_Fini();
    + +
    return 0;
    +
    }
    +
    + + + + diff --git a/graphics_2gpu_2immediate_2source_2main_8c-example.html b/graphics_2gpu_2immediate_2source_2main_8c-example.html new file mode 100644 index 0000000..f504c60 --- /dev/null +++ b/graphics_2gpu_2immediate_2source_2main_8c-example.html @@ -0,0 +1,202 @@ + + + + + + +libctru: graphics/gpu/immediate/source/main.c + + + + + + + + + + +
    +
    + + + + + + +
    +
    libctru +  v1.1.0 +
    +
    +
    + + + + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    graphics/gpu/immediate/source/main.c
    +
    +
    +
    #include <3ds.h>
    +
    #include <citro3d.h>
    +
    #include <string.h>
    +
    #include "vshader_shbin.h"
    +
    +
    #define CLEAR_COLOR 0x68B0D8FF
    +
    +
    #define DISPLAY_TRANSFER_FLAGS \
    +
    (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
    +
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
    +
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    +
    +
    static DVLB_s* vshader_dvlb;
    +
    static shaderProgram_s program;
    +
    static int uLoc_projection;
    +
    static C3D_Mtx projection;
    +
    +
    static void sceneInit(void)
    +
    {
    +
    // Load the vertex shader, create a shader program and bind it
    +
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    +
    shaderProgramInit(&program);
    +
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    C3D_BindProgram(&program);
    +
    +
    // Get the location of the uniforms
    +
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    +
    +
    // Configure attributes for use with the vertex shader
    +
    // Attribute format and element count are ignored in immediate mode
    +
    C3D_AttrInfo* attrInfo = C3D_GetAttrInfo();
    +
    AttrInfo_Init(attrInfo);
    +
    AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
    +
    AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 3); // v1=color
    +
    +
    // Compute the projection matrix
    +
    Mtx_OrthoTilt(&projection, 0.0, 400.0, 0.0, 240.0, 0.0, 1.0);
    +
    +
    // Configure the first fragment shading substage to just pass through the vertex color
    +
    // See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
    +
    C3D_TexEnv* env = C3D_GetTexEnv(0);
    +
    C3D_TexEnvSrc(env, C3D_Both, GPU_PRIMARY_COLOR, 0, 0);
    +
    C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
    +
    C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
    +
    }
    +
    +
    static void sceneRender(void)
    +
    {
    +
    // Update the uniforms
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    +
    +
    // Draw the triangle directly
    +
    C3D_ImmDrawBegin(GPU_TRIANGLES);
    +
    C3D_ImmSendAttrib(200.0f, 200.0f, 0.5f, 0.0f); // v0=position
    +
    C3D_ImmSendAttrib(1.0f, 0.0f, 0.0f, 1.0f); // v1=color
    +
    +
    C3D_ImmSendAttrib(100.0f, 40.0f, 0.5f, 0.0f);
    +
    C3D_ImmSendAttrib(0.0f, 1.0f, 0.0f, 1.0f);
    +
    +
    C3D_ImmSendAttrib(300.0f, 40.0f, 0.5f, 0.0f);
    +
    C3D_ImmSendAttrib(0.0f, 0.0f, 1.0f, 1.0f);
    +
    C3D_ImmDrawEnd();
    +
    }
    +
    +
    static void sceneExit(void)
    +
    {
    +
    // Free the shader program
    +
    shaderProgramFree(&program);
    +
    DVLB_Free(vshader_dvlb);
    +
    }
    +
    +
    int main()
    +
    {
    +
    // Initialize graphics
    + +
    C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
    +
    +
    // Initialize the render target
    +
    C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
    +
    +
    // Initialize the scene
    +
    sceneInit();
    +
    +
    // Main loop
    +
    while (aptMainLoop())
    +
    {
    + +
    +
    // Respond to user input
    +
    u32 kDown = hidKeysDown();
    +
    if (kDown & KEY_START)
    +
    break; // break in order to return to hbmenu
    +
    +
    // Render the scene
    +
    C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
    +
    C3D_FrameDrawOn(target);
    +
    sceneRender();
    +
    C3D_FrameEnd(0);
    +
    }
    +
    +
    // Deinitialize the scene
    +
    sceneExit();
    +
    +
    // Deinitialize graphics
    +
    C3D_Fini();
    + +
    return 0;
    +
    }
    +
    + + + + diff --git a/graphics_2gpu_2simple_tri_2source_2main_8c-example.html b/graphics_2gpu_2simple_tri_2source_2main_8c-example.html index a2a8955..a316958 100644 --- a/graphics_2gpu_2simple_tri_2source_2main_8c-example.html +++ b/graphics_2gpu_2simple_tri_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -81,399 +81,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    graphics/gpu/simple_tri/source/main.c
    -

    graphics/gpu/simple_tri/source/gpu.h

    /*
    -
    * Bare-bones simplistic GPU wrapper
    -
    * This library is common to all libctru GPU examples
    -
    */
    -
    -
    #pragma once
    +
    #include <3ds.h>
    +
    #include <citro3d.h>
    #include <string.h>
    -
    #include <3ds.h>
    -
    #include "3dmath.h"
    -
    -
    void gpuInit(void);
    -
    void gpuExit(void);
    -
    -
    void gpuClearBuffers(u32 clearColor);
    -
    -
    void gpuFrameBegin(void);
    -
    void gpuFrameEnd(void);
    -
    -
    // Configures the specified fixed-function fragment shading substage to be a no-operation
    -
    void GPU_SetDummyTexEnv(int id);
    +
    #include "vshader_shbin.h"
    -
    // Uploads an uniform matrix
    -
    static inline void GPU_SetFloatUniformMatrix(GPU_SHADER_TYPE type, int location, matrix_4x4* matrix)
    -
    {
    -
    GPU_SetFloatUniform(type, location, (u32*)matrix, 4);
    -
    }
    -

    graphics/gpu/simple_tri/source/gpu.c

    #include "gpu.h"
    +
    #define CLEAR_COLOR 0x68B0D8FF
    #define DISPLAY_TRANSFER_FLAGS \
    (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    -
    static u32 *colorBuf, *depthBuf;
    -
    static u32 *cmdBuf;
    -
    -
    void gpuInit(void)
    -
    {
    -
    colorBuf = vramAlloc(400*240*4);
    -
    depthBuf = vramAlloc(400*240*4);
    -
    cmdBuf = linearAlloc(0x40000*4);
    -
    -
    GPU_Init(NULL);
    -
    GPU_Reset(NULL, cmdBuf, 0x40000);
    -
    }
    -
    -
    void gpuExit(void)
    -
    {
    -
    linearFree(cmdBuf);
    -
    vramFree(depthBuf);
    -
    vramFree(colorBuf);
    -
    }
    -
    -
    void gpuClearBuffers(u32 clearColor)
    -
    {
    - -
    colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
    -
    depthBuf, 0, &depthBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH);
    -
    gspWaitForPSC0(); // Wait for the fill to complete
    -
    }
    -
    -
    void gpuFrameBegin(void)
    -
    {
    -
    // Configure the viewport and the depth linear conversion function
    - -
    (u32*)osConvertVirtToPhys(depthBuf),
    -
    (u32*)osConvertVirtToPhys(colorBuf),
    -
    0, 0, 240, 400); // The top screen is physically 240x400 pixels
    -
    GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
    -
    -
    // Configure some boilerplate
    - -
    GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
    - - - -
    -
    // This is unknown
    -
    GPUCMD_AddMaskedWrite(GPUREG_0062, 0x1, 0);
    -
    GPUCMD_AddWrite(GPUREG_0118, 0);
    -
    -
    // Configure alpha blending and test
    - - -
    -
    int i;
    -
    for (i = 0; i < 6; i ++)
    -
    GPU_SetDummyTexEnv(i);
    -
    }
    -
    -
    void gpuFrameEnd(void)
    -
    {
    -
    // Finish rendering
    - - - -
    gspWaitForP3D(); // Wait for the rendering to complete
    -
    -
    // Transfer the GPU output to the framebuffer
    - -
    colorBuf, GX_BUFFER_DIM(240, 400),
    -
    (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 400),
    -
    DISPLAY_TRANSFER_FLAGS);
    -
    gspWaitForPPF(); // Wait for the transfer to complete
    -
    -
    // Reset the command buffer
    - -
    };
    -
    -
    void GPU_SetDummyTexEnv(int id)
    -
    {
    - - - -
    GPU_TEVOPERANDS(0, 0, 0),
    -
    GPU_TEVOPERANDS(0, 0, 0),
    - - -
    0xFFFFFFFF);
    -
    }
    -

    graphics/gpu/simple_tri/source/3dmath.h

    /*
    -
    * Bare-bones simplistic 3D math library
    -
    * This library is common to all libctru GPU examples
    -
    */
    -
    -
    #pragma once
    -
    #include <string.h>
    -
    #include <stdbool.h>
    -
    #include <math.h>
    -
    -
    typedef union { struct { float w, z, y, x; }; float c[4]; } vector_4f;
    -
    typedef struct { vector_4f r[4]; } matrix_4x4;
    -
    -
    static inline float v4f_dp4(const vector_4f* a, const vector_4f* b)
    -
    {
    -
    return a->x*b->x + a->y*b->y + a->z*b->z + a->w*b->w;
    -
    }
    -
    -
    static inline float v4f_mod4(const vector_4f* a)
    -
    {
    -
    return sqrtf(v4f_dp4(a,a));
    -
    }
    -
    -
    static inline void v4f_norm4(vector_4f* vec)
    -
    {
    -
    float m = v4f_mod4(vec);
    -
    if (m == 0.0) return;
    -
    vec->x /= m;
    -
    vec->y /= m;
    -
    vec->z /= m;
    -
    vec->w /= m;
    -
    }
    -
    -
    static inline void m4x4_zeros(matrix_4x4* out)
    -
    {
    -
    memset(out, 0, sizeof(*out));
    -
    }
    -
    -
    static inline void m4x4_copy(matrix_4x4* out, const matrix_4x4* in)
    -
    {
    -
    memcpy(out, in, sizeof(*out));
    -
    }
    -
    -
    void m4x4_identity(matrix_4x4* out);
    -
    void m4x4_multiply(matrix_4x4* out, const matrix_4x4* a, const matrix_4x4* b);
    -
    -
    void m4x4_translate(matrix_4x4* mtx, float x, float y, float z);
    -
    void m4x4_scale(matrix_4x4* mtx, float x, float y, float z);
    -
    -
    void m4x4_rotate_x(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    void m4x4_rotate_y(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    void m4x4_rotate_z(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    -
    // Special versions of the projection matrices that take the 3DS' screen orientation into account
    -
    void m4x4_ortho_tilt(matrix_4x4* mtx, float left, float right, float bottom, float top, float near, float far);
    -
    void m4x4_persp_tilt(matrix_4x4* mtx, float fovy, float aspect, float near, float far);
    -

    graphics/gpu/simple_tri/source/3dmath.c

    #include "3dmath.h"
    -
    -
    void m4x4_identity(matrix_4x4* out)
    -
    {
    -
    m4x4_zeros(out);
    -
    out->r[0].x = out->r[1].y = out->r[2].z = out->r[3].w = 1.0f;
    -
    }
    -
    -
    void m4x4_multiply(matrix_4x4* out, const matrix_4x4* a, const matrix_4x4* b)
    -
    {
    -
    int i, j;
    -
    for (i = 0; i < 4; i ++)
    -
    for (j = 0; j < 4; j ++)
    -
    out->r[j].c[i] = a->r[j].x*b->r[0].c[i] + a->r[j].y*b->r[1].c[i] + a->r[j].z*b->r[2].c[i] + a->r[j].w*b->r[3].c[i];
    -
    }
    -
    -
    void m4x4_translate(matrix_4x4* mtx, float x, float y, float z)
    -
    {
    -
    matrix_4x4 tm, om;
    -
    -
    m4x4_identity(&tm);
    -
    tm.r[0].w = x;
    -
    tm.r[1].w = y;
    -
    tm.r[2].w = z;
    -
    -
    m4x4_multiply(&om, mtx, &tm);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_scale(matrix_4x4* mtx, float x, float y, float z)
    -
    {
    -
    int i;
    -
    for (i = 0; i < 4; i ++)
    -
    {
    -
    mtx->r[i].x *= x;
    -
    mtx->r[i].y *= y;
    -
    mtx->r[i].z *= z;
    -
    }
    -
    }
    -
    -
    void m4x4_rotate_x(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = 1.0f;
    -
    rm.r[1].y = cosAngle;
    -
    rm.r[1].z = sinAngle;
    -
    rm.r[2].y = -sinAngle;
    -
    rm.r[2].z = cosAngle;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_rotate_y(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = cosAngle;
    -
    rm.r[0].z = sinAngle;
    -
    rm.r[1].y = 1.0f;
    -
    rm.r[2].x = -sinAngle;
    -
    rm.r[2].z = cosAngle;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_rotate_z(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = cosAngle;
    -
    rm.r[0].y = sinAngle;
    -
    rm.r[1].x = -sinAngle;
    -
    rm.r[1].y = cosAngle;
    -
    rm.r[2].z = 1.0f;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_ortho_tilt(matrix_4x4* mtx, float left, float right, float bottom, float top, float near, float far)
    -
    {
    -
    matrix_4x4 mp;
    -
    m4x4_zeros(&mp);
    -
    -
    // Build standard orthogonal projection matrix
    -
    mp.r[0].x = 2.0f / (right - left);
    -
    mp.r[0].w = (left + right) / (left - right);
    -
    mp.r[1].y = 2.0f / (top - bottom);
    -
    mp.r[1].w = (bottom + top) / (bottom - top);
    -
    mp.r[2].z = 2.0f / (near - far);
    -
    mp.r[2].w = (far + near) / (far - near);
    -
    mp.r[3].w = 1.0f;
    -
    -
    // Fix depth range to [-1, 0]
    -
    matrix_4x4 mp2, mp3;
    -
    m4x4_identity(&mp2);
    -
    mp2.r[2].z = 0.5;
    -
    mp2.r[2].w = -0.5;
    -
    m4x4_multiply(&mp3, &mp2, &mp);
    -
    -
    // Fix the 3DS screens' orientation by swapping the X and Y axis
    -
    m4x4_identity(&mp2);
    -
    mp2.r[0].x = 0.0;
    -
    mp2.r[0].y = 1.0;
    -
    mp2.r[1].x = -1.0; // flipped
    -
    mp2.r[1].y = 0.0;
    -
    m4x4_multiply(mtx, &mp2, &mp3);
    -
    }
    -
    -
    void m4x4_persp_tilt(matrix_4x4* mtx, float fovx, float invaspect, float near, float far)
    -
    {
    -
    // Notes:
    -
    // We are passed "fovy" and the "aspect ratio". However, the 3DS screens are sideways,
    -
    // and so are these parameters -- in fact, they are actually the fovx and the inverse
    -
    // of the aspect ratio. Therefore the formula for the perspective projection matrix
    -
    // had to be modified to be expressed in these terms instead.
    -
    -
    // Notes:
    -
    // fovx = 2 atan(tan(fovy/2)*w/h)
    -
    // fovy = 2 atan(tan(fovx/2)*h/w)
    -
    // invaspect = h/w
    -
    -
    // a0,0 = h / (w*tan(fovy/2)) =
    -
    // = h / (w*tan(2 atan(tan(fovx/2)*h/w) / 2)) =
    -
    // = h / (w*tan( atan(tan(fovx/2)*h/w) )) =
    -
    // = h / (w * tan(fovx/2)*h/w) =
    -
    // = 1 / tan(fovx/2)
    -
    -
    // a1,1 = 1 / tan(fovy/2) = (...) = w / (h*tan(fovx/2))
    -
    -
    float fovx_tan = tanf(fovx / 2);
    -
    matrix_4x4 mp;
    -
    m4x4_zeros(&mp);
    -
    -
    // Build standard perspective projection matrix
    -
    mp.r[0].x = 1.0f / fovx_tan;
    -
    mp.r[1].y = 1.0f / (fovx_tan*invaspect);
    -
    mp.r[2].z = (near + far) / (near - far);
    -
    mp.r[2].w = (2 * near * far) / (near - far);
    -
    mp.r[3].z = -1.0f;
    -
    -
    // Fix depth range to [-1, 0]
    -
    matrix_4x4 mp2;
    -
    m4x4_identity(&mp2);
    -
    mp2.r[2].z = 0.5;
    -
    mp2.r[2].w = -0.5;
    -
    m4x4_multiply(mtx, &mp2, &mp);
    -
    -
    // Rotate the matrix one quarter of a turn CCW in order to fix the 3DS screens' orientation
    -
    m4x4_rotate_z(mtx, M_PI / 2, true);
    -
    }
    -

    graphics/gpu/simple_tri/source/vshader.pica

    ; Example PICA200 vertex shader
    -
    -
    ; Uniforms
    -
    .fvec projection[4]
    -
    -
    ; Constants
    -
    .constf myconst(0.0, 1.0, -1.0, -0.5)
    -
    .alias zeros myconst.xxxx ; Vector full of zeros
    -
    .alias ones myconst.yyyy ; Vector full of ones
    -
    -
    ; Outputs
    -
    .out outpos position
    -
    .out outclr color
    -
    -
    ; Inputs (defined as aliases for convenience)
    -
    .alias inpos v0
    -
    -
    .proc main
    -
    ; Force the w component of inpos to be 1.0
    -
    mov r0.xyz, inpos
    -
    mov r0.w, ones
    -
    -
    ; outpos = projectionMatrix * inpos
    -
    dp4 outpos.x, projection[0], r0
    -
    dp4 outpos.y, projection[1], r0
    -
    dp4 outpos.z, projection[2], r0
    -
    dp4 outpos.w, projection[3], r0
    -
    -
    ; outclr = solid white color
    -
    mov outclr, ones
    -
    -
    ; We're finished
    -
    end
    -
    .end
    -
    /*
    -
    * ~~ Simple libctru GPU triangle example ~~
    -
    * This example demonstrates the basics of using the PICA200 in a 3DS homebrew
    -
    * application in order to render a basic scene consisting of a white solid triangle.
    -
    */
    -
    -
    #include "gpu.h"
    -
    #include "vshader_shbin.h"
    -
    -
    #define CLEAR_COLOR 0x68B0D8FF
    -
    typedef struct { float x, y, z; } vertex;
    static const vertex vertex_list[] =
    @@ -485,113 +104,109 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    #define vertex_list_count (sizeof(vertex_list)/sizeof(vertex_list[0]))
    -
    static DVLB_s* vshader_dvlb;
    -
    static shaderProgram_s program;
    +
    static DVLB_s* vshader_dvlb;
    +
    static shaderProgram_s program;
    static int uLoc_projection;
    -
    static matrix_4x4 projection;
    +
    static C3D_Mtx projection;
    static void* vbo_data;
    static void sceneInit(void)
    {
    -
    // Load the vertex shader and create a shader program
    -
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    -
    shaderProgramInit(&program);
    -
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    // Load the vertex shader, create a shader program and bind it
    +
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    +
    shaderProgramInit(&program);
    +
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    C3D_BindProgram(&program);
    +
    +
    // Get the location of the uniforms
    +
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    -
    // Get the location of the projection matrix uniform
    -
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    +
    // Configure attributes for use with the vertex shader
    +
    C3D_AttrInfo* attrInfo = C3D_GetAttrInfo();
    +
    AttrInfo_Init(attrInfo);
    +
    AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
    +
    AttrInfo_AddFixed(attrInfo, 1); // v1=color
    +
    +
    // Set the fixed attribute (color) to solid white
    +
    C3D_FixedAttribSet(1, 1.0, 1.0, 1.0, 1.0);
    // Compute the projection matrix
    -
    m4x4_ortho_tilt(&projection, 0.0, 400.0, 0.0, 240.0, 0.0, 1.0);
    +
    Mtx_OrthoTilt(&projection, 0.0, 400.0, 0.0, 240.0, 0.0, 1.0);
    // Create the VBO (vertex buffer object)
    -
    vbo_data = linearAlloc(sizeof(vertex_list));
    +
    vbo_data = linearAlloc(sizeof(vertex_list));
    memcpy(vbo_data, vertex_list, sizeof(vertex_list));
    -
    }
    -
    static void sceneRender(void)
    -
    {
    -
    // Bind the shader program
    -
    shaderProgramUse(&program);
    +
    // Configure buffers
    +
    C3D_BufInfo* bufInfo = C3D_GetBufInfo();
    +
    BufInfo_Init(bufInfo);
    +
    BufInfo_Add(bufInfo, vbo_data, sizeof(vertex), 1, 0x0);
    // Configure the first fragment shading substage to just pass through the vertex color
    // See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
    - - - -
    GPU_TEVOPERANDS(0, 0, 0), // RGB
    -
    GPU_TEVOPERANDS(0, 0, 0), // Alpha
    -
    GPU_REPLACE, GPU_REPLACE, // RGB, Alpha
    -
    0xFFFFFFFF);
    -
    -
    // Configure the "attribute buffers" (that is, the vertex input buffers)
    - -
    1, // Number of inputs per vertex
    -
    (u32*)osConvertVirtToPhys((u32)vbo_data), // Location of the VBO
    -
    GPU_ATTRIBFMT(0, 3, GPU_FLOAT), // Format of the inputs (in this case the only input is a 3-element float vector)
    -
    0xFFE, // Unused attribute mask, in our case bit 0 is cleared since it is used
    -
    0x0, // Attribute permutations (here it is the identity)
    -
    1, // Number of buffers
    -
    (u32[]) { 0x0 }, // Buffer offsets (placeholders)
    -
    (u64[]) { 0x0 }, // Attribute permutations for each buffer (identity again)
    -
    (u8[]) { 1 }); // Number of attributes for each buffer
    +
    C3D_TexEnv* env = C3D_GetTexEnv(0);
    +
    C3D_TexEnvSrc(env, C3D_Both, GPU_PRIMARY_COLOR, 0, 0);
    +
    C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
    +
    C3D_TexEnvFunc(env, C3D_Both, GPU_REPLACE);
    +
    }
    -
    // Upload the projection matrix
    -
    GPU_SetFloatUniformMatrix(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    +
    static void sceneRender(void)
    +
    {
    +
    // Update the uniforms
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    // Draw the VBO
    -
    GPU_DrawArray(GPU_TRIANGLES, 0, vertex_list_count);
    +
    C3D_DrawArrays(GPU_TRIANGLES, 0, vertex_list_count);
    }
    static void sceneExit(void)
    {
    // Free the VBO
    -
    linearFree(vbo_data);
    +
    linearFree(vbo_data);
    // Free the shader program
    -
    shaderProgramFree(&program);
    -
    DVLB_Free(vshader_dvlb);
    +
    shaderProgramFree(&program);
    +
    DVLB_Free(vshader_dvlb);
    }
    int main()
    {
    // Initialize graphics
    - -
    gpuInit();
    + +
    C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
    +
    +
    // Initialize the render target
    +
    C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
    // Initialize the scene
    sceneInit();
    -
    gpuClearBuffers(CLEAR_COLOR);
    // Main loop
    -
    while (aptMainLoop())
    +
    while (aptMainLoop())
    {
    -
    gspWaitForVBlank(); // Synchronize with the start of VBlank
    -
    gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
    -
    hidScanInput(); // Read the user input
    +
    // Respond to user input
    -
    u32 kDown = hidKeysDown();
    -
    if (kDown & KEY_START)
    +
    u32 kDown = hidKeysDown();
    +
    if (kDown & KEY_START)
    break; // break in order to return to hbmenu
    // Render the scene
    -
    gpuFrameBegin();
    -
    sceneRender();
    -
    gpuFrameEnd();
    -
    gpuClearBuffers(CLEAR_COLOR);
    -
    -
    // Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
    -
    //gfxFlushBuffers();
    +
    C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
    +
    C3D_FrameDrawOn(target);
    +
    sceneRender();
    +
    C3D_FrameEnd(0);
    }
    // Deinitialize the scene
    sceneExit();
    // Deinitialize graphics
    -
    gpuExit();
    - +
    C3D_Fini();
    +
    return 0;
    }
    diff --git a/graphics_2gpu_2textured_cube_2source_2main_8c-example.html b/graphics_2gpu_2textured_cube_2source_2main_8c-example.html index b554c00..871547b 100644 --- a/graphics_2gpu_2textured_cube_2source_2main_8c-example.html +++ b/graphics_2gpu_2textured_cube_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -81,458 +81,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    graphics/gpu/textured_cube/source/main.c
    -

    graphics/gpu/textured_cube/source/gpu.h

    /*
    -
    * Bare-bones simplistic GPU wrapper
    -
    * This library is common to all libctru GPU examples
    -
    */
    -
    -
    #pragma once
    +
    #include <3ds.h>
    +
    #include <citro3d.h>
    #include <string.h>
    -
    #include <3ds.h>
    -
    #include "3dmath.h"
    -
    -
    void gpuInit(void);
    -
    void gpuExit(void);
    -
    -
    void gpuClearBuffers(u32 clearColor);
    -
    -
    void gpuFrameBegin(void);
    -
    void gpuFrameEnd(void);
    -
    -
    // Configures the specified fixed-function fragment shading substage to be a no-operation
    -
    void GPU_SetDummyTexEnv(int id);
    +
    #include "vshader_shbin.h"
    +
    #include "kitten_bin.h"
    -
    // Uploads an uniform matrix
    -
    static inline void GPU_SetFloatUniformMatrix(GPU_SHADER_TYPE type, int location, matrix_4x4* matrix)
    -
    {
    -
    GPU_SetFloatUniform(type, location, (u32*)matrix, 4);
    -
    }
    -

    graphics/gpu/textured_cube/source/gpu.c

    #include "gpu.h"
    +
    #define CLEAR_COLOR 0x68B0D8FF
    #define DISPLAY_TRANSFER_FLAGS \
    (GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
    GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
    GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
    -
    static u32 *colorBuf, *depthBuf;
    -
    static u32 *cmdBuf;
    -
    -
    void gpuInit(void)
    -
    {
    -
    colorBuf = vramAlloc(400*240*4);
    -
    depthBuf = vramAlloc(400*240*4);
    -
    cmdBuf = linearAlloc(0x40000*4);
    -
    -
    GPU_Init(NULL);
    -
    GPU_Reset(NULL, cmdBuf, 0x40000);
    -
    }
    -
    -
    void gpuExit(void)
    -
    {
    -
    linearFree(cmdBuf);
    -
    vramFree(depthBuf);
    -
    vramFree(colorBuf);
    -
    }
    -
    -
    void gpuClearBuffers(u32 clearColor)
    -
    {
    - -
    colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
    -
    depthBuf, 0, &depthBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH);
    -
    gspWaitForPSC0(); // Wait for the fill to complete
    -
    }
    -
    -
    void gpuFrameBegin(void)
    -
    {
    -
    // Configure the viewport and the depth linear conversion function
    - -
    (u32*)osConvertVirtToPhys(depthBuf),
    -
    (u32*)osConvertVirtToPhys(colorBuf),
    -
    0, 0, 240, 400); // The top screen is physically 240x400 pixels
    -
    GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
    -
    -
    // Configure some boilerplate
    - -
    GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
    - - - -
    -
    // This is unknown
    -
    GPUCMD_AddMaskedWrite(GPUREG_0062, 0x1, 0);
    -
    GPUCMD_AddWrite(GPUREG_0118, 0);
    -
    -
    // Configure alpha blending and test
    - - -
    -
    int i;
    -
    for (i = 0; i < 6; i ++)
    -
    GPU_SetDummyTexEnv(i);
    -
    }
    -
    -
    void gpuFrameEnd(void)
    -
    {
    -
    // Finish rendering
    - - - -
    gspWaitForP3D(); // Wait for the rendering to complete
    -
    -
    // Transfer the GPU output to the framebuffer
    - -
    colorBuf, GX_BUFFER_DIM(240, 400),
    -
    (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), GX_BUFFER_DIM(240, 400),
    -
    DISPLAY_TRANSFER_FLAGS);
    -
    gspWaitForPPF(); // Wait for the transfer to complete
    -
    -
    // Reset the command buffer
    - -
    };
    -
    -
    void GPU_SetDummyTexEnv(int id)
    -
    {
    - - - -
    GPU_TEVOPERANDS(0, 0, 0),
    -
    GPU_TEVOPERANDS(0, 0, 0),
    - - -
    0xFFFFFFFF);
    -
    }
    -

    graphics/gpu/textured_cube/source/3dmath.h

    /*
    -
    * Bare-bones simplistic 3D math library
    -
    * This library is common to all libctru GPU examples
    -
    */
    -
    -
    #pragma once
    -
    #include <string.h>
    -
    #include <stdbool.h>
    -
    #include <math.h>
    -
    -
    typedef union { struct { float w, z, y, x; }; float c[4]; } vector_4f;
    -
    typedef struct { vector_4f r[4]; } matrix_4x4;
    -
    -
    static inline float v4f_dp4(const vector_4f* a, const vector_4f* b)
    -
    {
    -
    return a->x*b->x + a->y*b->y + a->z*b->z + a->w*b->w;
    -
    }
    -
    -
    static inline float v4f_mod4(const vector_4f* a)
    -
    {
    -
    return sqrtf(v4f_dp4(a,a));
    -
    }
    -
    -
    static inline void v4f_norm4(vector_4f* vec)
    -
    {
    -
    float m = v4f_mod4(vec);
    -
    if (m == 0.0) return;
    -
    vec->x /= m;
    -
    vec->y /= m;
    -
    vec->z /= m;
    -
    vec->w /= m;
    -
    }
    -
    -
    static inline void m4x4_zeros(matrix_4x4* out)
    -
    {
    -
    memset(out, 0, sizeof(*out));
    -
    }
    -
    -
    static inline void m4x4_copy(matrix_4x4* out, const matrix_4x4* in)
    -
    {
    -
    memcpy(out, in, sizeof(*out));
    -
    }
    -
    -
    void m4x4_identity(matrix_4x4* out);
    -
    void m4x4_multiply(matrix_4x4* out, const matrix_4x4* a, const matrix_4x4* b);
    -
    -
    void m4x4_translate(matrix_4x4* mtx, float x, float y, float z);
    -
    void m4x4_scale(matrix_4x4* mtx, float x, float y, float z);
    -
    -
    void m4x4_rotate_x(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    void m4x4_rotate_y(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    void m4x4_rotate_z(matrix_4x4* mtx, float angle, bool bRightSide);
    -
    -
    // Special versions of the projection matrices that take the 3DS' screen orientation into account
    -
    void m4x4_ortho_tilt(matrix_4x4* mtx, float left, float right, float bottom, float top, float near, float far);
    -
    void m4x4_persp_tilt(matrix_4x4* mtx, float fovy, float aspect, float near, float far);
    -

    graphics/gpu/textured_cube/source/3dmath.c

    #include "3dmath.h"
    -
    -
    void m4x4_identity(matrix_4x4* out)
    -
    {
    -
    m4x4_zeros(out);
    -
    out->r[0].x = out->r[1].y = out->r[2].z = out->r[3].w = 1.0f;
    -
    }
    -
    -
    void m4x4_multiply(matrix_4x4* out, const matrix_4x4* a, const matrix_4x4* b)
    -
    {
    -
    int i, j;
    -
    for (i = 0; i < 4; i ++)
    -
    for (j = 0; j < 4; j ++)
    -
    out->r[j].c[i] = a->r[j].x*b->r[0].c[i] + a->r[j].y*b->r[1].c[i] + a->r[j].z*b->r[2].c[i] + a->r[j].w*b->r[3].c[i];
    -
    }
    -
    -
    void m4x4_translate(matrix_4x4* mtx, float x, float y, float z)
    -
    {
    -
    matrix_4x4 tm, om;
    -
    -
    m4x4_identity(&tm);
    -
    tm.r[0].w = x;
    -
    tm.r[1].w = y;
    -
    tm.r[2].w = z;
    -
    -
    m4x4_multiply(&om, mtx, &tm);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_scale(matrix_4x4* mtx, float x, float y, float z)
    -
    {
    -
    int i;
    -
    for (i = 0; i < 4; i ++)
    -
    {
    -
    mtx->r[i].x *= x;
    -
    mtx->r[i].y *= y;
    -
    mtx->r[i].z *= z;
    -
    }
    -
    }
    -
    -
    void m4x4_rotate_x(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = 1.0f;
    -
    rm.r[1].y = cosAngle;
    -
    rm.r[1].z = sinAngle;
    -
    rm.r[2].y = -sinAngle;
    -
    rm.r[2].z = cosAngle;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_rotate_y(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = cosAngle;
    -
    rm.r[0].z = sinAngle;
    -
    rm.r[1].y = 1.0f;
    -
    rm.r[2].x = -sinAngle;
    -
    rm.r[2].z = cosAngle;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_rotate_z(matrix_4x4* mtx, float angle, bool bRightSide)
    -
    {
    -
    matrix_4x4 rm, om;
    -
    -
    float cosAngle = cosf(angle);
    -
    float sinAngle = sinf(angle);
    -
    -
    m4x4_zeros(&rm);
    -
    rm.r[0].x = cosAngle;
    -
    rm.r[0].y = sinAngle;
    -
    rm.r[1].x = -sinAngle;
    -
    rm.r[1].y = cosAngle;
    -
    rm.r[2].z = 1.0f;
    -
    rm.r[3].w = 1.0f;
    -
    -
    if (bRightSide) m4x4_multiply(&om, mtx, &rm);
    -
    else m4x4_multiply(&om, &rm, mtx);
    -
    m4x4_copy(mtx, &om);
    -
    }
    -
    -
    void m4x4_ortho_tilt(matrix_4x4* mtx, float left, float right, float bottom, float top, float near, float far)
    -
    {
    -
    matrix_4x4 mp;
    -
    m4x4_zeros(&mp);
    -
    -
    // Build standard orthogonal projection matrix
    -
    mp.r[0].x = 2.0f / (right - left);
    -
    mp.r[0].w = (left + right) / (left - right);
    -
    mp.r[1].y = 2.0f / (top - bottom);
    -
    mp.r[1].w = (bottom + top) / (bottom - top);
    -
    mp.r[2].z = 2.0f / (near - far);
    -
    mp.r[2].w = (far + near) / (far - near);
    -
    mp.r[3].w = 1.0f;
    -
    -
    // Fix depth range to [-1, 0]
    -
    matrix_4x4 mp2, mp3;
    -
    m4x4_identity(&mp2);
    -
    mp2.r[2].z = 0.5;
    -
    mp2.r[2].w = -0.5;
    -
    m4x4_multiply(&mp3, &mp2, &mp);
    -
    -
    // Fix the 3DS screens' orientation by swapping the X and Y axis
    -
    m4x4_identity(&mp2);
    -
    mp2.r[0].x = 0.0;
    -
    mp2.r[0].y = 1.0;
    -
    mp2.r[1].x = -1.0; // flipped
    -
    mp2.r[1].y = 0.0;
    -
    m4x4_multiply(mtx, &mp2, &mp3);
    -
    }
    -
    -
    void m4x4_persp_tilt(matrix_4x4* mtx, float fovx, float invaspect, float near, float far)
    -
    {
    -
    // Notes:
    -
    // We are passed "fovy" and the "aspect ratio". However, the 3DS screens are sideways,
    -
    // and so are these parameters -- in fact, they are actually the fovx and the inverse
    -
    // of the aspect ratio. Therefore the formula for the perspective projection matrix
    -
    // had to be modified to be expressed in these terms instead.
    -
    -
    // Notes:
    -
    // fovx = 2 atan(tan(fovy/2)*w/h)
    -
    // fovy = 2 atan(tan(fovx/2)*h/w)
    -
    // invaspect = h/w
    -
    -
    // a0,0 = h / (w*tan(fovy/2)) =
    -
    // = h / (w*tan(2 atan(tan(fovx/2)*h/w) / 2)) =
    -
    // = h / (w*tan( atan(tan(fovx/2)*h/w) )) =
    -
    // = h / (w * tan(fovx/2)*h/w) =
    -
    // = 1 / tan(fovx/2)
    -
    -
    // a1,1 = 1 / tan(fovy/2) = (...) = w / (h*tan(fovx/2))
    -
    -
    float fovx_tan = tanf(fovx / 2);
    -
    matrix_4x4 mp;
    -
    m4x4_zeros(&mp);
    -
    -
    // Build standard perspective projection matrix
    -
    mp.r[0].x = 1.0f / fovx_tan;
    -
    mp.r[1].y = 1.0f / (fovx_tan*invaspect);
    -
    mp.r[2].z = (near + far) / (near - far);
    -
    mp.r[2].w = (2 * near * far) / (near - far);
    -
    mp.r[3].z = -1.0f;
    -
    -
    // Fix depth range to [-1, 0]
    -
    matrix_4x4 mp2;
    -
    m4x4_identity(&mp2);
    -
    mp2.r[2].z = 0.5;
    -
    mp2.r[2].w = -0.5;
    -
    m4x4_multiply(mtx, &mp2, &mp);
    -
    -
    // Rotate the matrix one quarter of a turn CCW in order to fix the 3DS screens' orientation
    -
    m4x4_rotate_z(mtx, M_PI / 2, true);
    -
    }
    -

    graphics/gpu/textured_cube/source/vshader.pica

    ; Example PICA200 vertex shader
    -
    -
    ; Uniforms
    -
    .fvec projection[4], modelView[4]
    -
    .fvec lightVec, lightHalfVec, lightClr, material[4]
    -
    .alias mat_amb material[0]
    -
    .alias mat_dif material[1]
    -
    .alias mat_spe material[2]
    -
    .alias mat_emi material[3]
    -
    -
    ; Constants
    -
    .constf myconst(0.0, 1.0, -1.0, -0.5)
    -
    .alias zeros myconst.xxxx ; Vector full of zeros
    -
    .alias ones myconst.yyyy ; Vector full of ones
    -
    -
    ; Outputs
    -
    .out outpos position
    -
    .out outtc0 texcoord0
    -
    .out outclr color
    -
    -
    ; Inputs (defined as aliases for convenience)
    -
    .alias inpos v0
    -
    .alias intex v1
    -
    .alias innrm v2
    -
    -
    .proc main
    -
    ; Force the w component of inpos to be 1.0
    -
    mov r0.xyz, inpos
    -
    mov r0.w, ones
    -
    -
    ; r1 = modelView * inpos
    -
    dp4 r1.x, modelView[0], r0
    -
    dp4 r1.y, modelView[1], r0
    -
    dp4 r1.z, modelView[2], r0
    -
    dp4 r1.w, modelView[3], r0
    -
    -
    ; outpos = projection * r1
    -
    dp4 outpos.x, projection[0], r1
    -
    dp4 outpos.y, projection[1], r1
    -
    dp4 outpos.z, projection[2], r1
    -
    dp4 outpos.w, projection[3], r1
    -
    -
    ; outtex = intex
    -
    mov outtc0, intex
    -
    -
    ; Transform the normal vector with the modelView matrix
    -
    ; r1 = normalize(modelView * innrm)
    -
    mov r0.xyz, innrm
    -
    mov r0.w, zeros
    -
    dp4 r1.x, modelView[0], r0
    -
    dp4 r1.y, modelView[1], r0
    -
    dp4 r1.z, modelView[2], r0
    -
    mov r1.w, zeros
    -
    dp3 r2, r1, r1 ; r2 = x^2+y^2+z^2 for each component
    -
    rsq r2, r2 ; r2 = 1/sqrt(r2) ''
    -
    mul r1, r2, r1 ; r1 = r1*r2
    -
    -
    ; Calculate the diffuse level (r0.x) and the shininess level (r0.y)
    -
    ; r0.x = max(0, -(lightVec * r1))
    -
    ; r0.y = max(0, (-lightHalfVec[i]) * r1) ^ 2
    -
    dp3 r0.x, lightVec, r1
    -
    add r0.x, zeros, -r0
    -
    dp3 r0.y, -lightHalfVec, r1
    -
    max r0, zeros, r0
    -
    mul r0.y, r0, r0
    -
    -
    ; Accumulate the vertex color in r1, initializing it to the emission color
    -
    mov r1, mat_emi
    -
    -
    ; r1 += specularColor * lightClr * shininessLevel
    -
    mul r2, lightClr, r0.yyyy
    -
    mul r2, mat_spe, r2
    -
    add r1, r2, r1
    -
    -
    ; r1 += diffuseColor * lightClr * diffuseLevel
    -
    mul r2, lightClr, r0.xxxx
    -
    mul r2, mat_dif, r2
    -
    add r1, r2, r1
    -
    -
    ; r1 += ambientColor * lightClr
    -
    mov r2, lightClr
    -
    mul r2, mat_amb, r2
    -
    add r1, r2, r1
    -
    -
    ; outclr = clamp r1 to [0,1]
    -
    min outclr, ones, r1
    -
    -
    ; We're finished
    -
    end
    -
    .end
    -
    /*
    -
    * ~~ Simple libctru GPU textured cube example ~~
    -
    * This example demonstrates the basics of using the PICA200 in a 3DS homebrew
    -
    * application in order to render a basic scene consisting of a rotating
    -
    * textured cube which is also shaded using a simple shading algorithm.
    -
    * The shading algorithm is explained in the vertex shader source code.
    -
    */
    -
    -
    #include "gpu.h"
    -
    #include "vshader_shbin.h"
    -
    #include "kitten_bin.h"
    -
    -
    #define CLEAR_COLOR 0x68B0D8FF
    -
    typedef struct { float position[3]; float texcoord[2]; float normal[3]; } vertex;
    static const vertex vertex_list[] =
    @@ -600,12 +161,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    #define vertex_list_count (sizeof(vertex_list)/sizeof(vertex_list[0]))
    -
    static DVLB_s* vshader_dvlb;
    -
    static shaderProgram_s program;
    +
    static DVLB_s* vshader_dvlb;
    +
    static shaderProgram_s program;
    static int uLoc_projection, uLoc_modelView;
    static int uLoc_lightVec, uLoc_lightHalfVec, uLoc_lightClr, uLoc_material;
    -
    static matrix_4x4 projection;
    -
    static matrix_4x4 material =
    +
    static C3D_Mtx projection;
    +
    static C3D_Mtx material =
    {
    {
    { { 0.0f, 0.2f, 0.2f, 0.2f } }, // Ambient
    @@ -616,151 +177,134 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    };
    static void* vbo_data;
    -
    static void* tex_data;
    +
    static C3D_Tex kitten_tex;
    static float angleX = 0.0, angleY = 0.0;
    static void sceneInit(void)
    {
    -
    // Load the vertex shader and create a shader program
    -
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    -
    shaderProgramInit(&program);
    -
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    // Load the vertex shader, create a shader program and bind it
    +
    vshader_dvlb = DVLB_ParseFile((u32*)vshader_shbin, vshader_shbin_size);
    +
    shaderProgramInit(&program);
    +
    shaderProgramSetVsh(&program, &vshader_dvlb->DVLE[0]);
    +
    C3D_BindProgram(&program);
    // Get the location of the uniforms
    -
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    +
    uLoc_projection = shaderInstanceGetUniformLocation(program.vertexShader, "projection");
    uLoc_modelView = shaderInstanceGetUniformLocation(program.vertexShader, "modelView");
    uLoc_lightVec = shaderInstanceGetUniformLocation(program.vertexShader, "lightVec");
    uLoc_lightHalfVec = shaderInstanceGetUniformLocation(program.vertexShader, "lightHalfVec");
    uLoc_lightClr = shaderInstanceGetUniformLocation(program.vertexShader, "lightClr");
    uLoc_material = shaderInstanceGetUniformLocation(program.vertexShader, "material");
    +
    // Configure attributes for use with the vertex shader
    +
    C3D_AttrInfo* attrInfo = C3D_GetAttrInfo();
    +
    AttrInfo_Init(attrInfo);
    +
    AttrInfo_AddLoader(attrInfo, 0, GPU_FLOAT, 3); // v0=position
    +
    AttrInfo_AddLoader(attrInfo, 1, GPU_FLOAT, 2); // v1=texcoord
    +
    AttrInfo_AddLoader(attrInfo, 2, GPU_FLOAT, 3); // v2=normal
    +
    // Compute the projection matrix
    -
    m4x4_persp_tilt(&projection, 80.0f*M_PI/180.0f, 400.0f/240.0f, 0.01f, 1000.0f);
    +
    Mtx_PerspTilt(&projection, 80.0f*M_PI/180.0f, 400.0f/240.0f, 0.01f, 1000.0f);
    // Create the VBO (vertex buffer object)
    -
    vbo_data = linearAlloc(sizeof(vertex_list));
    +
    vbo_data = linearAlloc(sizeof(vertex_list));
    memcpy(vbo_data, vertex_list, sizeof(vertex_list));
    -
    // Load the texture
    -
    tex_data = linearAlloc(kitten_bin_size);
    -
    memcpy(tex_data, kitten_bin, kitten_bin_size);
    -
    }
    +
    // Configure buffers
    +
    C3D_BufInfo* bufInfo = C3D_GetBufInfo();
    +
    BufInfo_Init(bufInfo);
    +
    BufInfo_Add(bufInfo, vbo_data, sizeof(vertex), 3, 0x210);
    -
    static void sceneRender(void)
    -
    {
    -
    // Bind the shader program
    -
    shaderProgramUse(&program);
    +
    // Load the texture and bind it to the first texture unit
    +
    C3D_TexInit(&kitten_tex, 64, 64, GPU_RGBA8);
    +
    C3D_TexUpload(&kitten_tex, kitten_bin);
    +
    C3D_TexSetFilter(&kitten_tex, GPU_LINEAR, GPU_NEAREST);
    +
    C3D_TexBind(0, &kitten_tex);
    // Configure the first fragment shading substage to blend the texture color with
    // the vertex color (calculated by the vertex shader using a lighting algorithm)
    // See https://www.opengl.org/sdk/docs/man2/xhtml/glTexEnv.xml for more insight
    - - - -
    GPU_TEVOPERANDS(0, 0, 0), // RGB
    -
    GPU_TEVOPERANDS(0, 0, 0), // Alpha
    -
    GPU_MODULATE, GPU_MODULATE, // RGB, Alpha
    -
    0xFFFFFFFF);
    -
    -
    // Configure the first texture unit
    - - - -
    (u32*)osConvertVirtToPhys(tex_data),
    -
    64, // Width
    -
    64, // Height
    - -
    GPU_RGBA8 // Pixel format
    -
    );
    -
    -
    // Configure the "attribute buffers" (that is, the vertex input buffers)
    - -
    3, // Number of inputs per vertex
    -
    (u32*)osConvertVirtToPhys(vbo_data), // Location of the VBO
    -
    GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | // Format of the inputs
    - - -
    0xFFC, // Unused attribute mask, in our case bits 0~2 are cleared since they are used
    -
    0x210, // Attribute permutations (here it is the identity, passing each attribute in order)
    -
    1, // Number of buffers
    -
    (u32[]) { 0x0 }, // Buffer offsets (placeholders)
    -
    (u64[]) { 0x210 }, // Attribute permutations for each buffer (identity again)
    -
    (u8[]) { 3 }); // Number of attributes for each buffer
    +
    C3D_TexEnv* env = C3D_GetTexEnv(0);
    +
    C3D_TexEnvSrc(env, C3D_Both, GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0);
    +
    C3D_TexEnvOp(env, C3D_Both, 0, 0, 0);
    +
    C3D_TexEnvFunc(env, C3D_Both, GPU_MODULATE);
    +
    }
    +
    static void sceneRender(void)
    +
    {
    // Calculate the modelView matrix
    -
    matrix_4x4 modelView;
    -
    m4x4_identity(&modelView);
    -
    m4x4_translate(&modelView, 0.0, 0.0, -2.0 + 0.5*sinf(angleX));
    -
    m4x4_rotate_x(&modelView, angleX, true);
    -
    m4x4_rotate_y(&modelView, angleY, true);
    +
    C3D_Mtx modelView;
    +
    Mtx_Identity(&modelView);
    +
    Mtx_Translate(&modelView, 0.0, 0.0, -2.0 + 0.5*sinf(angleX));
    +
    Mtx_RotateX(&modelView, angleX, true);
    +
    Mtx_RotateY(&modelView, angleY, true);
    // Rotate the cube each frame
    angleX += M_PI / 180;
    angleY += M_PI / 360;
    -
    // Upload the uniforms
    -
    GPU_SetFloatUniformMatrix(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    -
    GPU_SetFloatUniformMatrix(GPU_VERTEX_SHADER, uLoc_modelView, &modelView);
    -
    GPU_SetFloatUniformMatrix(GPU_VERTEX_SHADER, uLoc_material, &material);
    -
    GPU_SetFloatUniform(GPU_VERTEX_SHADER, uLoc_lightVec, (u32*)(float[]){0.0f, -1.0f, 0.0f, 0.0f}, 1);
    -
    GPU_SetFloatUniform(GPU_VERTEX_SHADER, uLoc_lightHalfVec, (u32*)(float[]){0.0f, -1.0f, 0.0f, 0.0f}, 1);
    -
    GPU_SetFloatUniform(GPU_VERTEX_SHADER, uLoc_lightClr, (u32*)(float[]){1.0f, 1.0f, 1.0f, 1.0f}, 1);
    +
    // Update the uniforms
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_projection, &projection);
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_modelView, &modelView);
    +
    C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, uLoc_material, &material);
    +
    C3D_FVUnifSet(GPU_VERTEX_SHADER, uLoc_lightVec, 0.0f, 0.0f, -1.0f, 0.0f);
    +
    C3D_FVUnifSet(GPU_VERTEX_SHADER, uLoc_lightHalfVec, 0.0f, 0.0f, -1.0f, 0.0f);
    +
    C3D_FVUnifSet(GPU_VERTEX_SHADER, uLoc_lightClr, 1.0f, 1.0f, 1.0f, 1.0f);
    // Draw the VBO
    -
    GPU_DrawArray(GPU_TRIANGLES, 0, vertex_list_count);
    +
    C3D_DrawArrays(GPU_TRIANGLES, 0, vertex_list_count);
    }
    static void sceneExit(void)
    {
    // Free the texture
    -
    linearFree(tex_data);
    +
    C3D_TexDelete(&kitten_tex);
    // Free the VBO
    -
    linearFree(vbo_data);
    +
    linearFree(vbo_data);
    // Free the shader program
    -
    shaderProgramFree(&program);
    -
    DVLB_Free(vshader_dvlb);
    +
    shaderProgramFree(&program);
    +
    DVLB_Free(vshader_dvlb);
    }
    int main()
    {
    // Initialize graphics
    - -
    gpuInit();
    + +
    C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
    +
    +
    // Initialize the render target
    +
    C3D_RenderTarget* target = C3D_RenderTargetCreate(240, 400, GPU_RB_RGBA8, GPU_RB_DEPTH24_STENCIL8);
    +
    C3D_RenderTargetSetClear(target, C3D_CLEAR_ALL, CLEAR_COLOR, 0);
    +
    C3D_RenderTargetSetOutput(target, GFX_TOP, GFX_LEFT, DISPLAY_TRANSFER_FLAGS);
    // Initialize the scene
    sceneInit();
    -
    gpuClearBuffers(CLEAR_COLOR);
    // Main loop
    -
    while (aptMainLoop())
    +
    while (aptMainLoop())
    {
    -
    gspWaitForVBlank(); // Synchronize with the start of VBlank
    -
    gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
    -
    hidScanInput(); // Read the user input
    +
    // Respond to user input
    -
    u32 kDown = hidKeysDown();
    -
    if (kDown & KEY_START)
    +
    u32 kDown = hidKeysDown();
    +
    if (kDown & KEY_START)
    break; // break in order to return to hbmenu
    // Render the scene
    -
    gpuFrameBegin();
    -
    sceneRender();
    -
    gpuFrameEnd();
    -
    gpuClearBuffers(CLEAR_COLOR);
    -
    -
    // Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
    -
    //gfxFlushBuffers();
    +
    C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
    +
    C3D_FrameDrawOn(target);
    +
    sceneRender();
    +
    C3D_FrameEnd(0);
    }
    // Deinitialize the scene
    sceneExit();
    // Deinitialize graphics
    -
    gpuExit();
    - +
    C3D_Fini();
    +
    return 0;
    }
    diff --git a/graphics_2printing_2both-screen-text_2source_2main_8c-example.html b/graphics_2printing_2both-screen-text_2source_2main_8c-example.html index b06d7f7..3c7accc 100644 --- a/graphics_2printing_2both-screen-text_2source_2main_8c-example.html +++ b/graphics_2printing_2both-screen-text_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/graphics_2printing_2colored-text_2source_2main_8c-example.html b/graphics_2printing_2colored-text_2source_2main_8c-example.html index 5262564..991464c 100644 --- a/graphics_2printing_2colored-text_2source_2main_8c-example.html +++ b/graphics_2printing_2colored-text_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/graphics_2printing_2hello-world_2source_2main_8c-example.html b/graphics_2printing_2hello-world_2source_2main_8c-example.html index a277062..eb4be75 100644 --- a/graphics_2printing_2hello-world_2source_2main_8c-example.html +++ b/graphics_2printing_2hello-world_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/graphics_2printing_2multiple-windows-text_2source_2main_8c-example.html b/graphics_2printing_2multiple-windows-text_2source_2main_8c-example.html index 10160db..b57d351 100644 --- a/graphics_2printing_2multiple-windows-text_2source_2main_8c-example.html +++ b/graphics_2printing_2multiple-windows-text_2source_2main_8c-example.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/gspgpu_8h.html b/gspgpu_8h.html index 1efbc81..489fe61 100644 --- a/gspgpu_8h.html +++ b/gspgpu_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -199,6 +199,9 @@ Functions void gspExit (void)  Exits GSPGPU.
      +void gspSetEventCallback (GSPGPU_Event id, ThreadFunc cb, void *data, bool oneShot) + Configures a callback to run when a GSPGPU event occurs. More...
    Result gspInitEventHandler (Handle gspEvent, vu8 *gspSharedMem, u8 gspThreadId)  Initializes the GSPGPU event handler. More...
      @@ -209,6 +212,9 @@ void void gspWaitForEvent (GSPGPU_Event id, bool nextEvent)  Waits for a GSPGPU event to occur. More...
      +GSPGPU_Event gspWaitForAnyEvent (void) + Waits for any GSPGPU event to occur. More...
    Result gspSubmitGxCommand (u32 *sharedGspCmdBuf, u32 gxCommand[0x8])  Submits a GX command. More...
      @@ -394,7 +400,7 @@ void audio/mic/source/main.c, and mvd/source/main.c. +
    Examples:
    audio/mic/source/main.c, graphics/gpu/gpusprites/source/main.c, and mvd/source/main.c.
    @@ -746,6 +752,55 @@ void  +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    void gspSetEventCallback (GSPGPU_Event id,
    ThreadFunc cb,
    void * data,
    bool oneShot 
    )
    +
    + +

    Configures a callback to run when a GSPGPU event occurs.

    +
    Parameters
    + + + + + +
    idID of the event.
    cbCallback to run.
    dataData to be passed to the callback.
    oneShotWhen true, the callback is only executed once. When false, the callback is executed every time the event occurs.
    +
    +
    +
    @@ -781,6 +836,26 @@ void  +
    +
    + + + + + + + + +
    GSPGPU_Event gspWaitForAnyEvent (void )
    +
    + +

    Waits for any GSPGPU event to occur.

    +
    Returns
    The ID of the event that occurred.
    +

    The function returns immediately if there are unprocessed events at the time of call.

    +
    @@ -811,7 +886,7 @@ void 
    Parameters
    - +
    idID of the event.
    Whetherto discard the current event and wait for the next event.
    nextEventWhether to discard the current event and wait for the next event.
    diff --git a/gspgpu_8h_source.html b/gspgpu_8h_source.html index 5438d85..690c9a0 100644 --- a/gspgpu_8h_source.html +++ b/gspgpu_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -157,143 +157,160 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    64 void gspExit(void);
    65 
    66 /**
    -
    67  * @brief Initializes the GSPGPU event handler.
    -
    68  * @param gspEvent Event handle to use.
    -
    69  * @param gspSharedMem GSP shared memory.
    -
    70  * @param gspThreadId ID of the GSP thread.
    -
    71  */
    -
    72 Result gspInitEventHandler(Handle gspEvent, vu8* gspSharedMem, u8 gspThreadId);
    -
    73 
    -
    74 /// Exits the GSPGPU event handler.
    -
    75 void gspExitEventHandler(void);
    -
    76 
    -
    77 /**
    -
    78  * @brief Waits for a GSPGPU event to occur.
    -
    79  * @param id ID of the event.
    -
    80  * @param Whether to discard the current event and wait for the next event.
    -
    81  */
    -
    82 void gspWaitForEvent(GSPGPU_Event id, bool nextEvent);
    -
    83 
    -
    84 /// Waits for PSC0
    -
    85 #define gspWaitForPSC0() gspWaitForEvent(GSPGPU_EVENT_PSC0, false)
    -
    86 
    -
    87 /// Waits for PSC1
    -
    88 #define gspWaitForPSC1() gspWaitForEvent(GSPGPU_EVENT_PSC1, false)
    -
    89 
    -
    90 /// Waits for VBlank.
    -
    91 #define gspWaitForVBlank() gspWaitForVBlank0()
    +
    67  * @brief Configures a callback to run when a GSPGPU event occurs.
    +
    68  * @param id ID of the event.
    +
    69  * @param cb Callback to run.
    +
    70  * @param data Data to be passed to the callback.
    +
    71  * @param oneShot When true, the callback is only executed once. When false, the callback is executed every time the event occurs.
    +
    72  */
    +
    73 void gspSetEventCallback(GSPGPU_Event id, ThreadFunc cb, void* data, bool oneShot);
    +
    74 
    +
    75 /**
    +
    76  * @brief Initializes the GSPGPU event handler.
    +
    77  * @param gspEvent Event handle to use.
    +
    78  * @param gspSharedMem GSP shared memory.
    +
    79  * @param gspThreadId ID of the GSP thread.
    +
    80  */
    +
    81 Result gspInitEventHandler(Handle gspEvent, vu8* gspSharedMem, u8 gspThreadId);
    +
    82 
    +
    83 /// Exits the GSPGPU event handler.
    +
    84 void gspExitEventHandler(void);
    +
    85 
    +
    86 /**
    +
    87  * @brief Waits for a GSPGPU event to occur.
    +
    88  * @param id ID of the event.
    +
    89  * @param nextEvent Whether to discard the current event and wait for the next event.
    +
    90  */
    +
    91 void gspWaitForEvent(GSPGPU_Event id, bool nextEvent);
    92 
    -
    93 /// Waits for VBlank0.
    -
    94 #define gspWaitForVBlank0() gspWaitForEvent(GSPGPU_EVENT_VBlank0, true)
    -
    95 
    -
    96 /// Waits for VBlank1.
    -
    97 #define gspWaitForVBlank1() gspWaitForEvent(GSPGPU_EVENT_VBlank1, true)
    -
    98 
    -
    99 /// Waits for PPF.
    -
    100 #define gspWaitForPPF() gspWaitForEvent(GSPGPU_EVENT_PPF, false)
    -
    101 
    -
    102 /// Waits for P3D.
    -
    103 #define gspWaitForP3D() gspWaitForEvent(GSPGPU_EVENT_P3D, false)
    -
    104 
    -
    105 /// Waits for DMA.
    -
    106 #define gspWaitForDMA() gspWaitForEvent(GSPGPU_EVENT_DMA, false)
    -
    107 
    -
    108 /**
    -
    109  * @brief Submits a GX command.
    -
    110  * @param sharedGspCmdBuf Command buffer to use.
    -
    111  * @param gxCommand GX command to execute.
    -
    112  */
    -
    113 Result gspSubmitGxCommand(u32* sharedGspCmdBuf, u32 gxCommand[0x8]);
    -
    114 
    -
    115 /**
    -
    116  * @brief Acquires GPU rights.
    -
    117  * @param flags Flags to acquire with.
    -
    118  */
    -
    119 Result GSPGPU_AcquireRight(u8 flags);
    -
    120 
    -
    121 /// Releases GPU rights.
    -
    122 Result GSPGPU_ReleaseRight(void);
    -
    123 
    -
    124 /**
    -
    125  * @brief Retrieves display capture info.
    -
    126  * @param captureinfo Pointer to output capture info to.
    -
    127  */
    -
    128 Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo*captureinfo);
    -
    129 
    -
    130 /// Sames the VRAM sys area.
    -
    131 Result GSPGPU_SaveVramSysArea(void);
    -
    132 
    -
    133 /// Restores the VRAM sys area.
    -
    134 Result GSPGPU_RestoreVramSysArea(void);
    -
    135 
    -
    136 /**
    -
    137  * @brief Sets whether to force the LCD to black.
    -
    138  * @param flags Whether to force the LCD to black. (0 = no, non-zero = yes)
    -
    139  */
    -
    140 Result GSPGPU_SetLcdForceBlack(u8 flags);
    -
    141 
    -
    142 /**
    -
    143  * @brief Updates a screen's framebuffer state.
    -
    144  * @param screenid ID of the screen to update.
    -
    145  * @param framebufinfo Framebuffer information to update with.
    -
    146  */
    -
    147 Result GSPGPU_SetBufferSwap(u32 screenid, GSPGPU_FramebufferInfo*framebufinfo);
    -
    148 
    -
    149 /**
    -
    150  * @brief Flushes memory from the data cache.
    -
    151  * @param adr Address to flush.
    -
    152  * @param size Size of the memory to flush.
    -
    153  */
    -
    154 Result GSPGPU_FlushDataCache(const void* adr, u32 size);
    -
    155 
    -
    156 /**
    -
    157  * @brief Invalidates memory in the data cache.
    -
    158  * @param adr Address to invalidate.
    -
    159  * @param size Size of the memory to invalidate.
    -
    160  */
    -
    161 Result GSPGPU_InvalidateDataCache(const void* adr, u32 size);
    -
    162 
    -
    163 /**
    -
    164  * @brief Writes to GPU hardware registers.
    -
    165  * @param regAddr Register address to write to.
    -
    166  * @param data Data to write.
    -
    167  * @param size Size of the data to write.
    -
    168  */
    -
    169 Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size);
    -
    170 
    -
    171 /**
    -
    172  * @brief Writes to GPU hardware registers with a mask.
    -
    173  * @param regAddr Register address to write to.
    -
    174  * @param data Data to write.
    -
    175  * @param datasize Size of the data to write.
    -
    176  * @param maskdata Data of the mask.
    -
    177  * @param masksize Size of the mask.
    -
    178  */
    -
    179 Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize);
    -
    180 
    -
    181 /**
    -
    182  * @brief Reads from GPU hardware registers.
    -
    183  * @param regAddr Register address to read from.
    -
    184  * @param data Buffer to read data to.
    -
    185  * @param size Size of the buffer.
    -
    186  */
    -
    187 Result GSPGPU_ReadHWRegs(u32 regAddr, u32* data, u8 size);
    -
    188 
    -
    189 /**
    -
    190  * @brief Registers the interrupt relay queue.
    -
    191  * @param eventHandle Handle of the GX command event.
    -
    192  * @param flags Flags to register with.
    -
    193  * @param outMemHandle Pointer to output the shared memory handle to.
    -
    194  * @param threadID Pointer to output the GSP thread ID to.
    +
    93 /**
    +
    94  * @brief Waits for any GSPGPU event to occur.
    +
    95  * @return The ID of the event that occurred.
    +
    96  *
    +
    97  * The function returns immediately if there are unprocessed events at the time of call.
    +
    98  */
    +
    99 GSPGPU_Event gspWaitForAnyEvent(void);
    +
    100 
    +
    101 /// Waits for PSC0
    +
    102 #define gspWaitForPSC0() gspWaitForEvent(GSPGPU_EVENT_PSC0, false)
    +
    103 
    +
    104 /// Waits for PSC1
    +
    105 #define gspWaitForPSC1() gspWaitForEvent(GSPGPU_EVENT_PSC1, false)
    +
    106 
    +
    107 /// Waits for VBlank.
    +
    108 #define gspWaitForVBlank() gspWaitForVBlank0()
    +
    109 
    +
    110 /// Waits for VBlank0.
    +
    111 #define gspWaitForVBlank0() gspWaitForEvent(GSPGPU_EVENT_VBlank0, true)
    +
    112 
    +
    113 /// Waits for VBlank1.
    +
    114 #define gspWaitForVBlank1() gspWaitForEvent(GSPGPU_EVENT_VBlank1, true)
    +
    115 
    +
    116 /// Waits for PPF.
    +
    117 #define gspWaitForPPF() gspWaitForEvent(GSPGPU_EVENT_PPF, false)
    +
    118 
    +
    119 /// Waits for P3D.
    +
    120 #define gspWaitForP3D() gspWaitForEvent(GSPGPU_EVENT_P3D, false)
    +
    121 
    +
    122 /// Waits for DMA.
    +
    123 #define gspWaitForDMA() gspWaitForEvent(GSPGPU_EVENT_DMA, false)
    +
    124 
    +
    125 /**
    +
    126  * @brief Submits a GX command.
    +
    127  * @param sharedGspCmdBuf Command buffer to use.
    +
    128  * @param gxCommand GX command to execute.
    +
    129  */
    +
    130 Result gspSubmitGxCommand(u32* sharedGspCmdBuf, u32 gxCommand[0x8]);
    +
    131 
    +
    132 /**
    +
    133  * @brief Acquires GPU rights.
    +
    134  * @param flags Flags to acquire with.
    +
    135  */
    +
    136 Result GSPGPU_AcquireRight(u8 flags);
    +
    137 
    +
    138 /// Releases GPU rights.
    +
    139 Result GSPGPU_ReleaseRight(void);
    +
    140 
    +
    141 /**
    +
    142  * @brief Retrieves display capture info.
    +
    143  * @param captureinfo Pointer to output capture info to.
    +
    144  */
    +
    145 Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo*captureinfo);
    +
    146 
    +
    147 /// Sames the VRAM sys area.
    +
    148 Result GSPGPU_SaveVramSysArea(void);
    +
    149 
    +
    150 /// Restores the VRAM sys area.
    +
    151 Result GSPGPU_RestoreVramSysArea(void);
    +
    152 
    +
    153 /**
    +
    154  * @brief Sets whether to force the LCD to black.
    +
    155  * @param flags Whether to force the LCD to black. (0 = no, non-zero = yes)
    +
    156  */
    +
    157 Result GSPGPU_SetLcdForceBlack(u8 flags);
    +
    158 
    +
    159 /**
    +
    160  * @brief Updates a screen's framebuffer state.
    +
    161  * @param screenid ID of the screen to update.
    +
    162  * @param framebufinfo Framebuffer information to update with.
    +
    163  */
    +
    164 Result GSPGPU_SetBufferSwap(u32 screenid, GSPGPU_FramebufferInfo*framebufinfo);
    +
    165 
    +
    166 /**
    +
    167  * @brief Flushes memory from the data cache.
    +
    168  * @param adr Address to flush.
    +
    169  * @param size Size of the memory to flush.
    +
    170  */
    +
    171 Result GSPGPU_FlushDataCache(const void* adr, u32 size);
    +
    172 
    +
    173 /**
    +
    174  * @brief Invalidates memory in the data cache.
    +
    175  * @param adr Address to invalidate.
    +
    176  * @param size Size of the memory to invalidate.
    +
    177  */
    +
    178 Result GSPGPU_InvalidateDataCache(const void* adr, u32 size);
    +
    179 
    +
    180 /**
    +
    181  * @brief Writes to GPU hardware registers.
    +
    182  * @param regAddr Register address to write to.
    +
    183  * @param data Data to write.
    +
    184  * @param size Size of the data to write.
    +
    185  */
    +
    186 Result GSPGPU_WriteHWRegs(u32 regAddr, u32* data, u8 size);
    +
    187 
    +
    188 /**
    +
    189  * @brief Writes to GPU hardware registers with a mask.
    +
    190  * @param regAddr Register address to write to.
    +
    191  * @param data Data to write.
    +
    192  * @param datasize Size of the data to write.
    +
    193  * @param maskdata Data of the mask.
    +
    194  * @param masksize Size of the mask.
    195  */
    -
    196 Result GSPGPU_RegisterInterruptRelayQueue(Handle eventHandle, u32 flags, Handle* outMemHandle, u8* threadID);
    +
    196 Result GSPGPU_WriteHWRegsWithMask(u32 regAddr, u32* data, u8 datasize, u32* maskdata, u8 masksize);
    197 
    -
    198 /// Unregisters the interrupt relay queue.
    -
    199 Result GSPGPU_UnregisterInterruptRelayQueue(void);
    -
    200 
    -
    201 /// Triggers a handling of commands written to shared memory.
    -
    202 Result GSPGPU_TriggerCmdReqQueue(void);
    -
    203 
    +
    198 /**
    +
    199  * @brief Reads from GPU hardware registers.
    +
    200  * @param regAddr Register address to read from.
    +
    201  * @param data Buffer to read data to.
    +
    202  * @param size Size of the buffer.
    +
    203  */
    +
    204 Result GSPGPU_ReadHWRegs(u32 regAddr, u32* data, u8 size);
    +
    205 
    +
    206 /**
    +
    207  * @brief Registers the interrupt relay queue.
    +
    208  * @param eventHandle Handle of the GX command event.
    +
    209  * @param flags Flags to register with.
    +
    210  * @param outMemHandle Pointer to output the shared memory handle to.
    +
    211  * @param threadID Pointer to output the GSP thread ID to.
    +
    212  */
    +
    213 Result GSPGPU_RegisterInterruptRelayQueue(Handle eventHandle, u32 flags, Handle* outMemHandle, u8* threadID);
    +
    214 
    +
    215 /// Unregisters the interrupt relay queue.
    +
    216 Result GSPGPU_UnregisterInterruptRelayQueue(void);
    +
    217 
    +
    218 /// Triggers a handling of commands written to shared memory.
    +
    219 Result GSPGPU_TriggerCmdReqQueue(void);
    +
    220 
    u32 * framebuf1_vaddr
    Right framebuffer.
    Definition: gspgpu.h:35
    GSPGPU_Event
    GSPGPU events.
    Definition: gspgpu.h:47
    Used to know how many events there are.
    Definition: gspgpu.h:57
    @@ -303,6 +320,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    u32 format
    Framebuffer format.
    Definition: gspgpu.h:36
    RGBA4. (2 bytes)
    Definition: gspgpu.h:28
    u32 format
    Framebuffer format, this u16 is written to the low u16 for LCD register 0x1EF00X70.
    Definition: gspgpu.h:16
    +
    void(* ThreadFunc)(void *)
    Thread entrypoint function.
    Definition: types.h:43
    +
    void gspSetEventCallback(GSPGPU_Event id, ThreadFunc cb, void *data, bool oneShot)
    Configures a callback to run when a GSPGPU event occurs.
    Display transfer finished.
    Definition: gspgpu.h:53
    Result GSPGPU_UnregisterInterruptRelayQueue(void)
    Unregisters the interrupt relay queue.
    Result GSPGPU_SetLcdForceBlack(u8 flags)
    Sets whether to force the LCD to black.
    @@ -322,6 +341,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    u32 framebuf_dispselect
    Value for 0x1EF00X78, controls which framebuffer is displayed.
    Definition: gspgpu.h:17
    TODO.
    Definition: gspgpu.h:55
    RGB565. (2 bytes)
    Definition: gspgpu.h:26
    +
    GSPGPU_Event gspWaitForAnyEvent(void)
    Waits for any GSPGPU event to occur.
    uint32_t u32
    32-bit unsigned integer
    Definition: types.h:23
    Capture info entry.
    Definition: gspgpu.h:32
    Result gspInitEventHandler(Handle gspEvent, vu8 *gspSharedMem, u8 gspThreadId)
    Initializes the GSPGPU event handler.
    diff --git a/gsplcd_8h.html b/gsplcd_8h.html index 8c915ce..605889a 100644 --- a/gsplcd_8h.html +++ b/gsplcd_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/gsplcd_8h_source.html b/gsplcd_8h_source.html index 629b457..3e81c01 100644 --- a/gsplcd_8h_source.html +++ b/gsplcd_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    diff --git a/gx_8h.html b/gx_8h.html index 4a6f04b..0821e81 100644 --- a/gx_8h.html +++ b/gx_8h.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -104,9 +104,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - + + @@ -212,7 +211,44 @@ Variables

    Macros

    -#define GX_BUFFER_DIM(w, h)   (((h)<<16)|((w)&0xFFFF))
     Creates a buffer dimension parameter from width and height values.
    #define GX_BUFFER_DIM(w, h)   (((h)<<16)|((w)&0xFFFF))
     Creates a buffer dimension parameter from width and height values. More...
     
    #define GX_TRANSFER_FLIP_VERT(x)   ((x)<<0)

    Detailed Description

    GX commands.

    -

    Enumeration Type Documentation

    +

    Macro Definition Documentation

    + +
    +
    + + + + + + + + + + + + + + + + + + +
    #define GX_BUFFER_DIM( w,
     
    )   (((h)<<16)|((w)&0xFFFF))
    +
    + +

    Creates a buffer dimension parameter from width and height values.

    +
    Parameters
    + + + +
    wbuffer width for GX_DisplayTransfer, linesize for GX_TextureCopy
    hbuffer height for GX_DisplayTransfer, gap for GX_TextureCopy
    +
    +
    +
    Examples:
    graphics/gpu/gpusprites/source/main.c.
    +
    +
    +
    +

    Enumeration Type Documentation

    @@ -498,8 +534,7 @@ Variables -
    Examples:
    graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, and graphics/gpu/textured_cube/source/main.c.
    -
    + diff --git a/gx_8h_source.html b/gx_8h_source.html index 2497463..f65c4f1 100644 --- a/gx_8h_source.html +++ b/gx_8h_source.html @@ -24,7 +24,7 @@
    libctru -  v1.0.0 +  v1.1.0
    @@ -97,154 +97,158 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    4  */
    5 #pragma once
    6 
    -
    7 /// Creates a buffer dimension parameter from width and height values.
    -
    8 #define GX_BUFFER_DIM(w, h) (((h)<<16)|((w)&0xFFFF))
    -
    9 
    -
    10 /**
    -
    11  * @brief Supported transfer pixel formats.
    -
    12  * @sa GSPGPU_FramebufferFormats
    -
    13  */
    -
    14 typedef enum
    -
    15 {
    -
    16  GX_TRANSFER_FMT_RGBA8 = 0, ///< 8-bit Red + 8-bit Green + 8-bit Blue + 8-bit Alpha
    -
    17  GX_TRANSFER_FMT_RGB8 = 1, ///< 8-bit Red + 8-bit Green + 8-bit Blue
    -
    18  GX_TRANSFER_FMT_RGB565 = 2, ///< 5-bit Red + 6-bit Green + 5-bit Blue
    -
    19  GX_TRANSFER_FMT_RGB5A1 = 3, ///< 5-bit Red + 5-bit Green + 5-bit Blue + 1-bit Alpha
    -
    20  GX_TRANSFER_FMT_RGBA4 = 4 ///< 4-bit Red + 4-bit Green + 4-bit Blue + 4-bit Alpha
    -
    21 } GX_TRANSFER_FORMAT;
    -
    22 
    -
    23 /**
    -
    24  * @brief Anti-aliasing modes
    -
    25  *
    -
    26  * Please remember that the framebuffer is sideways.
    -
    27  * Hence if you activate 2x1 anti-aliasing the destination dimensions are w = 240*2 and h = 400
    -
    28  */
    -
    29 typedef enum
    -
    30 {
    -
    31  GX_TRANSFER_SCALE_NO = 0, ///< No anti-aliasing
    -
    32  GX_TRANSFER_SCALE_X = 1, ///< 2x1 anti-aliasing
    -
    33  GX_TRANSFER_SCALE_XY = 2, ///< 2x2 anti-aliasing
    -
    34 } GX_TRANSFER_SCALE;
    -
    35 
    -
    36 /// GX transfer control flags
    -
    37 typedef enum
    -
    38 {
    -
    39  GX_FILL_TRIGGER = 0x001, ///< Trigger the PPF event
    -
    40  GX_FILL_FINISHED = 0x002, ///< Indicates if the memory fill is complete. You should not use it when requesting a transfer.
    -
    41  GX_FILL_16BIT_DEPTH = 0x000, ///< The buffer has a 16 bit per pixel depth
    -
    42  GX_FILL_24BIT_DEPTH = 0x100, ///< The buffer has a 24 bit per pixel depth
    -
    43  GX_FILL_32BIT_DEPTH = 0x200, ///< The buffer has a 32 bit per pixel depth
    -
    44 } GX_FILL_CONTROL;
    -
    45 
    -
    46 /// Creates a transfer vertical flip flag.
    -
    47 #define GX_TRANSFER_FLIP_VERT(x) ((x)<<0)
    -
    48 /// Creates a transfer tiled output flag.
    -
    49 #define GX_TRANSFER_OUT_TILED(x) ((x)<<1)
    -
    50 /// Creates a transfer raw copy flag.
    -
    51 #define GX_TRANSFER_RAW_COPY(x) ((x)<<3)
    -
    52 /// Creates a transfer input format flag.
    -
    53 #define GX_TRANSFER_IN_FORMAT(x) ((x)<<8)
    -
    54 /// Creates a transfer output format flag.
    -
    55 #define GX_TRANSFER_OUT_FORMAT(x) ((x)<<12)
    -
    56 /// Creates a transfer scaling flag.
    -
    57 #define GX_TRANSFER_SCALING(x) ((x)<<24)
    -
    58 
    -
    59 /// Command list flag bit 0.
    -
    60 #define GX_CMDLIST_BIT0 BIT(0)
    -
    61 /// Flushes the command list.
    -
    62 #define GX_CMDLIST_FLUSH BIT(1)
    -
    63 
    -
    64 extern u32* gxCmdBuf; ///< GX command buffer.
    -
    65 
    -
    66 /**
    -
    67  * @brief Requests a DMA.
    -
    68  * @param src Source to DMA from.
    -
    69  * @param dst Destination to DMA to.
    -
    70  * @param length Length of data to transfer.
    -
    71  */
    -
    72 Result GX_RequestDma(u32* src, u32* dst, u32 length);
    -
    73 
    -
    74 /**
    -
    75  * @brief Processes a GPU command list.
    -
    76  * @param buf0a Command list address.
    -
    77  * @param buf0s Command list size.
    -
    78  * @param flags Flags to process with.
    -
    79  */
    -
    80 Result GX_ProcessCommandList(u32* buf0a, u32 buf0s, u8 flags);
    -
    81 
    -
    82 /**
    -
    83  * @brief Fills the memory of two buffers with the given values.
    -
    84  * @param buf0a Start address of the first buffer.
    -
    85  * @param buf0v Dimensions of the first buffer.
    -
    86  * @param buf0e End address of the first buffer.
    -
    87  * @param control0 Value to fill the first buffer with.
    -
    88  * @param buf1a Start address of the second buffer.
    -
    89  * @param buf1v Dimensions of the second buffer.
    -
    90  * @param buf1e End address of the second buffer.
    -
    91  * @param control1 Value to fill the second buffer with.
    -
    92  */
    -
    93 Result GX_MemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1);
    -
    94 
    -
    95 /**
    -
    96  * @brief Initiates a display transfer.
    -
    97  * @note The PPF event will be signaled on completion.
    -
    98  * @param inadr Address of the input.
    -
    99  * @param indim Dimensions of the input.
    -
    100  * @param outadr Address of the output.
    -
    101  * @param outdim Dimensions of the output.
    -
    102  * @param flags Flags to transfer with.
    -
    103  */
    -
    104 Result GX_DisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags);
    -
    105 
    -
    106 /**
    -
    107  * @brief Initiates a texture copy.
    -
    108  * @note The PPF event will be signaled on completion.
    -
    109  * @param inadr Address of the input.
    -
    110  * @param indim Dimensions of the input.
    -
    111  * @param outadr Address of the output.
    -
    112  * @param outdim Dimensions of the output.
    -
    113  * @param size Size of the data to transfer.
    -
    114  * @param flags Flags to transfer with.
    -
    115  */
    -
    116 Result GX_TextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags);
    -
    117 
    -
    118 /**
    -
    119  * @brief Flushes the cache regions of three buffers.
    -
    120  * @param buf0a Address of the first buffer.
    -
    121  * @param buf0s Size of the first buffer.
    -
    122  * @param buf1a Address of the second buffer.
    -
    123  * @param buf1s Size of the second buffer.
    -
    124  * @param buf2a Address of the third buffer.
    -
    125  * @param buf2s Size of the third buffer.
    -
    126  */
    -
    127 Result GX_FlushCacheRegions(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s);
    +
    7 /**
    +
    8  * @brief Creates a buffer dimension parameter from width and height values.
    +
    9  * @param w buffer width for GX_DisplayTransfer, linesize for GX_TextureCopy
    +
    10  * @param h buffer height for GX_DisplayTransfer, gap for GX_TextureCopy
    +
    11  */
    +
    12 #define GX_BUFFER_DIM(w, h) (((h)<<16)|((w)&0xFFFF))
    +
    13 
    +
    14 /**
    +
    15  * @brief Supported transfer pixel formats.
    +
    16  * @sa GSPGPU_FramebufferFormats
    +
    17  */
    +
    18 typedef enum
    +
    19 {
    +
    20  GX_TRANSFER_FMT_RGBA8 = 0, ///< 8-bit Red + 8-bit Green + 8-bit Blue + 8-bit Alpha
    +
    21  GX_TRANSFER_FMT_RGB8 = 1, ///< 8-bit Red + 8-bit Green + 8-bit Blue
    +
    22  GX_TRANSFER_FMT_RGB565 = 2, ///< 5-bit Red + 6-bit Green + 5-bit Blue
    +
    23  GX_TRANSFER_FMT_RGB5A1 = 3, ///< 5-bit Red + 5-bit Green + 5-bit Blue + 1-bit Alpha
    +
    24  GX_TRANSFER_FMT_RGBA4 = 4 ///< 4-bit Red + 4-bit Green + 4-bit Blue + 4-bit Alpha
    +
    25 } GX_TRANSFER_FORMAT;
    +
    26 
    +
    27 /**
    +
    28  * @brief Anti-aliasing modes
    +
    29  *
    +
    30  * Please remember that the framebuffer is sideways.
    +
    31  * Hence if you activate 2x1 anti-aliasing the destination dimensions are w = 240*2 and h = 400
    +
    32  */
    +
    33 typedef enum
    +
    34 {
    +
    35  GX_TRANSFER_SCALE_NO = 0, ///< No anti-aliasing
    +
    36  GX_TRANSFER_SCALE_X = 1, ///< 2x1 anti-aliasing
    +
    37  GX_TRANSFER_SCALE_XY = 2, ///< 2x2 anti-aliasing
    +
    38 } GX_TRANSFER_SCALE;
    +
    39 
    +
    40 /// GX transfer control flags
    +
    41 typedef enum
    +
    42 {
    +
    43  GX_FILL_TRIGGER = 0x001, ///< Trigger the PPF event
    +
    44  GX_FILL_FINISHED = 0x002, ///< Indicates if the memory fill is complete. You should not use it when requesting a transfer.
    +
    45  GX_FILL_16BIT_DEPTH = 0x000, ///< The buffer has a 16 bit per pixel depth
    +
    46  GX_FILL_24BIT_DEPTH = 0x100, ///< The buffer has a 24 bit per pixel depth
    +
    47  GX_FILL_32BIT_DEPTH = 0x200, ///< The buffer has a 32 bit per pixel depth
    +
    48 } GX_FILL_CONTROL;
    +
    49 
    +
    50 /// Creates a transfer vertical flip flag.
    +
    51 #define GX_TRANSFER_FLIP_VERT(x) ((x)<<0)
    +
    52 /// Creates a transfer tiled output flag.
    +
    53 #define GX_TRANSFER_OUT_TILED(x) ((x)<<1)
    +
    54 /// Creates a transfer raw copy flag.
    +
    55 #define GX_TRANSFER_RAW_COPY(x) ((x)<<3)
    +
    56 /// Creates a transfer input format flag.
    +
    57 #define GX_TRANSFER_IN_FORMAT(x) ((x)<<8)
    +
    58 /// Creates a transfer output format flag.
    +
    59 #define GX_TRANSFER_OUT_FORMAT(x) ((x)<<12)
    +
    60 /// Creates a transfer scaling flag.
    +
    61 #define GX_TRANSFER_SCALING(x) ((x)<<24)
    +
    62 
    +
    63 /// Command list flag bit 0.
    +
    64 #define GX_CMDLIST_BIT0 BIT(0)
    +
    65 /// Flushes the command list.
    +
    66 #define GX_CMDLIST_FLUSH BIT(1)
    +
    67 
    +
    68 extern u32* gxCmdBuf; ///< GX command buffer.
    +
    69 
    +
    70 /**
    +
    71  * @brief Requests a DMA.
    +
    72  * @param src Source to DMA from.
    +
    73  * @param dst Destination to DMA to.
    +
    74  * @param length Length of data to transfer.
    +
    75  */
    +
    76 Result GX_RequestDma(u32* src, u32* dst, u32 length);
    +
    77 
    +
    78 /**
    +
    79  * @brief Processes a GPU command list.
    +
    80  * @param buf0a Command list address.
    +
    81  * @param buf0s Command list size.
    +
    82  * @param flags Flags to process with.
    +
    83  */
    +
    84 Result GX_ProcessCommandList(u32* buf0a, u32 buf0s, u8 flags);
    +
    85 
    +
    86 /**
    +
    87  * @brief Fills the memory of two buffers with the given values.
    +
    88  * @param buf0a Start address of the first buffer.
    +
    89  * @param buf0v Dimensions of the first buffer.
    +
    90  * @param buf0e End address of the first buffer.
    +
    91  * @param control0 Value to fill the first buffer with.
    +
    92  * @param buf1a Start address of the second buffer.
    +
    93  * @param buf1v Dimensions of the second buffer.
    +
    94  * @param buf1e End address of the second buffer.
    +
    95  * @param control1 Value to fill the second buffer with.
    +
    96  */
    +
    97 Result GX_MemoryFill(u32* buf0a, u32 buf0v, u32* buf0e, u16 control0, u32* buf1a, u32 buf1v, u32* buf1e, u16 control1);
    +
    98 
    +
    99 /**
    +
    100  * @brief Initiates a display transfer.
    +
    101  * @note The PPF event will be signaled on completion.
    +
    102  * @param inadr Address of the input.
    +
    103  * @param indim Dimensions of the input.
    +
    104  * @param outadr Address of the output.
    +
    105  * @param outdim Dimensions of the output.
    +
    106  * @param flags Flags to transfer with.
    +
    107  */
    +
    108 Result GX_DisplayTransfer(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags);
    +
    109 
    +
    110 /**
    +
    111  * @brief Initiates a texture copy.
    +
    112  * @note The PPF event will be signaled on completion.
    +
    113  * @param inadr Address of the input.
    +
    114  * @param indim Dimensions of the input.
    +
    115  * @param outadr Address of the output.
    +
    116  * @param outdim Dimensions of the output.
    +
    117  * @param size Size of the data to transfer.
    +
    118  * @param flags Flags to transfer with.
    +
    119  */
    +
    120 Result GX_TextureCopy(u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags);
    +
    121 
    +
    122 /**
    +
    123  * @brief Flushes the cache regions of three buffers.
    +
    124  * @param buf0a Address of the first buffer.
    +
    125  * @param buf0s Size of the first buffer.
    +
    126  * @param buf1a Address of the second buffer.
    +
    127  * @param buf1s Size of the second buffer.
    +
    128  * @param buf2a Address of the third buffer.
    +
    129  * @param buf2s Size of the third buffer.
    +
    130  */
    +
    131 Result GX_FlushCacheRegions(u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s);
    Result GX_FlushCacheRegions(u32 *buf0a, u32 buf0s, u32 *buf1a, u32 buf1s, u32 *buf2a, u32 buf2s)
    Flushes the cache regions of three buffers.
    s32 Result
    Function result.
    Definition: types.h:42
    uint16_t u16
    16-bit unsigned integer
    Definition: types.h:22
    -
    GX_TRANSFER_FORMAT
    Supported transfer pixel formats.
    Definition: gx.h:14
    -
    Indicates if the memory fill is complete. You should not use it when requesting a transfer...
    Definition: gx.h:40
    -
    8-bit Red + 8-bit Green + 8-bit Blue + 8-bit Alpha
    Definition: gx.h:16
    +
    GX_TRANSFER_FORMAT
    Supported transfer pixel formats.
    Definition: gx.h:18
    +
    Indicates if the memory fill is complete. You should not use it when requesting a transfer...
    Definition: gx.h:44
    +
    8-bit Red + 8-bit Green + 8-bit Blue + 8-bit Alpha
    Definition: gx.h:20
    Result GX_DisplayTransfer(u32 *inadr, u32 indim, u32 *outadr, u32 outdim, u32 flags)
    Initiates a display transfer.
    Result GX_MemoryFill(u32 *buf0a, u32 buf0v, u32 *buf0e, u16 control0, u32 *buf1a, u32 buf1v, u32 *buf1e, u16 control1)
    Fills the memory of two buffers with the given values.
    -
    GX_FILL_CONTROL
    GX transfer control flags.
    Definition: gx.h:37
    -
    4-bit Red + 4-bit Green + 4-bit Blue + 4-bit Alpha
    Definition: gx.h:20
    +
    GX_FILL_CONTROL
    GX transfer control flags.
    Definition: gx.h:41
    +
    4-bit Red + 4-bit Green + 4-bit Blue + 4-bit Alpha
    Definition: gx.h:24
    uint8_t u8
    would be nice if newlib had this already
    Definition: types.h:21
    -
    No anti-aliasing.
    Definition: gx.h:31
    +
    No anti-aliasing.
    Definition: gx.h:35
    Result GX_RequestDma(u32 *src, u32 *dst, u32 length)
    Requests a DMA.
    Result GX_ProcessCommandList(u32 *buf0a, u32 buf0s, u8 flags)
    Processes a GPU command list.
    -
    5-bit Red + 6-bit Green + 5-bit Blue
    Definition: gx.h:18
    +
    5-bit Red + 6-bit Green + 5-bit Blue
    Definition: gx.h:22
    uint32_t u32
    32-bit unsigned integer
    Definition: types.h:23
    -
    The buffer has a 24 bit per pixel depth.
    Definition: gx.h:42
    +
    The buffer has a 24 bit per pixel depth.
    Definition: gx.h:46
    u32 * gxCmdBuf
    GX command buffer.
    -
    8-bit Red + 8-bit Green + 8-bit Blue
    Definition: gx.h:17
    -
    The buffer has a 32 bit per pixel depth.
    Definition: gx.h:43
    -
    Trigger the PPF event.
    Definition: gx.h:39
    -
    2x1 anti-aliasing
    Definition: gx.h:32
    -
    2x2 anti-aliasing
    Definition: gx.h:33
    -
    5-bit Red + 5-bit Green + 5-bit Blue + 1-bit Alpha
    Definition: gx.h:19
    -
    GX_TRANSFER_SCALE
    Anti-aliasing modes.
    Definition: gx.h:29
    +
    8-bit Red + 8-bit Green + 8-bit Blue
    Definition: gx.h:21
    +
    The buffer has a 32 bit per pixel depth.
    Definition: gx.h:47
    +
    Trigger the PPF event.
    Definition: gx.h:43
    +
    2x1 anti-aliasing
    Definition: gx.h:36
    +
    2x2 anti-aliasing
    Definition: gx.h:37
    +
    5-bit Red + 5-bit Green + 5-bit Blue + 1-bit Alpha
    Definition: gx.h:23
    +
    GX_TRANSFER_SCALE
    Anti-aliasing modes.
    Definition: gx.h:33
    Result GX_TextureCopy(u32 *inadr, u32 indim, u32 *outadr, u32 outdim, u32 size, u32 flags)
    Initiates a texture copy.
    -
    The buffer has a 16 bit per pixel depth.
    Definition: gx.h:41
    +
    The buffer has a 16 bit per pixel depth.
    Definition: gx.h:45