1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

rsx: fix image_in swizzled texture crash

This commit is contained in:
Jake 2017-12-07 01:31:18 -06:00 committed by Ivan
parent 0b3fbf1d4c
commit d0013679c0

View File

@ -837,21 +837,25 @@ namespace rsx
u8* linear_pixels = pixels_src;
u8* swizzled_pixels = temp2.get();
// restrict output to size of swizzle
const u16 sw_in_w = std::min(out_w, sw_width);
const u16 sw_in_h = std::min(out_h, sw_height);
// Check and pad texture out if we are given non square texture for swizzle to be correct
if (sw_width != out_w || sw_height != out_h)
if (sw_width != sw_in_w || sw_height != sw_in_h)
{
sw_temp.reset(new u8[out_bpp * sw_width * sw_height]);
switch (out_bpp)
{
case 1:
pad_texture<u8>(linear_pixels, sw_temp.get(), out_w, out_h, sw_width, sw_height);
pad_texture<u8>(linear_pixels, sw_temp.get(), sw_in_w, sw_in_h, sw_width, sw_height);
break;
case 2:
pad_texture<u16>(linear_pixels, sw_temp.get(), out_w, out_h, sw_width, sw_height);
pad_texture<u16>(linear_pixels, sw_temp.get(), sw_in_w, sw_in_h, sw_width, sw_height);
break;
case 4:
pad_texture<u32>(linear_pixels, sw_temp.get(), out_w, out_h, sw_width, sw_height);
pad_texture<u32>(linear_pixels, sw_temp.get(), sw_in_w, sw_in_h, sw_width, sw_height);
break;
}