Skip to content

Commit b1f7bdc

Browse files
committed
gpu: added x direction support to VramToVram copy
1 parent 8e03583 commit b1f7bdc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/device/gpu/gpu.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,15 @@ void GPU::cmdVramToVram() {
523523
int w = MaskCopy::w(arguments[3] & 0xffff);
524524
int h = MaskCopy::h((arguments[3] & 0xffff0000) >> 16);
525525

526+
// Note: VramToVram copy is always Top-to-Bottom
527+
// but it might be Left-to-Right or Right-to-Left depending whether srcX < dstX
528+
// See gpu/vram-to-vram-overlap test
529+
bool dir = srcX < dstX;
530+
526531
for (int y = 0; y < h; y++) {
527-
for (int x = 0; x < w; x++) {
532+
for (int _x = 0; _x < w; _x++) {
533+
int x = (!dir) ? _x : w - 1 - _x;
534+
528535
uint16_t src = VRAM[(srcY + y) % VRAM_HEIGHT][(srcX + x) % VRAM_WIDTH];
529536
maskedWrite(dstX + x, dstY + y, src);
530537
}

0 commit comments

Comments
 (0)