aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/video_core/pica.h
diff options
context:
space:
mode:
authorGravatar tfarley <tfarleygithub@gmail.com>2015-05-18 21:21:33 -0700
committerGravatar tfarley <tfarleygithub@gmail.com>2015-05-22 15:51:18 -0700
commit05dc633a8c35221ce8d6abe6ddf027f8b0bab6c2 (patch)
treed080c1efd3b928bda551cb9eee304547e66a4351 /src/video_core/pica.h
parent6d995b1ff654483f830b6c285629545263393d7e (diff)
OpenGL renderer
Diffstat (limited to 'src/video_core/pica.h')
-rw-r--r--src/video_core/pica.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index e9bc7fb3..503c09ec 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -490,20 +490,37 @@ struct Regs {
}
}
- struct {
- // Components are laid out in reverse byte order, most significant bits first.
- enum ColorFormat : u32 {
- RGBA8 = 0,
- RGB8 = 1,
- RGB5A1 = 2,
- RGB565 = 3,
- RGBA4 = 4,
- };
+ // Components are laid out in reverse byte order, most significant bits first.
+ enum ColorFormat : u32 {
+ RGBA8 = 0,
+ RGB8 = 1,
+ RGB5A1 = 2,
+ RGB565 = 3,
+ RGBA4 = 4,
+ };
+ // Returns the number of bytes in the specified color format
+ static unsigned BytesPerColorPixel(ColorFormat format) {
+ switch (format) {
+ case ColorFormat::RGBA8:
+ return 4;
+ case ColorFormat::RGB8:
+ return 3;
+ case ColorFormat::RGB5A1:
+ case ColorFormat::RGB565:
+ case ColorFormat::RGBA4:
+ return 2;
+ default:
+ LOG_CRITICAL(HW_GPU, "Unknown color format %u", format);
+ UNIMPLEMENTED();
+ }
+ }
+
+ struct {
INSERT_PADDING_WORDS(0x6);
DepthFormat depth_format;
- BitField<16, 3, u32> color_format;
+ BitField<16, 3, ColorFormat> color_format;
INSERT_PADDING_WORDS(0x4);