summaryrefslogtreecommitdiff
path: root/src/core/hw/gpu.cpp
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-07-22 13:29:25 +0200
committerGravatar Tony Wasserka2014-07-23 00:44:31 +0200
commit2eb61dafc0c957ad1591150ff1f8cd002b8851bb (patch)
tree3f79cc73866772374c827625f50ece32755cdfd3 /src/core/hw/gpu.cpp
parentGPU: Add documentation. (diff)
downloadyuzu-2eb61dafc0c957ad1591150ff1f8cd002b8851bb.tar.gz
yuzu-2eb61dafc0c957ad1591150ff1f8cd002b8851bb.tar.xz
yuzu-2eb61dafc0c957ad1591150ff1f8cd002b8851bb.zip
GPU: Clarify display transfer code.
Also makes the illogical component order more obvious.
Diffstat (limited to 'src/core/hw/gpu.cpp')
-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 edffa25c5..d18ff7625 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) {
157 for (int y = 0; y < config.output_height; ++y) { 157 for (int y = 0; y < config.output_height; ++y) {
158 // TODO: Why does the register seem to hold twice the framebuffer width? 158 // TODO: Why does the register seem to hold twice the framebuffer width?
159 for (int x = 0; x < config.output_width / 2; ++x) { 159 for (int x = 0; x < config.output_width / 2; ++x) {
160 int source[4] = { 0, 0, 0, 0}; // rgba; 160 struct {
161 int r, g, b, a;
162 } source_color = { 0, 0, 0, 0 };
161 163
162 switch (config.input_format) { 164 switch (config.input_format) {
163 case Regs::FramebufferFormat::RGBA8: 165 case Regs::FramebufferFormat::RGBA8:
164 { 166 {
165 // TODO: Most likely got the component order messed up. 167 // TODO: Most likely got the component order messed up.
166 u8* srcptr = source_pointer + x * 4 + y * config.input_width * 4 / 2; 168 u8* srcptr = source_pointer + x * 4 + y * config.input_width * 4 / 2;
167 source[0] = srcptr[0]; // blue 169 source_color.r = srcptr[0]; // blue
168 source[1] = srcptr[1]; // green 170 source_color.g = srcptr[1]; // green
169 source[2] = srcptr[2]; // red 171 source_color.b = srcptr[2]; // red
170 source[3] = srcptr[3]; // alpha 172 source_color.a = srcptr[3]; // alpha
171 break; 173 break;
172 } 174 }
173 175
@@ -181,19 +183,20 @@ inline void Write(u32 addr, const T data) {
181 { 183 {
182 // TODO: Untested 184 // TODO: Untested
183 u8* dstptr = (u32*)(dest_pointer + x * 4 + y * config.output_width * 4); 185 u8* dstptr = (u32*)(dest_pointer + x * 4 + y * config.output_width * 4);
184 dstptr[0] = source[0]; 186 dstptr[0] = source_color.r;
185 dstptr[1] = source[1]; 187 dstptr[1] = source_color.g;
186 dstptr[2] = source[2]; 188 dstptr[2] = source_color.b;
187 dstptr[3] = source[3]; 189 dstptr[3] = source_color.a;
188 break; 190 break;
189 }*/ 191 }*/
190 192
191 case Regs::FramebufferFormat::RGB8: 193 case Regs::FramebufferFormat::RGB8:
192 { 194 {
195 // TODO: Most likely got the component order messed up.
193 u8* dstptr = dest_pointer + x * 3 + y * config.output_width * 3 / 2; 196 u8* dstptr = dest_pointer + x * 3 + y * config.output_width * 3 / 2;
194 dstptr[0] = source[0]; // blue 197 dstptr[0] = source_color.r; // blue
195 dstptr[1] = source[1]; // green 198 dstptr[1] = source_color.g; // green
196 dstptr[2] = source[2]; // red 199 dstptr[2] = source_color.b; // red
197 break; 200 break;
198 } 201 }
199 202