| 1 | // Copyright 2009 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "VideoBackends/Software/EfbCopy.h" |
| 5 | |
| 6 | #include <algorithm> |
| 7 | |
| 8 | #include "Common/CommonTypes.h" |
| 9 | #include "VideoBackends/Software/SWEfbInterface.h" |
| 10 | |
| 11 | #include "VideoCommon/BPMemory.h" |
| 12 | #include "VideoCommon/VideoCommon.h" |
| 13 | |
| 14 | namespace EfbCopy |
| 15 | { |
| 16 | void ClearEfb() |
| 17 | { |
| 18 | u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 | |
| 19 | (bpmem.clearcolorAR & 0xff00) >> 8; |
| 20 | |
| 21 | int left = bpmem.copyTexSrcXY.x; |
| 22 | int top = bpmem.copyTexSrcXY.y; |
| 23 | int right = std::min(left + bpmem.copyTexSrcWH.x, EFB_WIDTH - 1); |
| 24 | int bottom = std::min(top + bpmem.copyTexSrcWH.y, EFB_HEIGHT - 1); |
| 25 | |
| 26 | for (u16 y = top; y <= bottom; y++) |
| 27 | { |
| 28 | for (u16 x = left; x <= right; x++) |
| 29 | { |
| 30 | EfbInterface::SetColor(x, y, (u8*)(&clearColor)); |
| 31 | EfbInterface::SetDepth(x, y, bpmem.clearZValue); |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } // namespace EfbCopy |