summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwwylele <wwylele@gmail.com>2017-06-27 22:20:13 +0200
committerwwylele <wwylele@gmail.com>2017-06-27 22:20:23 +0200
commitbf16c73260787f80de2a0bc13b11737471695d0f (patch)
tree14c048ae681cb4b9c72278dd11369433eaef57e7 /src
parentMerge pull request #2778 from Subv/uds_more (diff)
downloadyuzu-bf16c73260787f80de2a0bc13b11737471695d0f.tar
yuzu-bf16c73260787f80de2a0bc13b11737471695d0f.tar.gz
yuzu-bf16c73260787f80de2a0bc13b11737471695d0f.tar.bz2
yuzu-bf16c73260787f80de2a0bc13b11737471695d0f.tar.lz
yuzu-bf16c73260787f80de2a0bc13b11737471695d0f.tar.xz
yuzu-bf16c73260787f80de2a0bc13b11737471695d0f.tar.zst
yuzu-bf16c73260787f80de2a0bc13b11737471695d0f.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hw/gpu.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 42809c731..a0a523822 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -5,6 +5,7 @@
#include <cstring>
#include <numeric>
#include <type_traits>
+#include "common/alignment.h"
#include "common/color.h"
#include "common/common_types.h"
#include "common/logging/log.h"
@@ -313,7 +314,7 @@ static void TextureCopy(const Regs::DisplayTransferConfig& config) {
const PAddr src_addr = config.GetPhysicalInputAddress();
const PAddr dst_addr = config.GetPhysicalOutputAddress();
- // TODO: do hwtest with these cases
+ // TODO: do hwtest with invalid addresses
if (!Memory::IsValidPhysicalAddress(src_addr)) {
LOG_CRITICAL(HW_GPU, "invalid input address 0x%08X", src_addr);
return;
@@ -324,31 +325,36 @@ static void TextureCopy(const Regs::DisplayTransferConfig& config) {
return;
}
- if (config.texture_copy.input_width == 0) {
- LOG_CRITICAL(HW_GPU, "zero input width");
+ if (VideoCore::g_renderer->Rasterizer()->AccelerateTextureCopy(config))
return;
- }
- if (config.texture_copy.output_width == 0) {
- LOG_CRITICAL(HW_GPU, "zero output width");
- return;
- }
+ u8* src_pointer = Memory::GetPhysicalPointer(src_addr);
+ u8* dst_pointer = Memory::GetPhysicalPointer(dst_addr);
- if (config.texture_copy.size == 0) {
+ u32 remaining_size = Common::AlignDown(config.texture_copy.size, 16);
+
+ if (remaining_size == 0) {
+ // Real hardware freeze on this
LOG_CRITICAL(HW_GPU, "zero size");
return;
}
- if (VideoCore::g_renderer->Rasterizer()->AccelerateTextureCopy(config))
- return;
-
- u8* src_pointer = Memory::GetPhysicalPointer(src_addr);
- u8* dst_pointer = Memory::GetPhysicalPointer(dst_addr);
-
- u32 input_width = config.texture_copy.input_width * 16;
u32 input_gap = config.texture_copy.input_gap * 16;
- u32 output_width = config.texture_copy.output_width * 16;
+ u32 input_width = input_gap == 0 ? remaining_size : config.texture_copy.input_width * 16;
u32 output_gap = config.texture_copy.output_gap * 16;
+ u32 output_width = output_gap == 0 ? remaining_size : config.texture_copy.output_width * 16;
+
+ if (input_width == 0) {
+ // Real hardware freeze on this
+ LOG_CRITICAL(HW_GPU, "zero input width");
+ return;
+ }
+
+ if (output_width == 0) {
+ // Real hardware freeze on this
+ LOG_CRITICAL(HW_GPU, "zero output width");
+ return;
+ }
size_t contiguous_input_size =
config.texture_copy.size / input_width * (input_width + input_gap);
@@ -360,7 +366,6 @@ static void TextureCopy(const Regs::DisplayTransferConfig& config) {
Memory::RasterizerFlushAndInvalidateRegion(config.GetPhysicalOutputAddress(),
static_cast<u32>(contiguous_output_size));
- u32 remaining_size = config.texture_copy.size;
u32 remaining_input = input_width;
u32 remaining_output = output_width;
while (remaining_size > 0) {