rsx: Improve unnormalized coordinate sampling

- Improve rounding when sampling nearest neighbour. This is mostly a problem with NVIDIA
- Implement unnormalized 3D sampling
This commit is contained in:
kd-11 2021-07-31 17:27:16 +03:00 committed by kd-11
parent b3c65b7bca
commit 99b6963fab
9 changed files with 74 additions and 55 deletions

View file

@ -24,21 +24,21 @@ namespace rsx
case 0:
return;
case 1:
std::memcpy(dst, src, 16); return;
std::memcpy(dst, src, sizeof(TIU_slot)); return;
case 3:
std::memcpy(dst, src, 32); return;
std::memcpy(dst, src, sizeof(TIU_slot) * 2); return;
case 7:
std::memcpy(dst, src, 48); return;
std::memcpy(dst, src, sizeof(TIU_slot) * 3); return;
case 15:
std::memcpy(dst, src, 64); return;
std::memcpy(dst, src, sizeof(TIU_slot) * 4); return;
default:
break;
};
const auto start = std::countr_zero(mask);
const auto end = 16 - std::countl_zero(mask);
const auto mem_offset = (start * 16);
const auto mem_size = (end - start) * 16;
const auto mem_offset = (start * sizeof(TIU_slot));
const auto mem_size = (end - start) * sizeof(TIU_slot);
std::memcpy(static_cast<u8*>(dst) + mem_offset, reinterpret_cast<const u8*>(src) + mem_offset, mem_size);
}