Last active
March 1, 2025 17:40
-
-
Save TuxSH/863077a7a15df4a1263d6d3ab5324be2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libctru/include/3ds/services/gspgpu.h b/libctru/include/3ds/services/gspgpu.h | |
index e03de9c9..2cf9693d 100644 | |
--- a/libctru/include/3ds/services/gspgpu.h | |
+++ b/libctru/include/3ds/services/gspgpu.h | |
@@ -62,7 +62,17 @@ typedef enum | |
GSPGPU_EVENT_MAX, ///< Used to know how many events there are. | |
} GSPGPU_Event; | |
-/// GSPGPU performance log entry | |
+/** | |
+ * GSPGPU performance log entry. | |
+ * | |
+ * Use the lastDurationUs field when benchmarking single GPU operations, this is usally meant | |
+ * for 3D library writers. | |
+ * | |
+ * Use the difference between two totalDurationUs when using a GPU library (e.g. citro3d), as | |
+ * there can be multiple GPU operations (e.g. P3D, PPF) per render pass, or per frame, and so on. | |
+ * Don't use totalDurationUs as-is (rather, take the difference as just described), because it | |
+ * can overflow. | |
+ */ | |
typedef struct | |
{ | |
u32 lastDurationUs; ///< Duration of the last corresponding PICA200 operation (time between op is started and IRQ is received). | |
@@ -294,7 +304,11 @@ Result GSPGPU_SetPerfLogMode(bool enabled); | |
/** | |
* @brief Retrieves the performance log. | |
- * @param outPerfLog Pointer to output the performance log to. | |
+ * @param[out] outPerfLog Pointer to output the performance log to. | |
+ * @note Use the difference between two totalDurationUs when using a GPU library (e.g. citro3d), as | |
+ * there can be multiple GPU operations (e.g. P3D, PPF) per render pass, or per frame, and so on. | |
+ * Don't use totalDurationUs as-is (rather, take the difference as just described), because it | |
+ * can overflow. | |
* @note For a MemoryFill operation that uses both PSC0 and PSC1, take the maximum | |
* of the two "last duration" entries. | |
* @note For PDC0/PDC1 (VBlank0/1), the "last duration" entry corresponds to the time between | |
@@ -304,7 +318,9 @@ Result GSPGPU_SetPerfLogMode(bool enabled); | |
* in the PDC0 handler. | |
* @bug The official sysmodule doesn't handle the PDC0/1 entries correctly after init. On the first | |
* frame \ref GSPGPU_SetPerfLogMode is enabled, "last duration" will have a nonsensical | |
- * value; and "total duration" stays nonsensical. | |
+ * value; and "total duration" stays nonsensical. This isn't much of a problem, except for the | |
+ * first frame, because "total duration" is not supposed to be used as-is (you are supposed | |
+ * to take the difference of this field between two time points of your choosing, instead). | |
* @bug Since it is running at approx. 3.25 GiB/s per bank, some small PSC operations might | |
* complete before the official GSP has time to record the start time. | |
* @bug The official sysmodule doesn't properly handle data synchronization for the perflog, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment