mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 00:42:48 +00:00
tile: Fix some tile thickness calculation errors.
This commit is contained in:
parent
a3967ccdb4
commit
bc344e4a52
@ -188,7 +188,7 @@ void ImageInfo::UpdateSize() {
|
|||||||
case AmdGpu::TilingMode::Display_MicroTiled:
|
case AmdGpu::TilingMode::Display_MicroTiled:
|
||||||
case AmdGpu::TilingMode::Texture_MicroTiled: {
|
case AmdGpu::TilingMode::Texture_MicroTiled: {
|
||||||
std::tie(mip_info.pitch, mip_info.size) =
|
std::tie(mip_info.pitch, mip_info.size) =
|
||||||
ImageSizeMicroTiled(mip_w, mip_h, bpp, thickness, num_samples);
|
ImageSizeMicroTiled(mip_w, mip_h, thickness, bpp, num_samples);
|
||||||
mip_info.height = std::max(mip_h, 8u);
|
mip_info.height = std::max(mip_h, 8u);
|
||||||
if (props.is_block) {
|
if (props.is_block) {
|
||||||
mip_info.pitch = std::max(mip_info.pitch * 4, 32u);
|
mip_info.pitch = std::max(mip_info.pitch * 4, 32u);
|
||||||
|
@ -313,8 +313,8 @@ constexpr std::pair<u32, size_t> ImageSizeMicroTiled(u32 pitch, u32 height, u32
|
|||||||
const auto& [pitch_align, height_align] = micro_tile_extent;
|
const auto& [pitch_align, height_align] = micro_tile_extent;
|
||||||
auto pitch_aligned = (pitch + pitch_align - 1) & ~(pitch_align - 1);
|
auto pitch_aligned = (pitch + pitch_align - 1) & ~(pitch_align - 1);
|
||||||
const auto height_aligned = (height + height_align - 1) & ~(height_align - 1);
|
const auto height_aligned = (height + height_align - 1) & ~(height_align - 1);
|
||||||
size_t log_sz = (pitch_aligned * height_aligned * bpp * num_samples * thickness + 7) / 8;
|
size_t log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8;
|
||||||
while (log_sz % 256) {
|
while ((log_sz * thickness) % 256) {
|
||||||
pitch_aligned += pitch_align;
|
pitch_aligned += pitch_align;
|
||||||
log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8;
|
log_sz = (pitch_aligned * height_aligned * bpp * num_samples + 7) / 8;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user