summaryrefslogtreecommitdiff
path: root/src/core/hw/gpu.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2015-03-14 23:11:29 -0400
committerGravatar bunnei2015-03-14 23:11:29 -0400
commit3e5aeb9a7abb74fb5492f8f93265c03f45c1757a (patch)
tree598e8b31a39e7e6c94f6e63b5be487e69f9f3194 /src/core/hw/gpu.cpp
parentMerge pull request #658 from Subv/ref_temporary (diff)
parentGPU: Implemented the flip_data (bit 0) bit in display transfers. (diff)
downloadyuzu-3e5aeb9a7abb74fb5492f8f93265c03f45c1757a.tar.gz
yuzu-3e5aeb9a7abb74fb5492f8f93265c03f45c1757a.tar.xz
yuzu-3e5aeb9a7abb74fb5492f8f93265c03f45c1757a.zip
Merge pull request #657 from Subv/flip
GPU: Implemented the flip_data (bit 0) bit in display transfers.
Diffstat (limited to 'src/core/hw/gpu.cpp')
-rw-r--r--src/core/hw/gpu.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index f933a5e8d..07443616e 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -146,8 +146,17 @@ inline void Write(u32 addr, const T data) {
146 for (u32 x = 0; x < output_width; ++x) { 146 for (u32 x = 0; x < output_width; ++x) {
147 Math::Vec4<u8> src_color = { 0, 0, 0, 0 }; 147 Math::Vec4<u8> src_color = { 0, 0, 0, 0 };
148 148
149 u32 scaled_x = x * horizontal_scale; 149 // Calculate the [x,y] position of the input image
150 u32 scaled_y = y * vertical_scale; 150 // based on the current output position and the scale
151 u32 input_x = x * horizontal_scale;
152 u32 input_y = y * vertical_scale;
153
154 if (config.flip_vertically) {
155 // Flip the y value of the output data,
156 // we do this after calculating the [x,y] position of the input image
157 // to account for the scaling options.
158 y = output_height - y - 1;
159 }
151 160
152 u32 dst_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.output_format); 161 u32 dst_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.output_format);
153 u32 src_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.input_format); 162 u32 src_bytes_per_pixel = GPU::Regs::BytesPerPixel(config.input_format);
@@ -159,14 +168,14 @@ inline void Write(u32 addr, const T data) {
159 u32 coarse_y = y & ~7; 168 u32 coarse_y = y & ~7;
160 u32 stride = output_width * dst_bytes_per_pixel; 169 u32 stride = output_width * dst_bytes_per_pixel;
161 170
162 src_offset = (scaled_x + scaled_y * config.input_width) * src_bytes_per_pixel; 171 src_offset = (input_x + input_y * config.input_width) * src_bytes_per_pixel;
163 dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + coarse_y * stride; 172 dst_offset = VideoCore::GetMortonOffset(x, y, dst_bytes_per_pixel) + coarse_y * stride;
164 } else { 173 } else {
165 // Interpret the input as tiled and the output as linear 174 // Interpret the input as tiled and the output as linear
166 u32 coarse_y = scaled_y & ~7; 175 u32 coarse_y = input_y & ~7;
167 u32 stride = config.input_width * src_bytes_per_pixel; 176 u32 stride = config.input_width * src_bytes_per_pixel;
168 177
169 src_offset = VideoCore::GetMortonOffset(scaled_x, scaled_y, src_bytes_per_pixel) + coarse_y * stride; 178 src_offset = VideoCore::GetMortonOffset(input_x, input_y, src_bytes_per_pixel) + coarse_y * stride;
170 dst_offset = (x + y * output_width) * dst_bytes_per_pixel; 179 dst_offset = (x + y * output_width) * dst_bytes_per_pixel;
171 } 180 }
172 181