diff options
| author | 2015-02-15 10:00:48 -0500 | |
|---|---|---|
| committer | 2015-02-15 10:00:48 -0500 | |
| commit | 20dc07721cb5035c7eed295033836301a2fe97b8 (patch) | |
| tree | f85f1b0f5adbba78ea5692425d2cb505d881ecf5 /src/core | |
| parent | Merge pull request #573 from lioncash/intflags (diff) | |
| parent | video_core: Implement the remaining framebuffer formats in the OpenGL renderer. (diff) | |
| download | yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.gz yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.tar.xz yuzu-20dc07721cb5035c7eed295033836301a2fe97b8.zip | |
Merge pull request #539 from linkmauve/framebuffer-formats
Framebuffer formats
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hw/gpu.h | 19 |
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 { | |||
| 53 | "Structure size and register block length don't match") | 53 | "Structure size and register block length don't match") |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | // All of those formats are described in reverse byte order, since the 3DS is little-endian. | ||
| 56 | enum class PixelFormat : u32 { | 57 | enum class PixelFormat : u32 { |
| 57 | RGBA8 = 0, | 58 | RGBA8 = 0, |
| 58 | RGB8 = 1, | 59 | RGB8 = 1, |
| @@ -61,6 +62,24 @@ struct Regs { | |||
| 61 | RGBA4 = 4, | 62 | RGBA4 = 4, |
| 62 | }; | 63 | }; |
| 63 | 64 | ||
| 65 | /** | ||
| 66 | * Returns the number of bytes per pixel. | ||
| 67 | */ | ||
| 68 | static int BytesPerPixel(PixelFormat format) { | ||
| 69 | switch (format) { | ||
| 70 | case PixelFormat::RGBA8: | ||
| 71 | return 4; | ||
| 72 | case PixelFormat::RGB8: | ||
| 73 | return 3; | ||
| 74 | case PixelFormat::RGB565: | ||
| 75 | case PixelFormat::RGB5A1: | ||
| 76 | case PixelFormat::RGBA4: | ||
| 77 | return 2; | ||
| 78 | default: | ||
| 79 | UNIMPLEMENTED(); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 64 | INSERT_PADDING_WORDS(0x4); | 83 | INSERT_PADDING_WORDS(0x4); |
| 65 | 84 | ||
| 66 | struct { | 85 | struct { |