aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hw
diff options
context:
space:
mode:
authorGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-07-22 13:29:25 +0200
committerGravatar Tony Wasserka <NeoBrainX@gmail.com>2014-07-23 00:44:31 +0200
commit2eb61dafc0c957ad1591150ff1f8cd002b8851bb (patch)
tree3f79cc73866772374c827625f50ece32755cdfd3 /src/core/hw
parent61e2ffd4483bf2da0862e32449caa9f1cecc5b72 (diff)
GPU: Clarify display transfer code.
Also makes the illogical component order more obvious.
Diffstat (limited to 'src/core/hw')
-rw-r--r--src/core/hw/gpu.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index edffa25c..d18ff762 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -157,17 +157,19 @@ inline void Write(u32 addr, const T data) {
for (int y = 0; y < config.output_height; ++y) {
// TODO: Why does the register seem to hold twice the framebuffer width?
for (int x = 0; x < config.output_width / 2; ++x) {
- int source[4] = { 0, 0, 0, 0}; // rgba;
+ struct {
+ int r, g, b, a;
+ } source_color = { 0, 0, 0, 0 };
switch (config.input_format) {
case Regs::FramebufferFormat::RGBA8:
{
// TODO: Most likely got the component order messed up.
u8* srcptr = source_pointer + x * 4 + y * config.input_width * 4 / 2;
- source[0] = srcptr[0]; // blue
- source[1] = srcptr[1]; // green
- source[2] = srcptr[2]; // red
- source[3] = srcptr[3]; // alpha
+ source_color.r = srcptr[0]; // blue
+ source_color.g = srcptr[1]; // green
+ source_color.b = srcptr[2]; // red
+ source_color.a = srcptr[3]; // alpha
break;
}
@@ -181,19 +183,20 @@ inline void Write(u32 addr, const T data) {
{
// TODO: Untested
u8* dstptr = (u32*)(dest_pointer + x * 4 + y * config.output_width * 4);
- dstptr[0] = source[0];
- dstptr[1] = source[1];
- dstptr[2] = source[2];
- dstptr[3] = source[3];
+ dstptr[0] = source_color.r;
+ dstptr[1] = source_color.g;
+ dstptr[2] = source_color.b;
+ dstptr[3] = source_color.a;
break;
}*/
case Regs::FramebufferFormat::RGB8:
{
+ // TODO: Most likely got the component order messed up.
u8* dstptr = dest_pointer + x * 3 + y * config.output_width * 3 / 2;
- dstptr[0] = source[0]; // blue
- dstptr[1] = source[1]; // green
- dstptr[2] = source[2]; // red
+ dstptr[0] = source_color.r; // blue
+ dstptr[1] = source_color.g; // green
+ dstptr[2] = source_color.b; // red
break;
}