summaryrefslogtreecommitdiffstats
path: root/src/core/hw/gpu.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-02-15 16:00:48 +0100
committerbunnei <bunneidev@gmail.com>2015-02-15 16:00:48 +0100
commit20dc07721cb5035c7eed295033836301a2fe97b8 (patch)
treef85f1b0f5adbba78ea5692425d2cb505d881ecf5 /src/core/hw/gpu.h
parentMerge pull request #573 from lioncash/intflags (diff)
parentvideo_core: Implement the remaining framebuffer formats in the OpenGL renderer. (diff)
downloadyuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar
yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.gz
yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.bz2
yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.lz
yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.xz
yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.zst
yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.zip
Diffstat (limited to 'src/core/hw/gpu.h')
-rw-r--r--src/core/hw/gpu.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h
index 7c3a17ee5..9fd694f65 100644
--- a/src/core/hw/gpu.h
+++ b/src/core/hw/gpu.h
@@ -53,6 +53,7 @@ struct Regs {
"Structure size and register block length don't match")
#endif
+ // All of those formats are described in reverse byte order, since the 3DS is little-endian.
enum class PixelFormat : u32 {
RGBA8 = 0,
RGB8 = 1,
@@ -61,6 +62,24 @@ struct Regs {
RGBA4 = 4,
};
+ /**
+ * Returns the number of bytes per pixel.
+ */
+ static int BytesPerPixel(PixelFormat format) {
+ switch (format) {
+ case PixelFormat::RGBA8:
+ return 4;
+ case PixelFormat::RGB8:
+ return 3;
+ case PixelFormat::RGB565:
+ case PixelFormat::RGB5A1:
+ case PixelFormat::RGBA4:
+ return 2;
+ default:
+ UNIMPLEMENTED();
+ }
+ }
+
INSERT_PADDING_WORDS(0x4);
struct {