From 0a1da14a1563266ba1159cafaa63cf27a8604115 Mon Sep 17 00:00:00 2001 From: eladash Date: Fri, 30 Nov 2018 21:06:48 -0800 Subject: [PATCH] rsx image_in: remove clip h and w hack If clip region is empty, dont execute --- rpcs3/Emu/RSX/Capture/rsx_capture.cpp | 6 ++--- rpcs3/Emu/RSX/rsx_methods.cpp | 35 ++++++++++++--------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/rpcs3/Emu/RSX/Capture/rsx_capture.cpp b/rpcs3/Emu/RSX/Capture/rsx_capture.cpp index 21d48ba775..422d5e06b8 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_capture.cpp +++ b/rpcs3/Emu/RSX/Capture/rsx_capture.cpp @@ -273,8 +273,8 @@ namespace rsx { const rsx::blit_engine::transfer_operation operation = method_registers.blit_engine_operation(); - const u16 out_w = method_registers.blit_engine_output_width(); - const u16 out_h = method_registers.blit_engine_output_height(); + const u16 clip_w = std::min(method_registers.blit_engine_output_width(), method_registers.blit_engine_clip_width()); + const u16 clip_h = std::min(method_registers.blit_engine_output_height(), method_registers.blit_engine_clip_height()); const u16 in_w = method_registers.blit_engine_input_width(); const u16 in_h = method_registers.blit_engine_input_height(); @@ -288,7 +288,7 @@ namespace rsx u16 in_pitch = method_registers.blit_engine_input_pitch(); - if (in_w == 0 || in_h == 0 || out_w == 0 || out_h == 0) + if (in_w == 0 || in_h == 0 || clip_w == 0 || clip_h == 0) { return; } diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 32d5c8906f..75f186ca7d 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -811,36 +811,31 @@ namespace rsx //Clipping //Validate that clipping rect will fit onto both src and dst regions - u16 clip_w = std::min(method_registers.blit_engine_clip_width(), out_w); - u16 clip_h = std::min(method_registers.blit_engine_clip_height(), out_h); + const u16 clip_w = std::min(method_registers.blit_engine_clip_width(), out_w); + const u16 clip_h = std::min(method_registers.blit_engine_clip_height(), out_h); + + // Check both clip dimensions and dst dimensions + if (clip_w == 0 || clip_h == 0) + { + LOG_WARNING(RSX, "NV3089_IMAGE_IN: Operation NOPed out due to empty regions"); + return; + } + + if (in_w == 0 || in_h == 0) + { + LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: Invalid blit dimensions passed"); + return; + } u16 clip_x = method_registers.blit_engine_clip_x(); u16 clip_y = method_registers.blit_engine_clip_y(); - if (clip_w == 0) - { - clip_x = 0; - clip_w = out_w; - } - - if (clip_h == 0) - { - clip_y = 0; - clip_h = out_h; - } - //Fit onto dst if (clip_x && (out_x + clip_x + clip_w) > out_w) clip_x = 0; if (clip_y && (out_y + clip_y + clip_h) > out_h) clip_y = 0; u16 in_pitch = method_registers.blit_engine_input_pitch(); - if (in_w == 0 || in_h == 0 || out_w == 0 || out_h == 0) - { - LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: Invalid blit dimensions passed"); - return; - } - if (in_origin != blit_engine::transfer_origin::corner) { // Probably refers to texel geometry which would affect clipping algorithm slightly when rounding texel addresses