rsx: image_in fix for clipx/y (#2440)

This commit is contained in:
Jake 2017-02-28 02:21:07 -06:00 committed by raven02
parent 01ef9ecca4
commit c3b424eb11

View file

@ -391,11 +391,15 @@ namespace rsx
const f32 in_x = method_registers.blit_engine_in_x();
const f32 in_y = method_registers.blit_engine_in_y();
const u16 clip_x = std::min(method_registers.blit_engine_clip_x(), u16(in_x + in_w - 1));
const u16 clip_y = std::min(method_registers.blit_engine_clip_y(), u16(in_y + in_h - 1));
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);
// if the clip'd region will end up outside of the source area, we ignore the given clip x/y and just use 0
// see: Spyro - BLES00382 intro, psgl sdk samples
const u16 clip_x = method_registers.blit_engine_clip_x() > (in_x + in_w - clip_w) ? 0 : method_registers.blit_engine_clip_x();
const u16 clip_y = method_registers.blit_engine_clip_y() > (in_y + in_h - clip_h) ? 0 : method_registers.blit_engine_clip_y();
u16 in_pitch = method_registers.blit_engine_input_pitch();
if (in_origin != blit_engine::transfer_origin::corner)
@ -490,8 +494,6 @@ namespace rsx
in_pitch = in_bpp * in_w;
}
//LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: src = 0x%x, dst = 0x%x", src_address, dst_address);
if (dst_color_format != rsx::blit_engine::transfer_destination_format::r5g6b5 &&
dst_color_format != rsx::blit_engine::transfer_destination_format::a8r8g8b8)
{
@ -504,10 +506,6 @@ namespace rsx
LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: unknown src_color_format (%d)", (u8)src_color_format);
}
//LOG_WARNING(RSX, "NV3089_IMAGE_IN_SIZE: SIZE=0x%08x, pitch=0x%x, offset=0x%x, scaleX=%f, scaleY=%f, CLIP_SIZE=0x%08x, OUT_SIZE=0x%08x",
// method_registers[NV3089_IMAGE_IN_SIZE], in_pitch, src_offset, double(1 << 20) / (method_registers[NV3089_DS_DX]), double(1 << 20) / (method_registers[NV3089_DT_DY]),
// method_registers[NV3089_CLIP_SIZE], method_registers[NV3089_IMAGE_OUT_SIZE]);
std::unique_ptr<u8[]> temp1, temp2, sw_temp;
AVPixelFormat in_format = (src_color_format == rsx::blit_engine::transfer_source_format::r5g6b5) ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_ARGB;